/* =============================================
   AD LISTING SCREEN STYLES — listing.css
   ============================================= */

:root {
    --primary-green: #6db34d;
    --dark-green: #25452c;
    --light-bg: #f8faf9;
    --white: #ffffff;
    --border-color: #eef2f6;
    --text-main: #2d3748;
    --text-muted: #718096;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.05);
}

main {
    background-color: var(--light-bg);
}

.listing-container {
    max-width: 1350px;
    width: 100%;
    margin: 0 auto;
    padding: 30px 20px;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
    background: var(--light-bg);
    box-sizing: border-box;
}

/* Sidebar Filters */
.filters-sidebar {
    background: var(--white);
    padding: 25px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 100px;
    height: fit-content;
}

.filter-group {
    margin-bottom: 30px;
}

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

.filter-group h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--dark-green);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-list {
    list-style: none;
    padding: 0;
}

.filter-list li {
    margin-bottom: 10px;
}

.filter-list a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 14.5px;
    display: flex;
    justify-content: space-between;
    transition: all 0.2s;
}

.filter-list a:hover {
    color: var(--primary-green);
    transform: translateX(3px);
}

.price-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.price-inputs input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.filter-btn {
    width: 100%;
    background: var(--primary-green);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 15px;
}

/* Listing Header */
.listing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background: var(--white);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 15px;
}

.mobile-filter-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-weight: 700;
    color: var(--dark-green);
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-filter-btn:hover {
    background: #f8fafc;
    border-color: var(--primary-green);
}

.mobile-filter-btn i {
    width: 18px;
    height: 18px;
}

.listing-results h2 {
    font-size: 18px;
    color: var(--text-main);
}

.listing-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.view-switcher {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
}

.view-btn {
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.view-btn.active {
    background: var(--white);
    color: var(--primary-green);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-main);
    background: white;
}

/* List Mode specialized Styles */
.ads-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.list-view .ad-card {
    display: flex;
    flex-direction: row;
    height: 240px;
    min-height: 240px;
    max-width: 100%;
    border-radius: var(--radius-md);
    background: var(--white);
    overflow: hidden;
    transition: var(--transition);
}

.list-view .ad-card__img {
    width: 340px;
    min-width: 340px;
    height: 100%;
    flex-shrink: 0;
    border-radius: 0;
}

.list-view .ad-card__content {
    padding: 25px 35px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
    overflow: hidden;
}

.list-view .ad-card__price-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.list-view .ad-card__price {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0;
}

.list-view .ad-card__title {
    font-size: 20px;
    font-weight: 700;
    margin: 5px 0 10px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
    width: 100%;
}

.list-view .ad-list-description {
    font-size: 14.5px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 5px 0 15px 0;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
}

.list-view .ad-card__footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

/* Grid Mode (Standard inherited) */
.ads-grid.grid-view {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Pagination */
.pagination-container {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

/* Responsive */
@media (max-width: 1200px) {
    .ads-grid.grid-view {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .listing-container {
        grid-template-columns: 1fr;
    }

    .filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        z-index: 2000;
        border-radius: 0;
        background: rgba(0, 0, 0, 0.5);
        /* Overlay effect */
        padding: 0;
        display: flex;
        justify-content: flex-start;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        opacity: 0;
        visibility: hidden;
    }

    .filters-sidebar.mobile-active {
        left: 0;
        opacity: 1;
        visibility: visible;
    }

    .filters-sidebar form {
        width: 300px;
        height: 100%;
        background: white;
        padding: 30px 20px;
        overflow-y: auto;
        box-shadow: 10px 0 50px rgba(0, 0, 0, 0.1);
    }

    .mobile-filter-btn {
        display: flex;
    }
}

@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }

    .listing-container {
        padding: 20px 15px;
    }

    .listing-header {
        padding: 12px 15px;
    }

    .listing-results h2 {
        font-size: 15px;
    }

    .ads-grid.grid-view {
        grid-template-columns: 1fr;
    }

    /* Ensure only card view on mobile */
    .ads-grid.list-view {
        display: grid;
        grid-template-columns: 1fr;
    }

    .list-view .ad-card {
        grid-template-columns: 1fr;
        height: auto;
        display: flex;
    }

    .list-view .ad-card__img {
        height: 200px;
        border-radius: 16px 16px 0 0;
    }
}

@media (max-width: 480px) {
    .ad-card__img {
        height: 180px;
    }
}