/**
 * Cinematic Background Effects CSS
 * Enhanced styling for the background system
 */

/* Canvas styling */
#cinematic-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

/* Background customizer modal enhancements */
#bg-modal {
    backdrop-filter: blur(20px);
}

/* Ensure modal is completely hidden by default */
.bg-modal-wrapper {
    display: none !important;
}

.bg-modal-wrapper[style*="display: flex"] {
    display: flex !important;
}

#bg-modal .modal-container {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(75, 85, 99, 0.3);
}

/* Custom slider styles */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    background: rgba(75, 85, 99, 0.5);
    height: 8px;
    border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

input[type="range"]::-moz-range-track {
    background: rgba(75, 85, 99, 0.5);
    height: 8px;
    border-radius: 4px;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Toggle switch enhancements */
.toggle-switch {
    transition: all 0.3s ease;
}

.toggle-switch:checked {
    background: var(--primary);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.3);
}

/* Preset button hover effects */
.bg-preset {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.bg-preset::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.bg-preset:hover::before {
    left: 100%;
}

.bg-preset:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Animation classes for particles */
.particles-active {
    position: relative;
}

.particles-fade-in {
    opacity: 0;
    animation: particleFadeIn 0.5s ease-in forwards;
}

@keyframes particleFadeIn {
    to {
        opacity: 1;
    }
}

/* Background blur effects */
.bg-blur-active {
    filter: blur(var(--bg-blur, 0px));
    transition: filter 0.3s ease;
}

/* Cinematic vignette overlay */
.cinematic-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, var(--vignette-intensity, 0.3)) 100%
    );
    transition: opacity 0.3s ease;
}

/* Grid pattern overlay */
.grid-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: var(--grid-opacity, 0.1);
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: var(--grid-size, 50px) var(--grid-size, 50px);
    transition: opacity 0.3s ease;
}

/* Wave animation effects */
.wave-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: var(--wave-opacity, 0.3);
}

/* Nebula cloud effects */
.nebula-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(
        ellipse 80% 50% at 40% 40%,
        rgba(var(--primary-rgb), var(--nebula-intensity, 0.1)) 0%,
        transparent 50%
    ),
    radial-gradient(
        ellipse 60% 80% at 80% 70%,
        rgba(var(--secondary-rgb), var(--nebula-intensity, 0.1)) 0%,
        transparent 50%
    );
    animation: nebulaDrift 20s ease-in-out infinite alternate;
}

@keyframes nebulaDrift {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 0.1;
    }
    50% {
        opacity: 0.2;
    }
    100% {
        transform: scale(1.1) rotate(2deg);
        opacity: 0.1;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #cinematic-background {
        opacity: 0.6;
    }
    
    .bg-preset {
        font-size: 0.875rem;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        height: 18px;
        width: 18px;
    }
    
    input[type="range"]::-moz-range-thumb {
        height: 18px;
        width: 18px;
    }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    #cinematic-background {
        opacity: 0.3;
    }
    
    .toggle-switch:checked {
        box-shadow: none;
    }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
    #cinematic-background,
    .nebula-effect,
    .bg-preset,
    input[type="range"]::-webkit-slider-thumb,
    input[type="range"]::-moz-range-thumb {
        animation: none;
        transition: none;
    }
}
