/* Car Gallery Common Styles */
/* Uniform image sizing and responsive design */

/* Main gallery images (all_my_cars.html) */
.car-gallery img {
    width: 100%;
    height: 300px; /* Fixed height for consistency */
    object-fit: cover; /* Maintain aspect ratio while filling container */
    object-position: center; /* Center the image within the container */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* Individual car gallery images */
.gallery-item img {
    width: 100%;
    height: 300px; /* Fixed height for consistency */
    object-fit: cover; /* Maintain aspect ratio while filling container */
    object-position: center; /* Center the image within the container */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* Enhanced View Details button */
.car-gallery .button {
    display: none;
    color: white;
    left: 50%;
    top: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 80%;
    height: 60px;
    line-height: 60px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
}

.car-gallery .button:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: white;
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 12px 24px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.6);
}

.car-gallery .img-container:hover .button {
    display: block;
    position: absolute; 
    left: 50%;
    top: 50%;
    width: 80%;
    text-align: center;
    color: white;
    animation: fadeInUp 0.3s ease-out;
}

/* Gallery item hover effects */
.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item:hover img {
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* Responsive design */
@media (max-width: 768px) {
    .car-gallery img,
    .gallery-item img {
        height: 250px; /* Smaller on mobile */
    }
    
    .car-gallery .button {
        height: 50px;
        line-height: 50px;
        font-size: 16px;
        width: 85%;
    }
}

@media (max-width: 480px) {
    .car-gallery img,
    .gallery-item img {
        height: 200px; /* Even smaller on very small screens */
    }
    
    .car-gallery .button {
        height: 45px;
        line-height: 45px;
        font-size: 14px;
        width: 90%;
    }
}

/* Animation keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }
}

/* Page by page view image sizing */
#current-page-img {
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    cursor: pointer;
}

/* Main description image sizing */
.main-description-img,
.car-hero-img {
    width: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Description row: hero image column matches text column height (desktop) */
@media (min-width: 768px) {
    .content-section > .row:has(.card-body.text-center img.img-fluid) {
        align-items: stretch;
    }

    .content-section > .row:has(.card-body.text-center img.img-fluid) > [class*="col-"] {
        display: flex;
    }

    .content-section > .row:has(.card-body.text-center img.img-fluid) > [class*="col-"] > .card {
        flex: 1 1 auto;
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    .content-section > .row:has(.card-body.text-center img.img-fluid) > [class*="col-"] > .card > .card-body:not(.text-center) {
        flex: 1 1 auto;
    }

    .content-section > .row:has(.card-body.text-center img.img-fluid) .card-body.text-center:has(> img.img-fluid) {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
    }

    .content-section > .row:has(.card-body.text-center img.img-fluid) .card-body.text-center:has(> img.img-fluid) > img.img-fluid,
    .content-section > .row:has(.card-body.text-center img.img-fluid) .card-body.text-center:has(> img.car-hero-img),
    .content-section > .row:has(.card-body.text-center img.img-fluid) .card-body.text-center:has(> img.img-fluid) > .car-hero-img,
    .content-section > .row:has(.card-body.text-center img.img-fluid) .main-description-img {
        flex: 1 1 0;
        width: 100%;
        min-height: 0;
        max-height: none !important;
        margin-bottom: 0;
        object-fit: cover;
        object-position: center;
    }

    .content-section > .row:has(.card-body.text-center img.img-fluid) .card-body.text-center:has(> img.img-fluid) > p {
        flex: 0 0 auto;
        margin-top: 0.5rem;
        margin-bottom: 0;
    }
}

@media (max-width: 767.98px) {
    .main-description-img,
    .content-section .card-body.text-center img.img-fluid,
    .content-section .car-hero-img {
        height: 280px;
        max-height: 280px !important;
        object-fit: cover;
    }
}

.gallery-container {
    margin: 2rem 0;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
}

.lightbox-nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox-nav-arrow.show {
    display: flex;
}

.lightbox-nav-arrow.prev {
    left: 20px;
}

.lightbox-nav-arrow.next {
    right: 20px;
}

.zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.zoom-modal.show {
    display: flex;
}

.zoom-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
}

.zoom-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.zoom-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
}

.zoom-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
}

.zoom-nav.prev {
    left: 20px;
}

.zoom-nav.next {
    right: 20px;
}

.zoom-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

