/**
 * Gallery Page Styles
 * Version: 1.0.0
 *
 * Changelog:
 * - 1.0.0: Extracted from inline styles in gallery.html for better caching
 */

/* Gallery Section */
.gallery-section {
    background: var(--bg-secondary);
    min-height: 60vh;
}

/* Filter Buttons */
.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.gallery-filter-btn {
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--color-gray-200);
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

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

.gallery-filter-btn.is-active {
    background: linear-gradient(135deg, var(--color-primary) 0%, #fb923c 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.35);
}

/* ========================================
   STYLE 1: GRID - Equal sized photos
   ======================================== */
.gallery--grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.gallery--grid .gallery-item {
    aspect-ratio: 4/3;
}

/* ========================================
   STYLE 2: MASONRY - True masonry with columns
   ======================================== */
.gallery--masonry {
    column-count: 3;
    column-gap: 16px;
}

.gallery--masonry .gallery-item {
    break-inside: avoid;
    margin-bottom: 16px;
    display: inline-block;
    width: 100%;
}

.gallery--masonry .gallery-item img,
.gallery--masonry .gallery-item video {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Masonry items - disable transform to prevent column gaps */
.gallery--masonry .gallery-item:hover {
    transform: none;
}

.gallery--masonry .gallery-item.is-visible {
    transform: none;
}

/* ========================================
   STYLE 3: JUSTIFIED - Rows with equal height
   ======================================== */
.gallery--justified {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gallery--justified .gallery-item {
    flex: 1 1 200px;
    max-width: 400px;
    height: 250px;
}

/* ========================================
   STYLE 4: CAROUSEL - Horizontal slider
   ======================================== */
.gallery--carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.gallery--carousel::-webkit-scrollbar {
    height: 8px;
}

.gallery--carousel::-webkit-scrollbar-track {
    background: var(--color-gray-200);
    border-radius: 4px;
}

.gallery--carousel::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}

.gallery--carousel .gallery-item {
    flex: 0 0 auto;
    width: 350px;
    height: 280px;
    scroll-snap-align: start;
}

.carousel-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 24px;
}

.carousel-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 1px solid var(--color-gray-200);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.carousel-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.carousel-btn svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   STYLE 5: MOSAIC - Mixed tile sizes
   ======================================== */
.gallery--mosaic {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: 140px;
    gap: 10px;
    grid-auto-flow: dense;
}

/* Large feature items (2x2) */
.gallery--mosaic .gallery-item:nth-child(6n+1) {
    grid-column: span 2;
    grid-row: span 2;
}

/* Wide items (2x1) */
.gallery--mosaic .gallery-item:nth-child(6n+3) {
    grid-column: span 2;
}

/* Tall items (1x2) */
.gallery--mosaic .gallery-item:nth-child(6n+5) {
    grid-row: span 2;
}

/* ========================================
   COMMON GALLERY ITEM STYLES
   ======================================== */
.gallery-item {
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: var(--bg-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);

    /* Animation */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s ease;
}

.gallery-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
    z-index: 1;
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

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

/* Video styles */
.gallery-video {
    position: relative;
    width: 100%;
    height: 100%;
}

.gallery-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.video-play-btn svg {
    width: 28px;
    height: 28px;
    margin-left: 4px;
}

.gallery-item:hover .video-play-btn {
    background: var(--color-primary);
    transform: translate(-50%, -50%) scale(1.1);
}

/* ========================================
   AUDIO ITEM STYLES
   ======================================== */
.gallery-audio {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.audio-cover {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.audio-cover svg {
    width: 40px;
    height: 40px;
    color: rgba(255, 255, 255, 0.9);
}

.gallery-item:hover .audio-cover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.audio-info {
    text-align: center;
    color: white;
}

.audio-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-product {
    display: block;
    font-size: 12px;
    opacity: 0.7;
}

.audio-play-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.audio-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.audio-play-btn svg {
    width: 24px;
    height: 24px;
}

.audio-play-btn .play-icon {
    margin-left: 3px;
}

/* Lightbox Audio Styles */
.lightbox-audio {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    border-radius: 16px;
    min-width: 350px;
}

.lightbox-audio-cover {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.lightbox-audio-cover svg {
    width: 60px;
    height: 60px;
    color: rgba(255, 255, 255, 0.9);
}

.lightbox-audio-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#lightboxAudioPlayer {
    width: 100%;
    max-width: 300px;
}

#lightboxAudioPlayer::-webkit-media-controls-panel {
    background: rgba(255, 255, 255, 0.1);
}

/* Empty state */
.gallery-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.gallery-empty svg {
    margin-bottom: 20px;
    opacity: 0.4;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-close svg {
    width: 24px;
    height: 24px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.lightbox-nav svg {
    width: 28px;
    height: 28px;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 20px;
    border-radius: 30px;
}

/* Responsive */
@media (max-width: 1024px) {
    .gallery--grid { grid-template-columns: repeat(3, 1fr); }
    .gallery--masonry { column-count: 2; }
    .gallery--mosaic { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 120px; }
    .gallery--carousel .gallery-item { width: 300px; height: 240px; }
}

@media (max-width: 768px) {
    .gallery--grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .gallery--masonry { column-count: 2; column-gap: 10px; }
    .gallery--masonry .gallery-item { margin-bottom: 10px; }
    .gallery--justified .gallery-item { height: 180px; }
    .gallery--mosaic { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 100px; }
    .gallery--carousel .gallery-item { width: 280px; height: 220px; }

    .gallery-filters { gap: 8px; margin-bottom: 24px; }
    .gallery-filter-btn { padding: 8px 16px; font-size: 13px; }
    .gallery-item { border-radius: 8px; }
}

/* Dark mode */
[data-theme="dark"] .gallery-section {
    background: var(--bg-primary);
}

[data-theme="dark"] .gallery-filter-btn {
    background: var(--bg-secondary);
    border-color: var(--color-gray-700);
}

[data-theme="dark"] .gallery-item {
    background: var(--bg-secondary);
}

[data-theme="dark"] .carousel-btn {
    background: var(--bg-secondary);
    border-color: var(--color-gray-700);
}

/* ========================================
   MODERN VIDEO PLAYER
   ======================================== */
.video-player {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.video-player video {
    display: block;
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
}

.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    transition: background 0.3s ease;
}

.video-player:not(.is-playing) .video-overlay {
    background: rgba(0, 0, 0, 0.3);
}

.video-big-play {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.video-big-play svg {
    width: 36px;
    height: 36px;
    margin-left: 4px;
}

.video-overlay:hover .video-big-play {
    transform: scale(1.1);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}

.video-player.is-playing .video-big-play {
    opacity: 0;
    transform: scale(0.8);
}

/* Video Controls */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    padding: 40px 16px 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.video-player:hover .video-controls,
.video-player:not(.is-playing) .video-controls {
    opacity: 1;
    transform: translateY(0);
}

/* Progress Bar */
.video-progress {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-bottom: 12px;
    cursor: pointer;
}

.video-progress:hover {
    height: 6px;
}

.video-progress-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    pointer-events: none;
}

.video-progress-filled {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--color-primary, #f97316);
    border-radius: 2px;
    pointer-events: none;
}

.video-progress-input {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 20px;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

.video-controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.video-controls-spacer {
    flex: 1;
}

.video-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.video-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.video-btn svg {
    width: 22px;
    height: 22px;
}

/* Time Display */
.video-time {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-family: 'Inter', monospace;
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-time-sep {
    opacity: 0.5;
}

/* Volume Control */
.video-volume {
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-volume-slider {
    width: 0;
    opacity: 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.video-volume:hover .video-volume-slider {
    width: 80px;
    opacity: 1;
}

.video-volume-slider {
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.video-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Speed Control */
.video-speed {
    position: relative;
}

.video-speed-btn {
    font-size: 12px;
    font-weight: 600;
    min-width: 40px;
}

.video-speed-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 80px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.video-speed:hover .video-speed-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.video-speed-menu button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.video-speed-menu button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.video-speed-menu button.active {
    color: var(--color-primary, #f97316);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .video-controls {
        padding: 30px 12px 10px;
    }

    .video-volume-slider {
        display: none;
    }

    .video-speed {
        display: none;
    }

    .video-big-play {
        width: 60px;
        height: 60px;
    }

    .video-big-play svg {
        width: 28px;
        height: 28px;
    }
}
