/*
   Modern Structured Marketplace
   High Power Layout + Premium 2024 Aesthetics
*/

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

.modern-offers {
    background-color: #f8fafc; /* Softer, premium off-white */
    padding: 32px 0 80px;
    font-family: 'Inter', sans-serif;
}

.offers-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    gap: 32px;
}

/* --- Clean Sidebar --- */
.modern-sidebar {
    width: 290px;
    flex-shrink: 0;
    background: #fff;
    padding: 24px;
    border-radius: 3px;
    height: fit-content;
    position: sticky;
    top: 24px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    border-bottom: 3px solid #0045A5;
    margin-bottom: 24px;
    padding-bottom: 12px;
}

.sidebar-header h3 {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-group {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
}
.filter-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.filter-group input[type="text"],
.filter-group input[type="number"],
.filter-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    font-size: 14px;
    color: #1e293b;
    background: #fff;
    transition: all 0.2s;
}

.filter-group input:focus, .filter-group select:focus {
    border-color: #0045A5;
    box-shadow: 0 0 0 3px rgba(0, 69, 165, 0.1);
    outline: none;
}

/* --- Results Area --- */
.results-area { flex: 1; display: flex; flex-direction: column; gap: 16px; }

/* --- Results Area --- */
.results-area { flex: 1; display: flex; flex-direction: column; gap: 16px; }

.results-header-pro h2 { 
    font-size: 24px; 
    font-weight: 800; 
    color: #1e293b; 
    margin-bottom: 2px; 
    letter-spacing: -0.02em;
}
.results-count { font-size: 13px; color: #64748b; font-weight: 500; }

/* --- Premium List Card --- */
.results-list-wrapper { display: flex; flex-direction: column; gap: 16px; }

.car-card-list {
    background: #F9FAFC;
    border-radius: 5px;
    display: grid;
    grid-template-columns: 280px 1fr 220px;
    min-height: 200px;
    overflow: hidden;
    border: 1px solid transparent;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.car-card-list:hover {
    border-color: transparent;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.card-media-side {
    position: relative;
    overflow: hidden;
    background: #f1f5f9;
}

.card-media-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.car-card-list:hover .card-media-side img { transform: scale(1.05); }

.badge-gallery {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(15, 23, 42, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Info Section */
.card-info-side { 
    padding: 24px; 
    display: flex; 
    flex-direction: column; 
    border-right: 1px solid #f8fafc; 
}

.badge-featured {
    background: #f0f7ff;
    color: #0045A5;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    width: fit-content;
    margin-bottom: 12px;
    border: 1px solid #e0efff;
}

.card-title-pro {
    font-size: 18px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 10px;
    line-height: 1.4;
}

.card-specs-pro {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.card-specs-pro span {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-specs-pro i { color: #0045A5; font-size: 12px; opacity: 0.8; }

.card-secondary-info {
    margin-top: auto;
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Price Section */
.card-price-side {
    padding: 24px;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
}

.price-pro {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.price-pro span { font-size: 13px; font-weight: 500; margin-left: 4px; color: #64748b; }

.price-label-pro { display: none; }

.card-price-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.btn-reserve-pro {
    width: 100%;
    background: #003785;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    text-decoration: none;
    box-shadow: none;
}

.btn-reserve-pro:hover {
    background: #002a66;
    transform: translateY(-1px);
    box-shadow: none;
}

.btn-fav-list {
    background: #fff;
    width: 100%;
    height: 40px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-fav-list:hover { border-color: #ef4444; color: #ef4444; background: #fffcfc; }
.btn-fav-list.active { background: #fff1f2; color: #ef4444; border-color: #fecdd3; }
.btn-fav-list.active i { font-weight: 900; }

/* Wyróżnione state override */
.is-sponsored { 
    background: #f1f5f9; 
    border-color: transparent; 
}

/* Pagination */
.modern-pagination {
    margin-top: 48px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.page-numbers a, .page-nav {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
    text-decoration: none;
    transition: all 0.2s;
}

.page-nav { padding: 0 16px; width: auto; font-size: 13px; }

.page-numbers a.active {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
}

.page-numbers a:hover:not(.active), .page-nav:hover {
    border-color: #0045A5;
    color: #0045A5;
}

/* Filter buttons */
.apply-filters {
    width: 100%;
    background: #0045A5;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 2px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    margin-top: 10px;
}

.btn-cancel {
    background: #fff;
    border: 1px solid #ccc;
    color: #333;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    border-radius: 2px;
    transition: all 0.2s;
}

.btn-cancel:hover {
    border-color: #0045A5;
    color: #0045A5;
}

/* Ultra-Compact Premium Header */
.results-header-pro {
    background: #fff;
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    gap: 12px;
}

.results-header-pro h2 { 
    font-size: 18px; 
    white-space: nowrap;
}

.results-count { 
    font-size: 12px;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* More Compact View Toggles */
.view-toggle-btns {
    padding: 2px;
}

.view-btn {
    padding: 6px 10px;
    font-size: 13px;
}

/* Compact Action Button */
.btn-action-premium {
    padding: 8px 14px;
    font-size: 12px;
}

/* Compact Premium Select */
.select-premium {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 145px;
}

@media (max-width: 991px) {
    .view-toggle-btns {
        display: none !important; /* Force grid only on mobile */
    }

    .results-header-pro {
        padding: 10px 14px;
        gap: 8px;
    }

    .header-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .select-premium {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .btn-action-premium span {
        display: none; /* Hide text on small screens, keep only bell */
    }
    
    .btn-action-premium {
        padding: 8px 10px;
    }

    .results-header-pro h2 {
        font-size: 16px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .select-premium {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 991px) {
    .offers-container { 
        flex-direction: column; 
        padding: 0 16px;
        gap: 16px;
    }

    /* Mobile Sidebar as a Drawer - Enhanced Transition */
    .modern-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 90vh;
        z-index: 3000;
        border-radius: 24px 24px 0 0;
        transform: translateY(102%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex !important; /* Ensure it stays flex but hidden via transform */
        flex-direction: column;
        padding: 0;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
        visibility: hidden;
    }

    .modern-sidebar.active {
        transform: translateY(0);
        visibility: visible;
    }

    .sidebar-header {
        position: sticky;
        top: 0;
        background: #fff;
        padding: 20px 24px;
        border-bottom: 3px solid var(--primary);
        z-index: 10;
        margin: 0;
    }

    .sidebar-content-mobile {
        flex: 1;
        overflow-y: auto;
        padding: 24px;
    }

    .sidebar-footer-mobile {
        padding: 16px 24px;
        background: #fff;
        border-top: 1px solid #f1f5f9;
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

/* Standardized Mobile Card - Forced Grid Pattern */
@media (max-width: 991px) {
    .results-list-wrapper {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .car-card-list {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
    }

    .card-media-side { 
        height: 220px !important; /* Fixed height for the whole container */
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 80px !important;
        gap: 4px;
        background: #000;
        overflow: hidden;
    }

    .media-main {
        height: 220px;
        width: 100%;
    }

    .media-main img {
        width: 100%;
        height: 100%;
        object-fit: cover !important; /* Ensure image fills the space */
        display: block;
    }

    .media-subs {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        height: 220px;
    }

    .sub-item {
        height: 110px; /* Half of 220px minus some gap */
    }

    .sub-item img {
        width: 100%;
        height: 100%;
        object-fit: cover !important;
    }

    .badge-gallery-v2 {
        display: flex !important;
    }

    .card-info-side { 
        padding: 15px 18px 8px !important;
        border-bottom: 1px solid #f1f5f9;
        text-align: left !important;
        align-items: flex-start !important;
    }

    .card-title-pro {
        margin-bottom: 4px !important;
        font-size: 16px !important;
    }

    .card-specs-pro {
        margin-bottom: 0 !important;
    }

    .card-price-side {
        padding: 10px 18px 15px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }

    .card-price-actions {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 44px !important;
        gap: 8px !important;
    }

    .btn-reserve-pro {
        padding: 14px;
        font-size: 14px;
    }
}
}

/* --- Grid View Mode (3x3) --- */
.results-list-wrapper.grid-view {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-view .car-card-list {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    min-height: auto;
}

.grid-view .card-media-side {
    height: 200px;
    width: 100%;
}

.grid-view .card-info-side {
    border-right: none;
    border-bottom: 1px solid #f8fafc;
    flex: 0 0 auto;
    padding: 20px;
}

.grid-view .card-price-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: transparent;
}

.grid-view .card-price-actions {
    flex-direction: row;
    width: auto;
    flex: 1;
    justify-content: flex-end;
}

.grid-view .btn-reserve-pro {
    width: auto;
    padding: 8px 16px;
    font-size: 11px;
}

.grid-view .btn-fav-list {
    width: 36px;
    height: 36px;
}

.grid-view .price-pro {
    font-size: 20px;
}

.view-btn.active {
    pointer-events: none;
}

@media (max-width: 1100px) {
    .results-list-wrapper.grid-view {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .results-list-wrapper.grid-view {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Consolidated into 991px for card consistency */
    .card-media-side { height: 180px; }
}

@media (max-width: 991px) {
    .mobile-only { display: block !important; }
    .mobile-only-inline { display: inline-block !important; }
}
