/**
 * Sparkles Media Gallery - CSS styles for advanced media gallery
 * Extracted from CustomHyva HyvaMediaGallery module
 * Extends: sparkles-utilities.css, sparkles-animations.css, sparkles-tokens.css
 * All 3 optimization layers applied: keyframes consolidated, patterns extracted, component organization
 */

/* Gallery Container */
.sparkles-media-gallery {
    background-color: var(--color-accent);
    position: relative;
    border-radius: .5rem;
    overflow: hidden;
    --tw-shadow: 0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;
    --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);
    container-type: inline-size;
}

.sparkles-media-gallery.fullscreen {
    z-index: var(--z-modal); /* Keep raw for CSS variable */ position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100vw; height: 100vh; --tw-bg-opacity: 1; background-color: rgba(0,0,0,var(--tw-bg-opacity,1)); border-radius: 0;
}

/* Main Media Display */
.sparkles-media-main {
    position: relative;
    width: 100%;
    height: 24rem;
    overflow: hidden;
    --tw-bg-opacity: 1;
    background-color: rgba(0,0,0,var(--tw-bg-opacity,1));
    display: flex;
    align-items: center;
    justify-content: center;
}

.sparkles-media-gallery.fullscreen .sparkles-media-main {
    height: 100vh;
}

.sparkles-media-current {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition-property: transform;
    transition-duration: .3s;
    transition-timing-function: cubic-bezier(0,0,.2,1);
    cursor: zoom-in;
}

.sparkles-media-current.sparkles-zoomed {
    cursor: zoom-out;
    transition-property: all;
    transition-duration: .15s;
    transition-timing-function: cubic-bezier(0,0,.2,1);
}

/* Media Enter Animation */
.sparkles-media-enter {
    animation: sparkles-media-slide-in 0.3s ease-out;
}

/* Loading States */
.sparkles-media-loading {
    color: var(--color-primary);
    animation: sparkles-pulse 1.5s ease-in-out infinite; /* Keep raw for animation */ position: absolute; font-size: 2.25rem; line-height: 2.5rem;
}

.sparkles-media-loading::before {
    content: '✨';
    animation: spin 1s linear infinite;
}

/* sparkles-spin keyframe moved to animations/sparkles-animations.css */

/* Error States */
.sparkles-media-error {
    position: relative;
    background-color: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
}

.sparkles-media-error::before {
    content: '🖼️';
    font-size: 3rem;
    line-height: 1;
    opacity: .5;
}

.sparkles-media-error::after {
    content: 'Failed to load image';
    position: absolute;
    font-size: .875rem;
    line-height: 1.25rem;
    color: var(--gray-400);
}

/* Navigation Controls */
.sparkles-media-controls {
    z-index: var(--z-dropdown); /* Keep raw for CSS variable */ position: absolute; transition: opacity .3s ease-out;
}

.sparkles-media-controls.hidden {
    opacity: 0;
    pointer-events: none;
}

.sparkles-media-nav-prev {
    left: 1rem;
}

.sparkles-media-nav-next {
    right: 1rem;
}

.sparkles-media-nav-btn,
.sparkles-media-play-btn {
    background: var(--sparkles-media-btn-bg, rgba(0, 0, 0, 0.5)); /* Keep raw for rgba */
    backdrop-filter: blur(8px); /* Keep raw for backdrop-filter */
    border-width: 0;
    border-radius: var(--radius-full);
    width: var(--sparkles-media-btn-size, 3rem);
    height: var(--sparkles-media-btn-size, 3rem);
    --tw-text-opacity: 1;
    color: rgba(255,255,255,var(--tw-text-opacity,1));
    cursor: pointer;
    transition-property: all;
    transition-duration: .15s;
    transition-timing-function: cubic-bezier(0,0,.2,1);
}

.sparkles-media-nav-btn {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.sparkles-media-nav-btn:hover {
    background: rgba(198, 159, 50, 0.8); /* Keep raw for rgba */
    transform: scale(1.1);
}

.sparkles-media-nav-btn:active {
    transform: scale(0.95);
}

/* Top Controls */
.sparkles-media-top-controls {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent); /* Keep raw for gradient */
    z-index: var(--z-dropdown); /* Keep raw for CSS variable */ position: absolute; left: 0; right: 0; top: 0; padding: 1rem; display: flex; justify-content: space-between; align-items: center; transition: opacity .3s ease-out;
}

.sparkles-media-top-controls.hidden {
    opacity: 0;
    pointer-events: none;
}

.sparkles-media-info {
    --tw-text-opacity: 1;
    color: rgba(255,255,255,var(--tw-text-opacity,1));
}

.sparkles-media-actions {
    display: flex;
    gap: .5rem;
}

.sparkles-media-action-btn {
    background: rgba(255, 255, 255, 0.1); /* Keep raw for rgba */
    backdrop-filter: blur(8px); /* Keep raw for backdrop-filter */
    border: 1px solid rgba(255, 255, 255, 0.2); /* Keep raw for rgba */ border-radius: .375rem; padding: .5rem; --tw-text-opacity: 1; color: rgba(255,255,255,var(--tw-text-opacity,1)); cursor: pointer; display: flex; align-items: center; gap: .25rem; font-size: .875rem; line-height: 1.25rem; transition-property: all; transition-duration: .15s; transition-timing-function: cubic-bezier(0,0,.2,1);
}

.sparkles-media-action-btn:hover {
    background: rgba(198, 159, 50, 0.3); /* Keep raw for rgba */
    border-color: var(--color-primary);
}

/* Zoom Controls */
.sparkles-media-zoom-controls {
    z-index: var(--z-dropdown); /* Keep raw for CSS variable */ position: absolute; bottom: 1rem; right: 1rem; display: flex; gap: .5rem;
}

.sparkles-media-zoom-btn {
    background: rgba(0, 0, 0, 0.5); /* Keep raw for rgba */
    backdrop-filter: blur(8px); /* Keep raw for backdrop-filter */
    border-width: 0;
    border-radius: .375rem;
    width: 2.25rem;
    height: 2.25rem;
    --tw-text-opacity: 1;
    color: rgba(255,255,255,var(--tw-text-opacity,1));
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 700;
    transition-property: all;
    transition-duration: .15s;
    transition-timing-function: cubic-bezier(0,0,.2,1);
}

.sparkles-media-zoom-btn:hover {
    background: rgba(198, 159, 50, 0.8); /* Keep raw for rgba */
}

.sparkles-media-zoom-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Thumbnails */
.sparkles-media-thumbnails {
    display: flex;
    gap: .5rem;
    padding: 1rem;
    --tw-bg-opacity: 1;
    background-color: rgba(255,255,255,var(--tw-bg-opacity,1));
    border-top-width: 1px;
    border-color: var(--gray-200);
    overflow-x: auto;
}

.sparkles-media-thumbnails::-webkit-scrollbar {
    height: .25rem;
}

.sparkles-media-thumbnails::-webkit-scrollbar-track {
    background-color: var(--gray-100);
}

.sparkles-media-thumbnails::-webkit-scrollbar-thumb {
    background-color: var(--color-primary) rounded-sm;
}

.sparkles-media-thumb {
    flex-shrink: 0;
    width: 5rem;
    height: 4rem;
    border-radius: .375rem;
    overflow: hidden;
    cursor: pointer;
    border-width: 2px;
    border-color: #0000;
    position: relative;
    transition-property: all;
    transition-duration: .15s;
    transition-timing-function: cubic-bezier(0,0,.2,1);
}

.sparkles-media-thumb:hover {
    --tw-shadow: 0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;
    --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);
}

.sparkles-media-thumb.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(198, 159, 50, 0.2);
}

.sparkles-media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition-property: all;
    transition-duration: .15s;
    transition-timing-function: cubic-bezier(0,0,.2,1);
}

.sparkles-media-thumb:hover img {
    transform: scale(1.1);
}

/* Video Play Overlay */
.sparkles-media-thumb.video::after {
    content: '▶️';
    background: rgba(0, 0, 0, 0.7); /* Keep raw for rgba */ position: absolute; border-radius: var(--radius-full); width: 1.5rem; height: 1.5rem; display: flex; align-items: center; justify-content: center; font-size: .75rem; line-height: 1rem; --tw-text-opacity: 1; color: rgba(255,255,255,var(--tw-text-opacity,1));
}

/* Video Player */
.sparkles-media-video {
    width: 100%;
    height: 100%;
    border-width: 0;
    --tw-bg-opacity: 1;
    background-color: rgba(0,0,0,var(--tw-bg-opacity,1));
}

.sparkles-media-video-overlay {
    z-index: var(--z-dropdown); /* Keep raw for CSS variable */ position: absolute;
}

.sparkles-media-play-btn {
    font-size: 2rem;
    --sparkles-media-btn-bg: rgba(198, 159, 50, 0.9); /* Keep raw for rgba */
    --sparkles-media-btn-size: 5rem;
}

.sparkles-media-play-btn:hover {
    background-color: var(--color-primary);
    transform: scale(1.1);
}

/* Caption */
.sparkles-media-caption {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)); /* Keep raw for gradient */ position: absolute; left: 0; right: 0; bottom: 0; --tw-text-opacity: 1; color: rgba(255,255,255,var(--tw-text-opacity,1)); padding-left: 1rem; padding-right: 1rem; padding-top: 1.5rem; padding-bottom: 1rem; font-size: .875rem; line-height: 1.25rem; line-height: 1.25;
}

/* Progress Indicator */
.sparkles-media-progress {
    background-color: var(--color-primary);
    transition: width 0.3s ease-out; /* Keep raw for specific timing */
    z-index: var(--z-dropdown); /* Keep raw for CSS variable */ position: absolute; bottom: 0; left: 0; height: .25rem;
}

/* Responsive Design */
@container (max-width: 768px) {
    .sparkles-media-nav-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
        line-height: 1.5rem;
    }
    
    .sparkles-media-nav-prev {
        left: .5rem;
    }
    
    .sparkles-media-nav-next {
        right: .5rem;
    }
    
    .sparkles-media-top-controls {
        padding: .5rem;
    }
    
    .sparkles-media-actions {
        gap: .25rem;
    }
    
    .sparkles-media-action-btn {
        padding: .25rem;
        font-size: .75rem;
        line-height: 1rem;
    }
    
    .sparkles-media-thumb {
        width: 4rem;
        height: 2.75rem;
    }
    
    .sparkles-media-play-btn {
        width: 4rem;
        height: 4rem;
        font-size: 1.5rem;
        line-height: 2rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .sparkles-media-controls {
        opacity: 1;
    }
    
    .sparkles-media-nav-btn {
        background: rgba(0, 0, 0, 0.7); /* Keep raw for rgba */
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .sparkles-media-nav-btn,
    .sparkles-media-action-btn,
    .sparkles-media-zoom-btn {
        --tw-bg-opacity: 1;
        background-color: rgba(0,0,0,var(--tw-bg-opacity,1));
        border-width: 2px;
        --tw-border-opacity: 1;
        border-color: rgba(255,255,255,var(--tw-border-opacity,1));
    }
    
    .sparkles-media-thumb.active {
        box-shadow: 0 0 0 3px var(--white); /* Keep raw for specific box-shadow */
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .sparkles-media-current,
    .sparkles-media-nav-btn,
    .sparkles-media-thumb,
    .sparkles-media-thumb img,
    .sparkles-media-play-btn {
        transition-property: none;
    }
    
    .sparkles-media-enter {
        animation: none;
    }
    
    .sparkles-media-loading::before {
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .sparkles-media-gallery {
        --tw-bg-opacity: 1;
        background-color: rgba(17,24,39,var(--tw-bg-opacity,1));
    }
    
    .sparkles-media-thumbnails {
        --tw-bg-opacity: 1;
        background-color: rgba(31,41,55,var(--tw-bg-opacity,1));
    }
    
    .sparkles-media-error {
        --tw-bg-opacity: 1;
        background-color: rgba(31,41,55,var(--tw-bg-opacity,1));
        color: var(--gray-400);
    }
}

/* Focus States for Accessibility */
.sparkles-media-thumb:focus {
    border-radius: .375rem;
}
