@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Reset & Core --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    width: 100%;
    min-height: 0;
    height: auto;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 8px 0;
}

.header-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 50px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    min-height: 100%;
}

.main-nav {
    display: flex;
    gap: 23px;
    align-items: flex-end;
    height: 50px;
    padding-bottom: 0;
}

.main-nav a {
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    color: #64748b;
    padding: 13px 0 3px 0;
    border-bottom: 3px solid transparent;
}

.active-link {
    color: #0f172a !important;
}

.nav-ads.active-link {
    border-bottom-color: #D92226 !important;
}

.nav-usedsale.active-link {
    border-bottom-color: #FCCE08 !important;
}

.nav-market.active-link {
    border-bottom-color: #E5097F !important;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 100%;
}

.nav-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-login {
    background: #0f172a;
    color: white;
}

/* --- SAS World Ads --- */
.page-wrapper {
    padding: 20px 15px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

/* Filter bar font/padding/gap: ../style.css */
.classifieds-filter-bar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.location-filter select {
    min-width: 0;
    width: auto;
    flex: 0 1 auto;
    max-width: 100%;
    padding: 0 !important;
    background-image: none !important;
    text-align: left !important;
    text-align-last: left !important;
}

@media (min-width: 600px) {
    #ads-select {
        min-width: 90px;
        width: 100%;
        flex: 1;
        max-width: 100%;
    }
}

.classifieds-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
    margin-top: 20px;
    justify-content: center;
}

.classified-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 280px;
    min-height: 280px;
    max-height: 280px;
}

.classified-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card-img {
    height: 160px;
    background-size: cover;
    background-position: center;
    background-color: #cbd5e1;
    width: 100%;
    position: relative;
}

.card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.card-footer button,
.card-footer .contact-btn,
.card-footer .card-type-badge {
    height: 32px;
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0 4px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-type-badge {
    border: none;
    font-weight: 700;
    cursor: default;
    user-select: none;
}

.card-type-badge--ads {
    background: #fef3c7;
    color: #92400e;
}

.card-type-badge--service {
    background: #dbeafe;
    color: #1e40af;
}

.card-details-link {
    text-decoration: none;
    flex: 0 0 auto;
}

.card-details-btn {
    border: 1px solid #e2e8f0;
    background: #0f172a;
    color: #ffffff;
    cursor: pointer;
}

.card-details-btn:hover {
    background: #1e293b;
}

.contact-btn {
    background: #008DD2;
    color: #ffffff;
    border: none;
    cursor: pointer;
}

.contact-btn:hover {
    background: #0077b3;
}

.contact-btn.is-phone-only {
    background: #D92226;
}

.contact-btn.is-phone-only:hover {
    background: #b81c20;
}

.site-footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 32px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
    margin-top: auto;
}

@media (max-width: 850px) and (min-width: 600px) {
    .classifieds-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.filter-item select option {
    padding: 0 10px;
}

/* Mobile: Location | Search | Ads; desktop: same row layout */
@media (max-width: 599px) {
    .classifieds-filter-bar.no-category-filter {
        display: flex !important;
        flex-flow: row nowrap !important;
        align-items: stretch !important;
        justify-content: center !important;
        gap: 6px !important;
        padding: 8px 6px !important;
    }

    .classifieds-filter-bar.no-category-filter > .location-filter.location-select-wrap,
    .classifieds-filter-bar.no-category-filter > .search-filter-ads,
    .classifieds-filter-bar.no-category-filter > .ads-filter.ads-select-wrap {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    .classifieds-filter-bar.no-category-filter > .location-filter.location-select-wrap {
        order: 1 !important;
    }

    .classifieds-filter-bar.no-category-filter > .search-filter-ads {
        order: 2 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 30px !important;
        max-height: 30px !important;
        padding: 3px 6px !important;
        background: #f1f5f9 !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        overflow: hidden !important;
    }

    .classifieds-filter-bar.no-category-filter > .search-filter-ads svg {
        display: none !important;
    }

    .classifieds-filter-bar.no-category-filter > .search-filter-ads input {
        width: 100% !important;
        min-width: 0 !important;
        font-size: 11px !important;
        text-align: center !important;
    }

    .classifieds-filter-bar.no-category-filter > .search-filter-ads input::placeholder {
        font-size: 11px !important;
        text-align: center !important;
    }

    .classifieds-filter-bar.no-category-filter > .ads-filter.ads-select-wrap {
        order: 3 !important;
        display: block !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
    }

    .classifieds-filter-bar.no-category-filter #ads-select,
    .classifieds-filter-bar.no-category-filter .ads-select-wrap > select,
    .classifieds-filter-bar.no-category-filter .ads-filter select {
        display: none !important;
        visibility: hidden !important;
        position: absolute !important;
        width: 0 !important;
        height: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        overflow: hidden !important;
        pointer-events: none !important;
        opacity: 0 !important;
        flex: 0 0 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }

    .classifieds-filter-bar.no-category-filter .ads-select-wrap > *:not(.cat-search-dropdown) {
        display: none !important;
    }

    .classifieds-filter-bar.no-category-filter .ads-select-wrap .cat-search-dropdown {
        display: block !important;
        width: 100% !important;
        min-height: 30px !important;
    }
}

@media (min-width: 600px) {
    .classifieds-filter-bar.no-category-filter .location-filter {
        order: 1 !important;
    }

    .classifieds-filter-bar.no-category-filter .search-filter {
        order: 2 !important;
    }

    .classifieds-filter-bar.no-category-filter .ads-filter {
        order: 3 !important;
    }
}
