/* SDAS Vehicle Gallery - Layout + Lightbox Styles */

/* Layout & Thumbnails */
.sdas-vehicle-gallery {
    display: flex;
    flex-direction: column;
    gap: var(--gap, 10px);
    max-width: 100%;
}

.sdas-vehicle-gallery__main {
    width: 100%;
    margin-bottom: 20px;
}

.sdas-vehicle-gallery__main-image-container {
    position: relative;
    width: 100%;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    touch-action: pan-y pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.sdas-vehicle-gallery__main-link {
    display: block;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.sdas-vehicle-gallery__main-link:hover {
    transform: scale(1.02);
}

.sdas-vehicle-gallery__main-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: cover;
    border-radius: 8px;
}

.sdas-vehicle-gallery__counter {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

.sdas-vehicle-gallery__lightbox-hint {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sdas-vehicle-gallery__main-link:hover .sdas-vehicle-gallery__lightbox-hint {
    opacity: 1;
}

.sdas-vehicle-gallery__lightbox-hint svg {
    width: 16px;
    height: 16px;
}

.sdas-vehicle-gallery__thumbnails {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sdas-vehicle-gallery__thumbnails-container {
    flex: 1;
    overflow: hidden;
    border-radius: 6px;
}

.sdas-vehicle-gallery__thumbnails-track {
    display: flex;
    gap: 8px;
    transition: transform 0.3s ease;
    will-change: transform;
}

.sdas-vehicle-gallery__thumbnail-wrapper {
    flex-shrink: 0;
    width: calc((100% - (var(--thumbnails-per-view, 4) - 1) * 8px) / var(--thumbnails-per-view, 4));
    aspect-ratio: 1;
}

.sdas-vehicle-gallery__thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.sdas-vehicle-gallery__thumbnail:hover {
    opacity: 1;
    border-color: #007cba;
    transform: scale(1.05);
}

.sdas-vehicle-gallery__thumbnail--active {
    opacity: 1;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.3);
}

.sdas-vehicle-gallery__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #007cba;
    border: 2px solid #007cba;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.4);
    color: #fff;
    z-index: 10;
}

.sdas-vehicle-gallery__nav:hover {
    background: #005a8a;
    border-color: #005a8a;
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 124, 186, 0.5);
}

.sdas-vehicle-gallery__nav:active {
    transform: scale(0.95);
}

.sdas-vehicle-gallery__nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    background: #ccc;
    border-color: #ccc;
}

.sdas-vehicle-gallery__nav svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
}

.sdas-no-photos {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    font-size: 16px;
}

.sdas-vehicle-gallery__main-image-container:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

@media (max-width: 768px) {
    .sdas-vehicle-gallery__main-image-container::before {
        content: '← Swipe to navigate →';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.7);
        color: #fff;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 500;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
        z-index: 10;
    }

    .sdas-vehicle-gallery__main-image-container:hover::before {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .sdas-vehicle-gallery__main-image {
        max-height: 400px;
    }

    .sdas-vehicle-gallery__counter {
        top: 10px;
        right: 10px;
        padding: 4px 8px;
        font-size: 12px;
    }

    .sdas-vehicle-gallery__lightbox-hint {
        bottom: 10px;
        left: 10px;
        padding: 6px 10px;
        font-size: 11px;
    }

    .sdas-vehicle-gallery__nav {
        width: 44px;
        height: 44px;
    }

    .sdas-vehicle-gallery__nav svg {
        width: 22px;
        height: 22px;
    }

    .sdas-vehicle-gallery__thumbnail-wrapper {
        width: calc((100% - (3 - 1) * 8px) / 3);
    }
}

@media (max-width: 480px) {
    .sdas-vehicle-gallery__main-image {
        max-height: 300px;
    }

    .sdas-vehicle-gallery__thumbnail-wrapper {
        width: calc((100% - (2 - 1) * 8px) / 2);
    }

    .sdas-vehicle-gallery__lightbox-hint {
        display: none;
    }
}

/* Lightbox Styles */

/* Lightbox Overlay */
.sdas-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: pointer;
}

.sdas-lightbox-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Container */
.sdas-lightbox-container {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

/* Lightbox Image */
.sdas-lightbox-image {
    max-width: 100%;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Lightbox Navigation Buttons */
.sdas-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000000;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sdas-lightbox-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.sdas-lightbox-nav:active {
    transform: translateY(-50%) scale(0.95);
}

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

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

.sdas-lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sdas-lightbox-nav svg {
    width: 24px;
    height: 24px;
    color: #333;
}

/* Lightbox Close Button */
.sdas-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000000;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-size: 28px;
    line-height: 1;
    color: #333;
    padding: 0;
}

.sdas-lightbox-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.sdas-lightbox-close:active {
    transform: scale(0.95);
}

/* Lightbox Counter */
.sdas-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(4px);
    z-index: 1000000;
}

/* Prevent body scroll when lightbox is open */
body.sdas-lightbox-open {
    overflow: hidden;
}

/* Thumbnail link styles */
.sdas-vehicle-gallery__thumbnail-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: transparent;
    outline: none;
}

.sdas-vehicle-gallery__thumbnail-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sdas-lightbox-nav {
        width: 40px;
        height: 40px;
    }
    
    .sdas-lightbox-nav svg {
        width: 20px;
        height: 20px;
    }
    
    .sdas-lightbox-nav--prev {
        left: 10px;
    }
    
    .sdas-lightbox-nav--next {
        right: 10px;
    }
    
    .sdas-lightbox-close {
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
        font-size: 24px;
    }
    
    .sdas-lightbox-counter {
        bottom: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }
}
