/* ========================================
   Motorama Gibraltar - Vehicles Section & Pages
   ======================================== */

/* ========================================
   QUICK FILTER CHIPS
   ======================================== */
.quick-filters-section {
    padding: 1rem 0 0;
    background: var(--color-bg-primary);
    position: sticky;
    top: calc(var(--navbar-height, 70px));
    z-index: 50;
    border-bottom: 1px solid var(--color-border);
}

.quick-filters-wrapper {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

/* Mobile scroll hint animation */
@keyframes scrollHint {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-30px); }
}

@media (max-width: 768px) {
    .quick-filters-wrapper {
        animation: scrollHint 1.5s ease-in-out;
        animation-delay: 0.5s;
        animation-iteration-count: 2;
    }
}

.quick-filters-wrapper::-webkit-scrollbar {
    display: none;
}

.quick-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.quick-filter-chip:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-primary);
    color: var(--color-text-primary);
}

.quick-filter-chip.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.quick-filter-chip svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ========================================
   VEHICLES PAGE LAYOUT
   ======================================== */
.vehicles-page {
    padding: 2rem 0 4rem;
}

.vehicles-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Mobile Filter Toggle */
.filter-toggle-btn {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 1rem;
    width: 100%;
    justify-content: center;
}

.filter-toggle-btn:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-primary);
}

/* ========================================
   SIDEBAR FILTERS
   ======================================== */
.vehicles-sidebar {
    position: sticky;
    top: calc(var(--navbar-height, 70px) + 80px);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    max-height: calc(100vh - var(--navbar-height, 70px) - 120px);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.close-sidebar-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
}

.close-sidebar-btn:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.filter-scroll-container {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
}

/* Filter Widget */
.filter-widget {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.filter-widget:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.widget-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    padding: 0.375rem 0;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    transition: color 0.15s ease;
}

.checkbox-label:hover {
    color: var(--color-text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-text-muted);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.15s ease;
    position: relative;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label span {
    flex: 1;
}

/* Range Inputs */
.range-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.range-inputs .form-control {
    flex: 1;
    min-width: 0;
}

.range-separator {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

/* Reset Button */
.reset-filters-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--color-text-primary) !important;
    background: transparent;
    border: 1px solid var(--color-border);
}

.reset-filters-btn:hover {
    color: var(--color-primary) !important;
    border-color: var(--color-primary);
    background: rgba(var(--color-primary-rgb, 176, 38, 51), 0.1);
}

/* ========================================
   VEHICLES CONTENT AREA
   ======================================== */
.vehicles-content {
    min-width: 0;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.filter-info {
    flex-shrink: 0;
}

.results-count {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.results-count strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

.filter-bar-search {
    flex: 1;
    min-width: 200px;
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.search-input-wrapper .form-control {
    padding-left: 2.5rem;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.filter-select {
    padding: 0.625rem 2rem 0.625rem 0.875rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ========================================
   FEATURED VEHICLES SECTION (Homepage)
   ======================================== */
.featured-vehicles {
    position: relative;
    background: var(--color-bg-secondary);
}

.featured-vehicles::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 0% 50%, rgba(255, 51, 102, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 50%, rgba(51, 102, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.featured-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--spacing-2xl);
    flex-wrap: wrap;
    gap: var(--spacing-lg);
}

.featured-header .section-header {
    text-align: left;
    margin-bottom: 0;
}

/* ========================================
   VEHICLES GRID
   ======================================== */
.vehicles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* ========================================
   VEHICLE CARD (Modern Design)
   ======================================== */
.vehicle-card {
    position: relative;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all 0.3s ease;
}

.vehicle-card:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--color-primary-rgb, 176, 38, 51), 0.4);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.vehicle-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Vehicle Image */
.vehicle-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--color-bg-tertiary);
}

.vehicle-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.vehicle-card:hover .vehicle-image img {
    transform: scale(1.05);
}

.vehicle-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* Vehicle Badges */
.vehicle-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    z-index: 2;
}

.vehicle-badge,
.vehicle-condition-badge {
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
}

.vehicle-condition-badge {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    backdrop-filter: blur(4px);
}

.vehicle-condition-badge.new {
    background: linear-gradient(135deg, var(--color-success) 0%, #28a745 100%);
    color: white;
}

.vehicle-condition-badge.used {
    background: rgba(0, 0, 0, 0.75);
    color: white;
}

.vehicle-badge {
    background: var(--color-primary);
    color: white;
}

.vehicle-badge.reserved {
    background: var(--color-warning, #f0ad4e);
    color: #000;
}

/* Vehicle Info */
.vehicle-info {
    padding: 1.25rem;
}

.vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.vehicle-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
    line-height: 1.3;
}

.vehicle-year {
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: var(--color-bg-secondary);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.vehicle-type {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin: 0 0 1rem 0;
}

/* Vehicle Specs */
.vehicle-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.vehicle-specs .spec {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.vehicle-specs .spec svg {
    width: 14px;
    height: 14px;
    color: var(--color-text-muted);
}

/* Vehicle Footer */
.vehicle-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.vehicle-price-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.vehicle-price {
    font-family: var(--font-display, 'Montserrat', sans-serif);
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.vehicle-finance {
    font-size: 0.75rem;
    color: var(--color-success, #28a745);
    font-weight: 500;
}

.view-details {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-primary);
    transition: transform 0.2s ease;
}

.vehicle-card:hover .view-details {
    transform: translateX(4px);
}

/* ========================================
   LOADING STATES
   ======================================== */
.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.vehicle-card-skeleton {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 25%,
        var(--color-bg-secondary) 50%,
        var(--color-bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* ========================================
   EMPTY STATE
   ======================================== */
.vehicles-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.vehicles-empty h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* ========================================
   CTA BANNER
   ======================================== */
.cta-banner {
    background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-tertiary) 100%);
    padding: 4rem 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.cta-content {
    max-width: 600px;
    margin: 0 auto;
}

.cta-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.cta-text {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.cta-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */
@media (max-width: 1024px) {
    .vehicles-layout {
        grid-template-columns: 1fr;
    }
    
    .filter-toggle-btn {
        display: flex;
    }
    
    /* Sidebar Overlay */
    .vehicles-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 320px;
        height: 100vh;
        max-height: 100vh;
        z-index: 1000;
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .vehicles-sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
    }
    
    .close-sidebar-btn {
        display: flex;
    }
    
    /* Overlay backdrop */
    .vehicles-sidebar::before {
        content: '';
        position: fixed;
        top: 0;
        left: 100%;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    
    .vehicles-sidebar.active::before {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 768px) {
    .vehicles-page {
        padding: 1.5rem 0 3rem;
    }
    
    .vehicles-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-bar-search {
        min-width: unset;
    }
    
    .filter-controls {
        justify-content: space-between;
    }
    
    .quick-filters-wrapper {
        padding: 0 0 1rem;
    }
    
    .quick-filter-chip {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .cta-banner {
        padding: 3rem 0;
    }
    
    .cta-title {
        font-size: 1.5rem;
    }
    
    .cta-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .vehicle-name {
        font-size: 1rem;
    }
    
    .vehicle-price {
        font-size: 1.25rem;
    }
    
    .vehicle-info {
        padding: 1rem;
    }
}

/* ========================================
   VIEW ALL LINK
   ======================================== */
.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
    transition: gap 0.2s ease;
}

.view-all-link:hover {
    gap: 0.75rem;
}
