/* =============================================
   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);
}

.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: 20px;
}

.list-view .ad-card {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    max-width: 100%;
    height: 200px;
    flex-direction: row; /* Overriding default flex if any */
}

.list-view .ad-card__img {
    height: 100%;
    border-radius: 20px 0 0 20px;
}

.list-view .ad-card__content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.list-view .ad-card__price {
    font-size: 24px;
    margin-bottom: 10px;
}

.list-view .ad-card__title {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 12px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: auto;
    color: var(--dark-green);
}

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

/* 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: 0;
        overflow-y: auto;
        box-shadow: 10px 0 50px rgba(0,0,0,0.1);
        display: flex;
        flex-direction: column;
    }

    .filter-mobile-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid var(--border-color);
        background: #fcfdfe;
    }

    .filter-mobile-header h3 {
        font-size: 18px;
        font-weight: 800;
        color: var(--dark-green);
        margin: 0;
    }

    .close-filters-btn {
        background: #f1f5f9;
        border: none;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--text-muted);
    }

    .filters-sidebar .filter-group {
        padding: 20px;
        margin-bottom: 0;
        border-bottom: 1px solid #f8fafc;
    }

    .filters-sidebar a[style*="Clear All Filters"] {
        padding: 20px;
        margin-top: 0 !important;
    }

    .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;
    }
}
