/* Winamp-like Audio Visualizer Styles */

/* Main visualizer container */
.visualizer-container {
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

.visualizer-window {
    background: #2a2a2a;
    border: 1px solid #404040;
    border-radius: 8px;
    width: 100%;
    max-width: 900px;
    overflow: hidden;
}

/* Header with title and controls */
.visualizer-header {
    background: #4a4a4a;
    border-bottom: 1px solid #555;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 32px;
}

.visualizer-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
}

.visualizer-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.preset-selector {
    background: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    min-width: 120px;
}

.preset-selector:focus {
    outline: 1px solid #666;
    background: #3a3a3a;
}

.fullscreen-button {
    background: #666;
    border: none;
    border-radius: 4px;
    color: white;
    padding: 4px 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: 32px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-button:hover {
    background: #777;
}

.fullscreen-button.active {
    background: #0066cc;
}

.fullscreen-button.active:hover {
    background: #0077dd;
}

/* Main visualization display area */
.visualizer-display {
    position: relative;
    background: #000;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#visualizer-canvas {
    width: 100%;
    height: 400px;
    display: block;
    background: #000;
}

.visualizer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.visualizer-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.start-message {
    text-align: center;
    color: #ccc;
    max-width: 400px;
    margin: 0 auto;
}

.start-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.7;
}

.start-message p {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.4;
}

/* Desktop/Mobile content switching */
.mobile-message,
.mobile-text,
.mobile-instructions {
    display: none;
}

.desktop-message,
.desktop-text,
.desktop-instructions {
    display: block;
}

/* Mobile styles */
@media (max-width: 768px), (pointer: coarse) {
    .mobile-message,
    .mobile-text,
    .mobile-instructions {
        display: block;
    }
    
    .desktop-message,
    .desktop-text,
    .desktop-instructions {
        display: none;
    }
}

.mobile-note {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid #ffaa00;
    border-radius: 6px;
    color: #ffaa00;
    font-size: 14px;
    line-height: 1.4;
}

.start-button {
    background: #0066cc;
    border: none;
    border-radius: 6px;
    color: white;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: block;
    margin: 0 auto;
    width: auto;
    min-width: 180px;
}

.start-button:hover {
    background: #0077dd;
}

.start-button:active {
    background: #004499;
}

/* Footer with status and controls */
.visualizer-footer {
    background: #3a3a3a;
    border-top: 1px solid #555;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ccc;
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    transition: background-color 0.3s ease;
}

.status-dot.ready {
    background: #ffaa00;
}

.status-dot.active {
    background: #00cc00;
}

.status-dot.error {
    background: #cc0000;
}

/* Volume meter */
.volume-meter {
    display: flex;
    align-items: center;
}

.volume-bars {
    display: flex;
    gap: 2px;
    align-items: end;
}

.volume-bar {
    width: 4px;
    height: 20px;
    background: #333;
    border-radius: 2px;
    transition: background-color 0.1s ease;
}

.volume-bar.active-1 {
    background: #00ff00;
}

.volume-bar.active-2 {
    background: #88ff00;
}

.volume-bar.active-3 {
    background: #ffff00;
}

.volume-bar.active-4 {
    background: #ff8800;
}

.volume-bar.active-5 {
    background: #ff0000;
}

.control-button {
    background: #cc3300;
    border: none;
    border-radius: 4px;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.control-button:hover {
    background: #dd4411;
}

/* Error message styling */
.error-message {
    display: none;
    margin: 20px 0;
    padding: 15px;
    background: rgba(204, 0, 0, 0.1);
    border: 1px solid #cc0000;
    border-radius: 6px;
    color: #cc0000;
}

.error-message.show {
    display: block;
}

/* Fullscreen mode styles */
.visualizer-window.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 9999;
    background: #000;
    cursor: none;
}

.visualizer-window.fullscreen.ui-visible {
    cursor: default;
}

.visualizer-window.fullscreen .visualizer-display {
    min-height: 100vh;
}

.visualizer-window.fullscreen #visualizer-canvas {
    width: 100% !important;
    height: 100vh !important;
}

.visualizer-window.fullscreen .visualizer-header,
.visualizer-window.fullscreen .visualizer-footer {
    position: absolute;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.visualizer-window.fullscreen .visualizer-header {
    top: 0;
    transform: translateY(-100%);
}

.visualizer-window.fullscreen .visualizer-footer {
    bottom: 0;
    transform: translateY(100%);
}

.visualizer-window.fullscreen.ui-visible .visualizer-header,
.visualizer-window.fullscreen.ui-visible .visualizer-footer {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Fullscreen overlay for interaction detection */
.fullscreen-interaction-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    background: transparent;
    cursor: none;
}

.visualizer-window.fullscreen.ui-visible .fullscreen-interaction-overlay {
    cursor: default;
}

/* Responsive design */
@media (max-width: 768px) {
    .visualizer-window {
        margin: 0 -15px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .visualizer-header {
        flex-direction: column;
        gap: 8px;
        padding: 12px 15px;
    }
    
    .preset-selector {
        width: 100%;
        max-width: 200px;
    }
    
    #visualizer-canvas {
        height: 300px;
    }
    
    .visualizer-display {
        min-height: 300px;
    }
    
    .visualizer-footer {
        flex-direction: column;
        gap: 8px;
        padding: 12px 15px;
    }
    
    .start-icon {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .start-message p {
        font-size: 14px;
        margin-bottom: 15px;
    }
    
    .start-button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .visualizer-header {
        padding: 10px;
    }
    
    .visualizer-footer {
        padding: 10px;
    }
    
    #visualizer-canvas {
        height: 250px;
    }
    
    .visualizer-display {
        min-height: 250px;
    }
}

/* Mobile landscape orientation for fullscreen */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .visualizer-window.fullscreen {
        height: 100vh !important;
    }
    
    .visualizer-window.fullscreen .visualizer-header {
        padding: 4px 15px;
        min-height: 24px;
    }
    
    .visualizer-window.fullscreen .visualizer-footer {
        padding: 4px 15px;
        min-height: 24px;
    }
    
    .visualizer-window.fullscreen .visualizer-display {
        min-height: 100vh;
    }
    
    .visualizer-window.fullscreen #visualizer-canvas {
        height: 100vh !important;
    }
    
    .visualizer-window.fullscreen .visualizer-title {
        font-size: 12px;
    }
    
    .visualizer-window.fullscreen .preset-selector {
        font-size: 10px;
        padding: 2px 6px;
        min-width: 100px;
    }
    
    .visualizer-window.fullscreen .fullscreen-button {
        padding: 2px 6px;
        font-size: 14px;
        min-width: 24px;
        height: 20px;
    }
    
    .visualizer-window.fullscreen .status-indicator {
        font-size: 10px;
    }
    
    .visualizer-window.fullscreen .volume-bars {
        gap: 1px;
    }
    
    .visualizer-window.fullscreen .volume-bar {
        width: 3px;
        height: 16px;
    }
}

/* Dark theme adjustments */
.theme-dark .visualizer-window {
    background: #1a1a1a;
    border-color: #333;
}

.theme-dark .visualizer-header {
    background: #333;
    border-bottom-color: #444;
}

.theme-dark .visualizer-footer {
    background: #2a2a2a;
    border-top-color: #444;
}

.theme-dark .preset-selector {
    background: #222;
    border-color: #444;
    color: #ddd;
}

.theme-dark .preset-selector:focus {
    outline-color: #555;
    background: #2a2a2a;
}

/* Light theme adjustments */
.theme-light .visualizer-window {
    background: #f5f5f5;
    border-color: #ccc;
}

.theme-light .visualizer-header {
    background: #e0e0e0;
    border-bottom-color: #bbb;
}

.theme-light .visualizer-title {
    color: #333;
}

.theme-light .visualizer-footer {
    background: #e8e8e8;
    border-top-color: #bbb;
}

.theme-light .status-indicator {
    color: #666;
}

.theme-light .preset-selector {
    background: #fff;
    border-color: #ccc;
    color: #333;
}

.theme-light .preset-selector:focus {
    outline-color: #999;
    background: #f8f8f8;
}

.theme-light .volume-bar {
    background: #ddd;
}

/* System dark mode support */
@media (prefers-color-scheme: dark) {
    :root:not(.theme-light) .visualizer-window {
        background: #1a1a1a;
        border-color: #333;
    }

    :root:not(.theme-light) .visualizer-header {
        background: #333;
        border-bottom-color: #444;
    }

    :root:not(.theme-light) .visualizer-footer {
        background: #2a2a2a;
        border-top-color: #444;
    }

    :root:not(.theme-light) .preset-selector {
        background: #222;
        border-color: #444;
        color: #ddd;
    }

    :root:not(.theme-light) .preset-selector:focus {
        outline-color: #555;
        background: #2a2a2a;
    }
}