body {
    background-color: var(--color-bg-subtle);
    min-height: 100vh;
}

/* Breadcrumb */
.ejs-breadcrumb .breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: var(--space-md);
    font-size: var(--font-xs);
}

.ejs-breadcrumb .breadcrumb-item a {
    color: var(--color-primary, #3B7A57);
}

.ejs-breadcrumb .breadcrumb-item.active {
    color: var(--color-text-secondary, #5C6B61);
}

/* Job title links within server-rendered cards */
.job-title-link {
    color: inherit;
    text-decoration: none;
}

.job-title-link:hover {
    color: var(--color-primary, #3B7A57);
    text-decoration: underline;
}

/* Hero section styles */
.hero-section {
    padding: 2rem 0;
    padding-bottom: 0;
    color: #2c3e50;
    position: relative;
    overflow: hidden;
}

.hero-title {
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
    position: relative;
    overflow: hidden;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: #34495e;
    font-weight: 300;
    max-width: 800px;
    margin: 0 auto;
}

@media (max-width: 576px) {
    .hero-section {
        padding: 1.5rem 0;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        padding: 0 1rem;
    }
}

@media (max-width: 375px) {
    .hero-section {
        padding: 1.25rem 0;
    }

    .hero-title {
        font-size: 1.35rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        padding: 0 0.75rem;
    }
}

/* --- Metrics Row --- */
.metrics-row {
    --bs-gutter-x: 2rem;
    --bs-gutter-y: 1rem;
    display: flex;
    flex-wrap: wrap;
    margin-top: .5rem;
}

.metric-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border-radius: var(--radius-lg, 12px);
    padding: 1.25rem;
    text-align: center;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    border-color: var(--bs-border-color);
}

.metric-card:hover {
    transform: translateY(-3px);
}

.metric-card i {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--color-primary-light, #4FA375);
    padding-right: 1rem;
}

.metric-value {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--color-text, #2D3732);
}

.metric-label {
    font-size: 0.95rem;
    color: var(--color-text-secondary, #5C6B61);
    margin: 0;
}

@media (max-width: 768px) {
    .metrics-row {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
        margin-bottom: 1.5rem !important;
    }
}

/* --- Company Logo --- */
.company-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8f9fa;
}

/* Section styles */
.all-jobs-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin: 30px 0;
    padding: 2rem;
    border-color: var(--bs-border-color);
}

/* Left filter layout styles */
.job-search-container {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

.filter-panel {
    flex: 0 0 300px;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.filter-panel .filter-section {
    margin-bottom: 1.5rem;
}

.filter-panel .filter-section:last-child {
    margin-bottom: 0;
}

.filter-panel .input-group {
    margin-bottom: 1.5rem;
}

/* Skeleton placeholders: raw selects look like loading bars until Tom Select replaces them */
.filter-panel select,
.side-panel-content select {
    appearance: none;
    -webkit-appearance: none;
    color: transparent;
    pointer-events: none;
    height: 38px;
    width: 100%;
    margin-bottom: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Tom Select in filter panels — full width + spacing */
.filter-panel .ts-wrapper,
.filter-side-panel .ts-wrapper {
    width: 100%;
    margin-bottom: 0.75rem;
}

/* Tom Select dropdown inside mobile side panel — must sit above panel content */
.filter-side-panel .ts-dropdown {
    z-index: 10;
}

/* Input & Dropdown Styles */
.input-group .form-control {
    border-radius: 6px;
    padding: 0.6rem 1rem;
    border: 1px solid var(--color-border, #e9ecef);
    font-size: 0.9rem;
}

.input-group .input-group-text {
    border-radius: 6px 0 0 6px;
    border: 1px solid var(--color-border, #e9ecef);
    border-right: none;
    background: var(--color-surface, white);
}

/* Clear Filters */
.clear-filters {
    display: none;
    color: var(--color-danger, #dc3545);
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 1rem;
    cursor: pointer;
}

.clear-filters:hover {
    text-decoration: underline;
    color: #bb2d3b;
}

.clear-filters i {
    margin-right: 0.25rem;
}

/* Toggle Switch Styles */
.form-check.form-switch {
    padding-left: 2.5rem;
    padding-top: 1rem;
}

.form-switch .form-check-input {
    width: 2.5em;
    height: 1.2em;
    margin-left: -2.5em;
    background-position: left center;
    border-radius: 2em;
    transition: background-position .15s ease-in-out;
}

.form-check-label {
    margin-left: 1rem;
    font-size: .9rem;
}

.form-check-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-check-input:disabled+.form-check-label {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Job Count and Sort Styles */
.job-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

.sort-by {
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 500;
}

/* Job Listings */
.job-listings {
    flex: 1;
}

.job-listing {
    background: var(--color-surface, #ffffff);
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--color-border, #e9ecef);
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.job-listing:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm, 0 3px 10px rgba(0, 0, 0, 0.1));
}

.job-listing:last-child {
    margin-bottom: 0;
}

.job-listing.featured-job {
    border: 1px solid var(--color-accent, #c4a484);
    background-color: #fff9e6;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

.job-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text, #212529);
    margin-bottom: 0.5rem;
    margin-right: 5px;
}

.company-name {
    font-size: 0.9rem;
    color: var(--color-text-muted, #6c757d);
}

.posted-date {
    font-size: 0.8rem;
    color: var(--color-text-muted, #6c757d);
}

.salary-range {
    font-size: 0.9rem;
    color: var(--color-text, #212529);
}

.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.job-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-muted, #6c757d);
}

.job-meta-item i {
    color: var(--color-secondary, #78a6c8);
    font-size: 0.8rem;
}

@media (max-width: 576px) {
    .job-listing {
        padding: 0.85rem;
        margin-bottom: 0.75rem;
    }

    .job-listing:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    /* Specific logo sizing for job listings */
    .job-listing .company-logo {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 400px) {
    .job-listing .company-logo {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 375px) {
    .job-listing .company-logo {
        width: 40px;
        height: 40px;
    }
}

/* Stack location and salary on mobile */
@media (max-width: 576px) {
    .job-listing .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    .job-listing .salary-range {
        margin-top: 0.25rem;
        padding-left: 0.15rem;
    }

    .job-listing .location {
        display: flex;
        align-items: center;
        gap: 0.35rem;
    }

    .job-listing .location i,
    .job-listing .salary-range i {
        width: 1rem;
        text-align: center;
        color: var(--color-primary, #3B7A57);
    }
}

@media (max-width: 375px) {
    .job-listing {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .job-listing .job-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        margin-top: 0.5rem;
    }

    .job-listing .job-meta-item {
        font-size: 0.75rem;
        padding: 0.35rem 0.5rem;
        background: rgba(120, 166, 200, 0.1);
        border-radius: 4px;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        min-height: 24px;
    }

    .job-listing .job-meta-item i {
        font-size: 0.75rem;
        color: var(--color-primary, #3B7A57);
    }

    .job-listing .salary-range {
        padding-left: 0.1rem;
    }
}

.filter-panel .form-check.form-switch {
    padding-top: 0;
}

.filter-panel .clear-filters {
    margin-top: 1.5rem;
    text-align: center;
    width: 100%;
    display: inline-block;
}

/* Mobile Filter Button */
.mobile-filter-btn {
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1030;
    padding: 10px 20px;
    border-radius: 20px;
    background: var(--color-primary, #3B7A57);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 120px;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.mobile-filter-btn:active {
    transform: translate(-50%, 1px);
    background: var(--color-primary-dark, #2D5D42);
}

@media (max-width: 375px) {
    .mobile-filter-btn {
        bottom: 12px;
        padding: 8px 16px;
        font-size: 0.85rem;
        min-width: 100px;
    }
}

.mobile-filter-btn:hover {
    background: var(--color-primary-dark, #2D5D42);
}

/* Bottom Sheet Styles */
.filter-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    z-index: 1040;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease-out, border-radius 0.3s ease;
    height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    padding-bottom: max(env(safe-area-inset-bottom, 16px), 16px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    overscroll-behavior: contain;
    /* Prevent scroll bleed */
}

/* When fully expanded, remove top border radius */
.filter-bottom-sheet.show {
    border-radius: 0;
}

/* Add a drag handle indicator */
.filter-bottom-sheet::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
}

.filter-bottom-sheet.show {
    transform: translateY(0);
}

.bottom-sheet-header {
    padding: 24px 16px 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
    margin-bottom: 8px;
}

.bottom-sheet-header h5 {
    margin: 0;
    font-weight: 600;
}

.bottom-sheet-header .close-sheet {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
}

.bottom-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.bottom-sheet-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .all-jobs-section {
        padding: 1rem;
        margin: 15px 0;
    }

    .job-search-container {
        flex-direction: column;
        margin-top: 1rem;
    }

    .job-search-container>.filter-panel {
        display: none;
    }

    .filter-bottom-sheet .filter-panel {
        position: static;
        box-shadow: none;
        border: none;
        padding: 0 1rem 1rem;
        height: calc(85vh - 69px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .filter-bottom-sheet .filter-section {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .filter-bottom-sheet .input-group {
        margin-bottom: 12px;
    }

    @media (max-width: 375px) {
        .filter-bottom-sheet .filter-section {
            margin-bottom: 12px;
            padding-bottom: 8px;
        }

        .bottom-sheet-header {
            padding: 16px 12px 12px;
        }

        .bottom-sheet-header h5 {
            font-size: 1rem;
        }

        .all-jobs-section {
            padding: 0.75rem;
            margin: 10px 0;
        }

        .job-listings {
            padding-bottom: 70px;
        }
    }

    /* Add some spacing between filter sections */
    .filter-bottom-sheet .filter-section {
        margin-bottom: 24px;
        padding-bottom: 16px;
        border-bottom: 1px solid #eee;
    }

    .filter-bottom-sheet .filter-section:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    /* Prevent body scroll when bottom sheet is open */
    body.bottom-sheet-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    /* Add padding to job listings to prevent overlap with filter button */
    .job-listings {
        padding-bottom: 80px;
    }

    /* Ensure filter button stays above bottom sheet */
    .mobile-filter-btn {
        z-index: 1041;
    }
}

/* --- Mobile Filter Side Panel --- */

/* Side Panel Container */
.filter-side-panel {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 85%;
    max-width: 320px;
    background-color: #fff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

.filter-side-panel.show {
    transform: translateX(0);
}

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.side-panel-header h5 {
    margin: 0;
    font-weight: 600;
}

.side-panel-header .close-panel-btn {
    background: #f0f0f0;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}

.side-panel-content {
    overflow-y: auto;
    padding: 1rem;
    flex-grow: 1;
}

/* Backdrop for the side panel */
.panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
}

.panel-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* --- Auth Modal --- */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    overflow-y: auto;
}

.auth-modal.show {
    display: block;
    padding-top: 50px;
}

.auth-modal-content {
    background: white;
    max-width: 500px;
    margin: 40px auto;
    padding: 30px;
    border-radius: 8px;
    position: relative;
}

.auth-modal-header {
    text-align: center;
    margin-bottom: 20px;
}

.auth-modal-header h3 {
    margin-bottom: 10px;
}

.auth-modal-message {
    text-align: center;
    margin-bottom: 20px;
    color: #666;
}

.auth-modal .close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
    line-height: 1;
}

.auth-modal .close-modal:hover {
    color: #333;
}

.auth-modal .auth-footer {
    font-size: 0.9rem;
    color: #666;
}

.auth-benefits {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    text-align: left;
}

.auth-benefits h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #343a40;
}

.auth-benefits ul {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 0;
}

.auth-benefits li {
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
}

.auth-benefits li:last-child {
    margin-bottom: 0;
}

.auth-benefits i {
    color: #28a745;
    margin-right: 10px;
    margin-top: 3px;
}