/* --- 1. CORE PAGE LAYOUT --- */
.listing-page {
    background: #0a0a0a;
    padding-top: 80px; /* Space for fixed nav */
    color: #fff;
}

.internal-nav {
    position: fixed;
    top: 0; 
    width: 100%;
    background: #121212;
    padding: 20px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.listings-container {
    display: flex;
    gap: 40px;
    padding: 40px 5%;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
}

/* --- 2. SIDEBAR STYLING (Fixed Desktop) --- */
.filter-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #121212;
    padding: 25px;
    border-radius: 20px;
    height: fit-content;
    position: sticky;
    top: 100px;
    border: 1px solid rgba(255,255,255,0.05);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

#resetFilters {
    background: transparent;
    border: 1px solid #444;
    color: #eee;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.filter-group input, 
.filter-group select {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 12px;
    color: white;
    border-radius: 8px;
    outline: none;
    transition: 0.3s;
}

.filter-group input:focus {
    border-color: var(--accent);
}

/* --- 3. RESULTS & GRID AREA --- */
.results-area {
    flex-grow: 1;
}

.results-info h2 {
    margin-bottom: 30px;
    font-size: 1.8rem;
    font-weight: 900;
}

.car-grid-main {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* --- 4. CAR CARD STYLING --- */
.car-card {
    background: #1a1a1a;
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
    border: 1px solid rgba(255,255,255,0.05);
}

.car-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.car-img-wrap {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.car-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-tag {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}

.car-info h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.car-price {
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
}

.view-detail-btn {
    width: 100%;
    background: var(--accent);
    color: #000;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

/* --- 5. MOBILE RESPONSIVENESS & TOGGLE --- */
.mobile-filter-trigger {
    display: none; /* Hidden on Desktop */
    width: 100%;
    background: var(--accent);
    color: #000;
    padding: 15px;
    border-radius: 10px;
    font-weight: 800;
    border: none;
    margin-bottom: 20px;
}

@media (max-width: 992px) {
    .listings-container {
        flex-direction: column;
        padding-top: 20px;
    }

    .mobile-filter-trigger {
        display: block; /* Shown on Mobile */
    }

    .filter-sidebar {
        display: none; /* Hidden by default */
        width: 100%;
        position: relative;
        top: 0;
        z-index: 10;
    }

    /* JavaScript toggles this class */
    .filter-sidebar.show-mobile {
        display: block !important;
        margin-bottom: 30px;
        animation: slideIn 0.3s ease-out;
    }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 6. MODAL STYLING --- */
.detail-modal {
    display: none; 
    position: fixed;
    z-index: 9999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
}

.detail-modal.active { display: flex; }

.modal-content {
    background: #121212;
    width: 95%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 20px;
    padding: 30px;
    position: relative;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    z-index: 10;
}

.wa-contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #25D366;
    color: #000 !important;
    padding: 15px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 800;
    margin-top: 20px;
}
/* Container for the Back Link */
.back-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05); /* Subtle background box */
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

/* Icon styling inside the link */
.back-link i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

/* Hover Effects */
.back-link:hover {
    background: var(--accent); /* Changes to your neon green/gold accent */
    color: #000000;
    border-color: var(--accent);
}

/* Moves the arrow slightly to the left on hover for a "pull" effect */
.back-link:hover i {
    transform: translateX(-4px);
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .back-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    /* Optional: Hide text on very small screens to save space */
    /* .back-link span { display: none; } */
}
/* Ensure the modal is hidden by default */
.detail-modal {
    display: none; 
    position: fixed;
    inset: 0; /* Shorthand for top, bottom, left, right: 0 */
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

/* This is the class the JS adds to make it pop up */
.detail-modal.active {
    display: flex !important;
}
/* Ensure the image container is visible */
#modalImage {
    width: 100%;
    height: 400px; /* Adjust height as needed */
    background-size: cover;
    background-position: center;
    border-radius: 15px;
    background-repeat: no-repeat;
    background-color: #222; /* Fallback color */
}

/* Fix the "Messy" Layout using a Grid */
.modal-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr; /* Image/Desc on left, Specs on right */
    gap: 30px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .modal-grid {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
    #modalImage {
        height: 250px;
    }
}

/* Bullet proofing the spec list */
.spec-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.spec-list li span {
    color: var(--accent); /* Your neon green/gold */
    font-weight: 700;
}