/* Mobile-First Gallery Modal CSS */

.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.gallery-modal.show {
    opacity: 1;
    visibility: visible;
}

.gallery-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.gallery-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* Header */
.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    flex-shrink: 0;
}

.gallery-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    flex: 1;
}

.gallery-counter-header {
    font-size: 14px;
    opacity: 0.8;
    margin: 0 15px;
}

.gallery-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.gallery-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile Swipe Container */
.gallery-swipe-container {
    position: relative;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gallery-slides {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 1;
}

.gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.gallery-slide img,
.gallery-slide video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: auto;
    height: auto;
}

.gallery-slide video {
    outline: none;
}

/* Navigation dots removed - thumbnails provide navigation */

/* Desktop Navigation Arrows - Completely Redesigned */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 80px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.gallery-nav:hover {
    transform: translateY(-50%) scale(1.15);
}

.gallery-nav:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    transform: translateY(-50%) scale(0.9);
}

.gallery-prev {
    left: 25px;
    background: linear-gradient(135deg,
        rgba(194, 156, 96, 0.9) 0%,
        rgba(164, 132, 76, 0.95) 40%,
        rgba(134, 108, 56, 0.9) 100%);
    clip-path: polygon(0 20%, 60% 0, 100% 20%, 100% 80%, 60% 100%, 0 80%);
    border-radius: 0 15px 15px 0;
    box-shadow: -8px 0 25px rgba(0, 0, 0, 0.4), inset 2px 0 8px rgba(255, 255, 255, 0.2);
}

.gallery-prev:hover {
    background: linear-gradient(135deg,
        rgba(220, 180, 110, 0.95) 0%,
        rgba(194, 156, 96, 1) 40%,
        rgba(164, 132, 76, 0.95) 100%);
    transform: translateY(-50%) translateX(-10px) scale(1.15);
    box-shadow: -12px 0 30px rgba(0, 0, 0, 0.5), inset 3px 0 10px rgba(255, 255, 255, 0.3);
}

.gallery-next {
    right: 25px;
    background: linear-gradient(45deg,
        rgba(194, 156, 96, 0.9) 0%,
        rgba(164, 132, 76, 0.95) 40%,
        rgba(134, 108, 56, 0.9) 100%);
    clip-path: polygon(0 20%, 40% 0, 100% 20%, 100% 80%, 40% 100%, 0 80%);
    border-radius: 15px 0 0 15px;
    box-shadow: 8px 0 25px rgba(0, 0, 0, 0.4), inset -2px 0 8px rgba(255, 255, 255, 0.2);
}

.gallery-next:hover {
    background: linear-gradient(45deg,
        rgba(220, 180, 110, 0.95) 0%,
        rgba(194, 156, 96, 1) 40%,
        rgba(164, 132, 76, 0.95) 100%);
    transform: translateY(-50%) translateX(10px) scale(1.15);
    box-shadow: 12px 0 30px rgba(0, 0, 0, 0.5), inset -3px 0 10px rgba(255, 255, 255, 0.3);
}

/* Mobile Thumbnails */
.gallery-thumbnails {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 0;
    flex-shrink: 0;
}

.gallery-thumb-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-thumb-scroll::-webkit-scrollbar {
    display: none;
}

.gallery-thumb-grid {
    display: flex;
    gap: 10px;
    min-width: min-content;
}

.gallery-thumb {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.gallery-thumb.active {
    border-color: #c29c60;
    transform: scale(1.05);
}

.gallery-thumb img,
.gallery-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Force thumbnail videos to never autoplay */
.gallery-thumb video {
    pointer-events: none; /* Prevent interaction */
}

.gallery-thumb video::-webkit-media-controls {
    display: none !important;
}

.gallery-thumb video::-webkit-media-controls-enclosure {
    display: none !important;
}

.gallery-thumb .video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Hide desktop elements on mobile */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .gallery-header h3 {
        font-size: 14px;
    }

    .gallery-counter-header {
        font-size: 12px;
    }

    .gallery-close {
        width: 44px;
        height: 44px;
        font-size: 20px;
        min-width: 44px; /* Minimum touch target */
        min-height: 44px;
    }

    .gallery-thumb {
        width: 50px;
        height: 50px;
    }

    .gallery-thumb .video-icon {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
}

/* Desktop optimizations */
@media (min-width: 769px) {

    .gallery-thumbnails {
        max-height: 120px;
    }

    .gallery-thumb {
        width: 80px;
        height: 80px;
    }

    .gallery-thumb:hover {
        transform: scale(1.05);
        border-color: rgba(194, 156, 96, 0.5);
    }

    /* Enable hover effects */
    .gallery-nav:hover {
        background: rgba(0, 0, 0, 0.8);
    }
}

/* Performance optimizations */
.gallery-slide img {
    image-rendering: optimizeQuality;
}

.gallery-slide video {
    will-change: transform;
}

/* Loading states */
.gallery-slide img:not([src]) {
    background: rgba(255, 255, 255, 0.1);
}

.gallery-slide.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Accessibility improvements */
.gallery-modal:focus-within .gallery-nav,
.gallery-modal:focus-within .gallery-close {
    outline: 2px solid #c29c60;
    outline-offset: 2px;
}

/* Smooth scrolling for thumbnails */
.gallery-thumb-scroll {
    scroll-behavior: smooth;
}

/* Prevent text selection while swiping */
.gallery-swipe-container {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}