/* Base Container Display Rules - Show desktop by default, mobile on smaller screens */
.mobile-container {
    display: none;
}

.desktop-container {
    display: block;
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    box-sizing: border-box;
}

#mobileRequestPriceModal {
    display: none !important;
}

/* Fallback - ensure at least one container is visible if CSS fails to load properly */
@media screen and (max-width: 1023px) {
    .desktop-container {
        display: none !important;
    }
}

/* Additional safety rule to ensure content is visible */
body .container,
body .mobile-container,
body .desktop-container {
    min-height: 1px; /* Ensure containers have some height */
}

/* Force override any conflicting styles from other CSS files */
@media screen and (min-width: 1024px) {
    body .mobile-container,
    body .mobile-vehicle-container {
        display: none !important;
    }
    
    body .desktop-container,
    body .desktop-vehicle-container {
        display: block !important;
    }
}

@media screen and (max-width: 1023px) {
    body .desktop-container,
    body .desktop-vehicle-container {
        display: none !important;
    }
    
    body .mobile-container,
    body .mobile-vehicle-container {
        display: block !important;
    }
}

/* Mobile and Tablet Styles */
@media screen and (max-width: 1023px) {
    .mobile-container {
        display: block !important;
    }

    .desktop-container {
        display: none !important;
    }

    #mobileRequestPriceModal.show {
        display: block !important;
    }
}

/* Desktop Styles */
@media screen and (min-width: 1024px) {
    .mobile-container {
        display: none !important;
    }

    .desktop-container {
        display: block !important;
        width: 90%;
        max-width: 1400px;
        margin: 0 auto;
        box-sizing: border-box;
    }

    #mobileRequestPriceModal,
    #mobileRequestPriceModal.show {
        display: none !important;
    }
}

/* Larger screens */
@media screen and (min-width: 1600px) {
    .desktop-container {
        width: 80%;
    }
}

/* Extra large screens */
@media screen and (min-width: 1920px) {
    .desktop-container {
        width: 70%;
    }
}

/* Remove previous image styles and use these instead */
.vehicle-images {
    display: flex;
    gap: 5px;
    flex: 1 1 65%;
    min-width: 0;
    position: relative;
}

.main-image {
    width: calc(100% - 160px);
    height: 0;
    padding-bottom: 65%;
    position: relative;
    overflow: hidden;
    background-color: white;
}

.thumbnail-images {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 155px;
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    overflow-y: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.thumbnail-images::-webkit-scrollbar {
    display: none;
}

.thumbnail-container {
    width: 100%;
    height: 100px;
    position: relative;
    overflow: hidden;
    background-color: white;
    flex: 0 0 auto;
    margin-bottom: 2px;
    cursor: pointer;
}

.thumbnail-images img, 
.main-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Add styles for admin notice */
.admin-notice {
    background-color: #fff3cd;
    color: #856404;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0;
    text-align: center;
    font-weight: 500;
}

/* Override container width to match original */
.vehicle-container {
    width: 100%;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
}

.vehicle-container.desktop-vehicle-container {
    width: 100%;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
}

/* Ensure vehicle-content has correct layout */
.vehicle-content {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    justify-content: space-between;
    align-items: flex-start;
    min-width: 0;
}

/* Right side actions width */
.vehicle-actions {
    flex: 0 1 35%;
    min-width: 250px;
    max-width: 35%;
}

/* Updated button styles */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.chat-live, 
.test-drive, 
.apply-for-finance {
    padding: 15px;
    font-size: 15px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0;
}

.chat-live {
    background-color: #000;
    color: white;
    border: 1px solid #000;
}

.test-drive {
    background-color: #000;
    color: white;
    border: 1px solid #000;
}

.apply-for-finance {
    background-color: #000;
    color: white;
    border: 1px solid #000;
}

.chat-live:hover, 
.test-drive:hover, 
.apply-for-finance:hover {
    background-color: #333;
    border-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.request-price-large {
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2);
}

.request-price-large:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.3);
}

/* Price section styles */
.price-section {
    text-align: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 0;
    margin-bottom: 15px;
}

.price-section h2 {
    font-size: 32px;
    color: #333;
    margin: 0 0 15px 0;
    font-weight: 700;
}

.details-card {
    background-color: white;
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 20px 0;
    padding: 20px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0;
    text-align: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 0;
}

.basic-info {
    flex: 1 1 65%;
    min-width: 0;
    background-color: white;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 0;
}

.basic-info h2 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 18px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.info-item .label {
    color: #666;
    font-weight: 500;
}

.info-item .value {
    color: #333;
    font-weight: 600;
}

/* Mobile adjustments for basic info */
@media (max-width: 1023px) {
    .basic-info .info-grid {
        grid-template-columns: 1fr;
    }

    .info-item {
        padding: 10px 0;
    }
}

.fuel-economy {
    flex: 0 1 35%;
    min-width: 250px;
    max-width: 35%;
    margin: 0;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    border-radius: 0;
}

.fuel-economy-display {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 0;
}

.fuel-economy h2 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 18px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.fuel-economy-display {
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 0;
}

.fuel-score {
    flex: 0 0 auto;
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.score {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.score-label {
    font-size: 12px;
    margin-top: 5px;
}

.fuel-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fuel-stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.fuel-stat:last-child {
    border-bottom: none;
}

.fuel-stat .label {
    color: #666;
    font-weight: 500;
}

.fuel-stat .value {
    color: #333;
    font-weight: 600;
}

/* Info section wrapper */
.info-section-wrapper {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    align-items: stretch;
    min-width: 0;
}

/* Add media query for responsive layout */
@media (max-width: 1024px) {
    .vehicle-content,
    .info-section-wrapper {
        flex-direction: column;
    }

    .vehicle-images,
    .vehicle-actions,
    .basic-info,
    .fuel-economy {
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
    }

    .vehicle-actions,
    .fuel-economy {
        min-width: 100%;
    }
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease;
}

.lightbox.show {
    background-color: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    margin: auto;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s ease;
}

.lightbox.show .lightbox-content {
    opacity: 1;
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.lightbox-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
}

.lightbox-prev,
.lightbox-next {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    padding: 10px 20px;
    margin: 0 10px;
    cursor: pointer;
    font-size: 18px;
}

.lightbox-counter {
    color: white;
    margin: 0 15px;
    font-size: 16px;
}

.main-image {
    cursor: pointer;  /* Indicate clickable */
}

.thumbnail-container {
    cursor: pointer;  /* Indicate clickable */
}

/* Add to your existing styles */
.thumbnail-container.active {
    border: 2px solid #007bff;
}

.thumbnail-container {
    transition: border-color 0.2s ease;
}

.thumbnail-container:hover {
    border-color: #0056b3;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .thumbnail-container {
        height: 80px;
    }

    .lightbox-controls {
        bottom: 50px;
    }
}

/* Add these styles for both desktop and mobile thumbnails */
.thumbnail-container {
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.thumbnail-container:hover {
    border-color: #0056b3;
}

.thumbnail-container.active {
    border-color: #007bff;
}

/* Mobile specific styles */
.mobile-vehicle-container .thumbnail-container {
    width: 80px;
    height: 60px;
    margin-right: 5px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.mobile-vehicle-container .thumbnail-images {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px 0;
    -webkit-overflow-scrolling: touch;
    gap: 5px;
    margin-top: 10px;
    width: 100%;
}

.mobile-vehicle-container .thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hide scrollbar but keep functionality */
.mobile-vehicle-container .thumbnail-images::-webkit-scrollbar {
    display: none;
}

.mobile-vehicle-container .thumbnail-images {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Ensure mobile main image maintains aspect ratio */
.mobile-vehicle-container .main-image {
    width: 100%;
    position: relative;
    padding-bottom: 75%; /* 4:3 Aspect ratio */
    overflow: hidden;
    touch-action: auto; /* Allow all touch actions */
    -webkit-user-select: none;
    user-select: none;
}

.mobile-vehicle-container .main-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    touch-action: auto; /* Allow all touch actions */
    pointer-events: none; /* Prevent image from capturing touch events */
}

/* Header Styles - Desktop (Original) */
.vehicle-header {
    margin-bottom: 20px;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-button {
    background: #000;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: #333;
    transform: translateY(-2px);
}

.back-button i {
    font-size: 16px;
}

.vehicle-header h1 {
    margin: 0;
}

.vehicle-id {
    margin-top: 10px;
}

/* Mobile Header Adjustments */
@media (max-width: 768px) {
    .vehicle-header {
        margin: 10px 0 0;
        padding: 0 15px;
        width: 100%;
    }

    .header-top {
        gap: 15px;
        margin-bottom: 12px;
        width: 100%;
    }

    .vehicle-header h1 {
        font-size: 22px;
        line-height: 1.3;
        font-weight: 600;
        color: #333;
        flex: 1;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .vehicle-id {
        display: flex;
        justify-content: space-between;
        margin: 12px 0 0;
        padding: 12px 15px;
        background: #f8f9fa;
        width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        box-sizing: border-box;
    }

    .vehicle-id span {
        flex: 1;
        text-align: center;
        font-size: 14px;
        color: #666;
        font-weight: 500;
        padding: 8px 12px;
        background: white;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        margin: 0 5px;
    }
}

/* Even smaller screens */
@media (max-width: 480px) {
    .vehicle-header {
        padding: 0 12px;
    }

    .vehicle-header h1 {
        font-size: 20px;
    }

    .vehicle-id {
        padding: 10px 12px;
    }

    .vehicle-id span {
        font-size: 13px;
        padding: 8px 10px;
    }
}

/* Update mobile thumbnail container styles */
.mobile-thumbnails {
    display: flex;
    overflow-x: auto;
    gap: 2px;
    padding: 0;
    width: 100%;
    height: 80px;
    background: #f5f5f5;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
    position: relative;
}

.mobile-thumbnail {
    flex: 0 0 calc(25% - 1.5px);
    width: calc(25% - 1.5px);
    height: 80px;
    position: relative;
    background: white;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.mobile-thumbnail img.thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Ensure the container allows scrolling */
.mobile-vehicle-container {
    touch-action: auto !important;
}

/* Add this new style */
.mobile-image-section {
    width: 100%;
    position: relative;
    touch-action: auto !important;
    z-index: 1;
}

/* Update mobile main image styles */
@media (max-width: 1023px) {
    .mobile-vehicle-container .main-image {
        cursor: default; /* Remove pointer cursor on mobile */
    }
    
    .mobile-vehicle-container .main-image img {
        pointer-events: auto !important;
        touch-action: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* Keep lightbox cursor only for desktop */
@media (min-width: 1024px) {
    .main-image {
        cursor: pointer;
    }
}

/* Replace the mobile main image styles with these */
.mobile-main-image-wrapper {
    width: 100%;
    position: relative;
    padding-bottom: 75%; /* 4:3 Aspect ratio */
    background: #f8f9fa;
    touch-action: auto !important;
}

.mobile-main-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none !important;
    user-select: none;
    -webkit-user-select: none;
}

/* Update container styles */
.mobile-image-section {
    width: 100%;
    position: relative;
    touch-action: auto !important;
    z-index: 1;
}

.mobile-vehicle-container {
    touch-action: auto !important;
}

/* Remove any pointer events from lightbox on mobile */
@media (max-width: 1023px) {
    #imageLightbox {
        display: none !important;
    }
    
    .mobile-main-image-wrapper,
    .mobile-image-section,
    .mobile-vehicle-container {
        pointer-events: auto !important;
        touch-action: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile Details Card and Features Styles */
.mobile-details-card {
    background-color: white;
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 15px 0;
    padding: 20px;
    width: 100%;
}

.mobile-details-card h2 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 18px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.mobile-details-card .vehicle-description {
    white-space: pre-line;
    line-height: 1.6;
    color: #333;
    font-size: 14px;
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none;
}

.mobile-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 0;
    margin-top: 15px;
}

.mobile-feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0;
    text-align: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.mobile-feature-item i {
    font-size: 20px;
    color: #333;
}

.mobile-feature-item span {
    font-size: 14px;
    color: #666;
    line-height: 1.3;
}

/* Mobile contact buttons */
.mobile-contact-buttons {
    display: none;
}

@media screen and (max-width: 1023px) {
    .mobile-contact-buttons {
        display: flex;
        gap: 10px;
        width: 100%;
        margin-bottom: 10px;
    }

    .call-us,
    .text-us {
        flex: 1;
        padding: 15px;
        text-align: center;
        text-decoration: none;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        transition: all 0.3s ease;
        border-radius: 0;
    }

    .call-us {
        background-color: #28a745;
        color: white;
        border: 1px solid #28a745;
    }

    .text-us {
        background-color: #17a2b8;
        color: white;
        border: 1px solid #17a2b8;
    }

    .call-us:hover,
    .text-us:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }

    .call-us:hover {
        background-color: #218838;
        border-color: #218838;
    }

    .text-us:hover {
        background-color: #138496;
        border-color: #138496;
    }
}

@media screen and (min-width: 1024px) {
    .mobile-contact-buttons {
        display: none !important;
    }
}