/**
 * PQ Crypta Visualizer Styles
 * Modern CSS for spectacular audio visualizations
 */

/* Visualizer Container */
.visualizer-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Canvas */
.visualizer-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: transparent;
    position: relative;
    z-index: 1;
    image-rendering: optimizeSpeed;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
}

/* Fullscreen Toggle Button */
.fullscreen-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(10, 10, 15, 0.8);
    border: 2px solid #00d4ff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.3s ease;
    padding: 0;
    outline: none;
}

.fullscreen-toggle:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: #7b68ee;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    transform: scale(1.05);
}

.fullscreen-toggle:active {
    transform: scale(0.95);
}

.fullscreen-icon {
    width: 24px;
    height: 24px;
    color: #00d4ff;
    transition: color 0.3s ease;
}

.fullscreen-toggle:hover .fullscreen-icon {
    color: #7b68ee;
}

/* Toggle icon states */
.fullscreen-toggle .compress-icon {
    display: none;
}

.fullscreen-toggle.fullscreen-active .expand-icon {
    display: none;
}

.fullscreen-toggle.fullscreen-active .compress-icon {
    display: block;
}

/* Fullscreen mode adjustments */
.visualizer-container:fullscreen {
    border-radius: 0;
}

.visualizer-container:-webkit-full-screen {
    border-radius: 0;
}

.visualizer-container:-moz-full-screen {
    border-radius: 0;
}

.visualizer-container:-ms-fullscreen {
    border-radius: 0;
}

/* Controls Overlay */
.visualizer-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(10, 10, 15, 0.95), transparent);
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 10;
}

.visualizer-controls.hidden {
    transform: translateY(100%);
    opacity: 0;
}

/* Presets Selector */
.visualizer-presets {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 250px;
}

.visualizer-presets label {
    color: #00d4ff;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.visualizer-preset-select {
    flex: 1;
    padding: 10px 15px;
    background: rgba(20, 20, 40, 0.8);
    border: 2px solid #00d4ff;
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.visualizer-preset-select:hover {
    background: rgba(30, 30, 50, 0.9);
    border-color: #7b68ee;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.visualizer-preset-select:focus {
    border-color: #ff1744;
    box-shadow: 0 0 20px rgba(255, 23, 68, 0.5);
}

.visualizer-preset-select option {
    background: #1a1a2e;
    color: #ffffff;
    padding: 10px;
}

/* Settings Group */
.visualizer-settings {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: rgba(20, 20, 40, 0.6);
    border-radius: 6px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.setting-group label {
    color: #00d4ff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Range Inputs */
.setting-group input[type="range"] {
    width: 120px;
    height: 6px;
    background: linear-gradient(to right, #00d4ff 0%, #7b68ee 50%, #ff1744 100%);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
}

.setting-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(255, 23, 68, 1);
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.setting-group input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(255, 23, 68, 1);
}

/* Select Inputs */
.setting-group select {
    padding: 6px 12px;
    background: rgba(10, 10, 20, 0.8);
    border: 1px solid #00d4ff;
    border-radius: 4px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.setting-group select:hover {
    background: rgba(20, 20, 30, 0.9);
    border-color: #7b68ee;
}

.setting-group select:focus {
    border-color: #ff1744;
    box-shadow: 0 0 10px rgba(255, 23, 68, 0.5);
}

/* FPS Counter */
.visualizer-fps {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid #00d4ff;
    border-radius: 4px;
    color: #00d4ff;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    pointer-events: none;
}

/* Preset Info Tooltip */
.preset-info {
    position: absolute;
    top: 10px;
    left: 10px;
    max-width: 300px;
    padding: 15px;
    background: rgba(10, 10, 15, 0.9);
    border: 2px solid #00d4ff;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    line-height: 1.6;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.preset-info.visible {
    opacity: 1;
}

.preset-info h4 {
    color: #00d4ff;
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
}

.preset-info p {
    margin: 0;
    color: #b0b0b0;
    font-size: 13px;
}

.preset-info .mode-badge {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(123, 104, 238, 0.3);
    border: 1px solid #7b68ee;
    border-radius: 3px;
    color: #7b68ee;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

/* WebGL Mode Badge */
.mode-badge.webgl {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    color: #00d4ff;
}

.mode-badge.webgpu {
    background: rgba(255, 23, 68, 0.2);
    border-color: #ff1744;
    color: #ff1744;
}

.mode-badge.canvas2d {
    background: rgba(0, 255, 127, 0.2);
    border-color: #00ff7f;
    color: #00ff7f;
}

/* Loading Indicator */
.visualizer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 30px;
    background: rgba(10, 10, 15, 0.95);
    border: 2px solid #00d4ff;
    border-radius: 8px;
    color: #00d4ff;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    z-index: 100;
}

.visualizer-loading::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 15px auto 0;
    border: 3px solid rgba(0, 212, 255, 0.2);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error Message */
.visualizer-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 30px;
    background: rgba(255, 23, 68, 0.1);
    border: 2px solid #ff1744;
    border-radius: 8px;
    color: #ff1744;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    max-width: 400px;
    z-index: 100;
}

/* Responsive Design */
@media (max-width: 768px) {
    .visualizer-controls {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .visualizer-presets,
    .visualizer-settings {
        width: 100%;
    }

    .setting-group {
        flex: 1 1 calc(50% - 10px);
        justify-content: space-between;
    }

    .setting-group input[type="range"] {
        width: 100px;
    }

    .preset-info {
        max-width: calc(100% - 20px);
        left: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .setting-group {
        flex: 1 1 100%;
    }

    .visualizer-fps {
        font-size: 10px;
        padding: 6px 10px;
    }
}

/* Fullscreen Mode */
.visualizer-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border-radius: 0;
}

/* Accessibility */
.visualizer-controls *:focus-visible {
    outline: 2px solid #ff1744;
    outline-offset: 2px;
}

/* Animation for control visibility */
.visualizer-container:hover .visualizer-controls.auto-hide {
    transform: translateY(0);
    opacity: 1;
}

.visualizer-controls.auto-hide {
    transform: translateY(100%);
    opacity: 0;
}

/* Performance Indicators */
.performance-warning {
    position: absolute;
    top: 50px;
    right: 10px;
    padding: 10px 15px;
    background: rgba(255, 165, 0, 0.2);
    border: 2px solid #ffa500;
    border-radius: 6px;
    color: #ffa500;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Color Scheme Previews */
.color-scheme-preview {
    display: inline-flex;
    gap: 3px;
    margin-left: 8px;
    padding: 2px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.color-scheme-preview .color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Quantum Effect Overlays */
.quantum-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%,
        transparent 0%,
        transparent 40%,
        rgba(0, 212, 255, 0.05) 60%,
        rgba(123, 104, 238, 0.1) 80%,
        rgba(255, 23, 68, 0.15) 100%
    );
    opacity: 0.3;
    mix-blend-mode: screen;
    animation: quantumPulse 10s ease-in-out infinite;
}

@keyframes quantumPulse {
    0%, 100% {
        opacity: 0.2;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(1.1);
    }
}

/* Grid Overlay for Scientific Modes */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.visualizer-container[data-grid="true"] .grid-overlay {
    opacity: 1;
}

/* Bloom Effect Container */
.bloom-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    filter: blur(20px);
    opacity: 0.5;
    mix-blend-mode: screen;
}

/* Fullscreen Toggle Button */
.visualizer-fullscreen-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(10, 10, 15, 0.8);
    border: 2px solid #00d4ff;
    border-radius: 6px;
    color: #00d4ff;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.visualizer-fullscreen-btn:hover {
    background: rgba(20, 20, 30, 0.9);
    border-color: #7b68ee;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    transform: scale(1.1);
}

.visualizer-fullscreen-btn:active {
    transform: scale(0.95);
}

.visualizer-fullscreen-btn:focus-visible {
    outline: 2px solid #ff1744;
    outline-offset: 3px;
}
