﻿/* ========================================
   ENHANCED GALLERY STYLES
   ======================================== */

:root {
    --gallery-primary: #4B2E7F;
    --gallery-secondary: #6A4C93;
    --gallery-accent: #FF6B6B;
    --gallery-success: #2ECC71;
    --gallery-dark: #2C3E50;
    --gallery-light: #ECF0F1;
    --gallery-white: #FFFFFF;
    --gallery-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --gallery-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.15);
    --gallery-border-radius: 12px;
    --gallery-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Gallery Container */
.gallery-container {
    background: var(--gallery-white);
    border-radius: var(--gallery-border-radius);
    padding: 2rem;
    box-shadow: var(--gallery-shadow);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

    .gallery-container::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, var(--gallery-primary) 0%, var(--gallery-secondary) 50%, var(--gallery-accent) 100%);
    }

/* Enhanced Gallery Layout */
.enhanced-gallery {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Main Image Display Area */
.image-column {
    position: relative;
    width: 100%;
    height: 500px;
    border-radius: var(--gallery-border-radius);
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--gallery-shadow);
}

    .image-column img,
    .image-column video,
    .image-column iframe {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        border-radius: 8px;
        transition: var(--gallery-transition);
    }

    .image-column:hover img {
        transform: scale(1.02);
    }

/* Media Controls Overlay */
.media-controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    opacity: 0;
    transition: var(--gallery-transition);
    pointer-events: none;
}

.image-column:hover .media-controls-overlay {
    opacity: 1;
}

.gallery-nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: var(--gallery-dark);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--gallery-transition);
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

    .gallery-nav-btn:hover {
        background: var(--gallery-primary);
        color: white;
        transform: scale(1.1);
    }

    .gallery-nav-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
    }

/* Media Info Display */
.media-info-display {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    transition: var(--gallery-transition);
}

/* Fullscreen Toggle */
.fullscreen-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--gallery-transition);
    opacity: 0;
}

.image-column:hover .fullscreen-toggle {
    opacity: 1;
}

.fullscreen-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Enhanced Thumbnails Section */
.thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gallery-primary) var(--gallery-light);
}

    .thumbnails::-webkit-scrollbar {
        height: 6px;
        width: 6px;
    }

    .thumbnails::-webkit-scrollbar-track {
        background: var(--gallery-light);
        border-radius: 3px;
    }

    .thumbnails::-webkit-scrollbar-thumb {
        background: var(--gallery-primary);
        border-radius: 3px;
    }

        .thumbnails::-webkit-scrollbar-thumb:hover {
            background: var(--gallery-secondary);
        }

/* Individual Thumbnail Styling */
.thumbnail {
    position: relative;
    width: 100%;
    height: 80px;
    border-radius: var(--gallery-border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--gallery-transition);
    border: 3px solid transparent;
    background: var(--gallery-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: var(--gallery-transition);
    }

    .thumbnail:hover {
        transform: translateY(-5px) scale(1.05);
        box-shadow: var(--gallery-shadow-hover);
        border-color: var(--gallery-secondary);
    }

    .thumbnail.active {
        border-color: var(--gallery-primary);
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(75, 46, 127, 0.3);
    }

        .thumbnail.active::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 20px;
            height: 20px;
            background: var(--gallery-primary);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .thumbnail.active::before {
            content: '✓';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-size: 12px;
            font-weight: bold;
            z-index: 2;
        }

/* Media Type Indicators */
.thumbnail-media-type {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.thumbnail.instagram-thumbnail .thumbnail-media-type {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.thumbnail.youtube-thumbnail .thumbnail-media-type {
    background: #FF0000;
}

.thumbnail.video-thumbnail .thumbnail-media-type {
    background: var(--gallery-primary);
}

.thumbnail-media-type i {
    font-size: 10px;
}

/* Loading States */
.thumbnail.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Play Button Overlay for Videos */
.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    transition: var(--gallery-transition);
    opacity: 0;
}

.thumbnail:hover .video-play-overlay {
    opacity: 1;
}

/* Instagram Embed Styling */
.instagram-embed-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gallery-light);
}

    .instagram-embed-container iframe {
        max-width: 100%;
        max-height: 100%;
        border: none;
        border-radius: 8px;
    }

/* YouTube Embed Styling */
.youtube-embed-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
}

    .youtube-embed-container iframe {
        width: 100%;
        height: 100%;
        border: none;
    }

/* Gallery Controls */
.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--gallery-light);
    margin-top: 1rem;
}

.gallery-counter {
    background: var(--gallery-primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gallery-actions {
    display: flex;
    gap: 0.5rem;
}

.gallery-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--gallery-light);
    background: white;
    color: var(--gallery-dark);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--gallery-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .gallery-action-btn:hover {
        background: var(--gallery-primary);
        color: white;
        border-color: var(--gallery-primary);
        transform: translateY(-2px);
    }

/* Zoom Modal */
.gallery-zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

    .gallery-zoom-modal.active {
        display: flex;
    }

.zoom-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .zoom-content img,
    .zoom-content video,
    .zoom-content iframe {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        border-radius: 8px;
    }

.zoom-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: var(--gallery-dark);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--gallery-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .zoom-close:hover {
        background: white;
        transform: scale(1.1);
    }

.zoom-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: var(--gallery-dark);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--gallery-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .zoom-nav:hover {
        background: white;
        transform: translateY(-50%) scale(1.1);
    }

    .zoom-nav.prev {
        left: 2rem;
    }

    .zoom-nav.next {
        right: 2rem;
    }

    .zoom-nav:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: translateY(-50%);
    }

/* Gallery Grid View (Alternative Layout) */
.gallery-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.gallery-grid-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--gallery-border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--gallery-transition);
    background: var(--gallery-light);
}

    .gallery-grid-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: var(--gallery-transition);
    }

    .gallery-grid-item:hover {
        transform: scale(1.05);
        box-shadow: var(--gallery-shadow-hover);
        z-index: 2;
    }

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

/* Error States */
.gallery-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--gallery-dark);
    text-align: center;
}

    .gallery-error i {
        font-size: 3rem;
        color: var(--gallery-accent);
        margin-bottom: 1rem;
    }

    .gallery-error h4 {
        margin-bottom: 0.5rem;
        color: var(--gallery-dark);
    }

    .gallery-error p {
        color: var(--gallery-light);
        margin-bottom: 1.5rem;
    }

.gallery-retry-btn {
    background: var(--gallery-primary);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--gallery-transition);
}

    .gallery-retry-btn:hover {
        background: var(--gallery-secondary);
        transform: translateY(-2px);
    }

/* Empty State */
.gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--gallery-dark);
    text-align: center;
    background: var(--gallery-light);
    border-radius: var(--gallery-border-radius);
    border: 2px dashed #ddd;
}

    .gallery-empty i {
        font-size: 4rem;
        color: #ddd;
        margin-bottom: 1rem;
    }

    .gallery-empty h4 {
        margin-bottom: 0.5rem;
        color: var(--gallery-dark);
    }

    .gallery-empty p {
        color: #999;
        margin: 0;
    }

/* Responsive Design */
@media (max-width: 1200px) {
    .thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .thumbnail {
        height: 70px;
    }
}

@media (max-width: 992px) {
    .gallery-container {
        padding: 1.5rem;
    }

    .image-column {
        height: 400px;
    }

    .thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        max-height: 150px;
    }

    .thumbnail {
        height: 60px;
    }

    .gallery-grid-view {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .gallery-container {
        padding: 1rem;
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
    }

    .image-column {
        height: 300px;
    }

    .thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
        max-height: 120px;
    }

    .thumbnail {
        height: 50px;
    }

    .gallery-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .media-controls-overlay {
        padding: 0 1rem;
    }

    .gallery-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .gallery-actions {
        justify-content: center;
    }

    .zoom-close,
    .zoom-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .zoom-close {
        top: 1rem;
        right: 1rem;
    }

    .zoom-nav.prev {
        left: 1rem;
    }

    .zoom-nav.next {
        right: 1rem;
    }
}

@media (max-width: 576px) {
    .thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }

    .thumbnail {
        height: 40px;
    }

    .gallery-grid-view {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .gallery-counter {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .gallery-action-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .thumbnail img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .thumbnail,
    .gallery-nav-btn,
    .gallery-action-btn,
    .zoom-close,
    .zoom-nav {
        transition: none;
    }

        .thumbnail:hover,
        .thumbnail.active {
            transform: none;
        }

    @keyframes shimmer {
        0%, 100% {
            background-position: 0 0;
        }
    }
}

/* Focus States for Accessibility */
.thumbnail:focus,
.gallery-nav-btn:focus,
.gallery-action-btn:focus,
.zoom-close:focus,
.zoom-nav:focus {
    outline: 2px solid var(--gallery-primary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .gallery-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .thumbnails,
    .gallery-controls,
    .media-controls-overlay,
    .fullscreen-toggle {
        display: none;
    }

    .image-column {
        height: auto;
        max-height: 500px;
    }
}
