/* ========================================
   Gallery & Slideshow Styles
   Mobile-Optimized Photo Display
   ======================================== */

/* ========================================
   Gallery Container
   ======================================== */

.gallery-wrapper {
    width: 100%;
    padding: var(--spacing-md) 0;
}

.gallery-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.gallery-title {
    background: linear-gradient(135deg, var(--pastel-pink), var(--pastel-lavender));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-sm);
}

.gallery-subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* ========================================
   Gallery Controls
   ======================================== */

.gallery-controls {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.control-btn {
    background-color: var(--white);
    border: 2px solid var(--pastel-lavender);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-fast);
    color: var(--text-dark);
}

.control-btn:hover {
    background: linear-gradient(135deg, var(--pastel-pink), var(--pastel-lavender));
    border-color: transparent;
    transform: translateY(-2px);
}

.control-btn.active {
    background: linear-gradient(135deg, var(--pastel-pink), var(--pastel-lavender));
    border-color: transparent;
}

/* ========================================
   Responsive Grid Gallery
   ======================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
    padding: var(--spacing-md);
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    background-color: var(--white);
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.gallery-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-slow);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    color: var(--white);
    padding: var(--spacing-sm);
    transform: translateY(100%);
    transition: transform var(--transition-normal);
}

.gallery-item:hover .gallery-item-overlay {
    transform: translateY(0);
}

/* ========================================
   Slideshow/Diaporama Mode
   ======================================== */

.slideshow-container {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.slideshow-slide {
    display: none;
    position: relative;
    animation: fadeIn var(--transition-slow);
}

.slideshow-slide.active {
    display: block;
}

.slideshow-slide img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    background-color: var(--pastel-sand);
}

/* Slideshow Navigation Arrows */
.slideshow-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    color: var(--text-dark);
    font-size: 2rem;
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    z-index: 10;
}

.slideshow-nav:hover {
    background-color: rgba(255, 255, 255, 0.95);
    transform: translateY(-50%) scale(1.1);
}

.slideshow-nav.prev {
    left: var(--spacing-sm);
}

.slideshow-nav.next {
    right: var(--spacing-sm);
}

/* Slideshow Counter */
.slideshow-counter {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: linear-gradient(135deg, var(--pastel-pink), var(--pastel-lavender));
    color: var(--text-dark);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* Slideshow Caption */
.slideshow-caption {
    background: linear-gradient(135deg, var(--pastel-blue), var(--pastel-aqua));
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-dark);
}

/* Slideshow Thumbnails */
.slideshow-thumbnails {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    overflow-x: auto;
    background-color: var(--pastel-sand);
    scrollbar-width: thin;
    scrollbar-color: var(--pastel-pink) var(--pastel-sand);
}

.slideshow-thumbnails::-webkit-scrollbar {
    height: 8px;
}

.slideshow-thumbnails::-webkit-scrollbar-track {
    background: var(--pastel-sand);
}

.slideshow-thumbnails::-webkit-scrollbar-thumb {
    background: var(--pastel-pink);
    border-radius: var(--radius-sm);
}

.thumbnail {
    min-width: 80px;
    height: 60px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    opacity: 0.6;
}

.thumbnail:hover,
.thumbnail.active {
    opacity: 1;
    border-color: var(--pastel-pink);
    transform: scale(1.05);
}

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

/* ========================================
   Auto-play Controls
   ======================================== */

.autoplay-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--white);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

.play-pause-btn {
    background: linear-gradient(135deg, var(--pastel-mint), var(--pastel-aqua));
    border: none;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
    color: var(--text-dark);
}

.play-pause-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* ========================================
   Mobile Optimizations
   ======================================== */

/* Touch-friendly hit areas */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }

    .gallery-item img {
        height: 200px;
    }

    .slideshow-nav {
        font-size: 1.5rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .slideshow-nav.prev {
        left: var(--spacing-xs);
    }

    .slideshow-nav.next {
        right: var(--spacing-xs);
    }

    .slideshow-counter {
        top: var(--spacing-xs);
        right: var(--spacing-xs);
        font-size: 0.9rem;
    }

    .slideshow-caption {
        padding: var(--spacing-sm);
        font-size: 0.9rem;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .gallery-item img {
        height: 250px;
    }

    .control-btn {
        font-size: 0.9rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .slideshow-slide img {
        max-height: 50vh;
    }

    .thumbnail {
        min-width: 60px;
        height: 45px;
    }
}

/* ========================================
   Swipe Gestures (Touch Support)
   ======================================== */

.slideshow-container {
    touch-action: pan-y pinch-zoom;
}

/* Visual feedback for touch */
@media (hover: none) and (pointer: coarse) {
    .gallery-item:active {
        transform: scale(0.98);
    }

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

    .thumbnail:active {
        transform: scale(0.95);
    }
}

/* ========================================
   Loading States
   ======================================== */

.gallery-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--pastel-sand);
    border-top-color: var(--pastel-pink);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Hidden State
   ======================================== */

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* ========================================
   Lightbox/Modal (Optional Enhancement)
   ======================================== */

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    padding: var(--spacing-md);
}

.lightbox.active {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn var(--transition-normal);
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.lightbox-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background-color: var(--white);
    border: none;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lightbox-close:hover {
    transform: rotate(90deg);
    background-color: var(--pastel-coral);
}
