/**
 * Audio Visualizer Module Styles
 * 
 * Styles for the Theo Overlay Player visualizer in different modes
 */

/* Base visualizer container */
.theo-visualizer-container {
    position: fixed;
    background-color: var(--theo-visualizer-base-color, #000000);
    transition: all 0.3s ease-in-out;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    border-radius: 0;
    box-sizing: border-box;
}

.theo-visualizer-container.active {
    opacity: 1;
    visibility: visible;
}

/* Canvas element */
.theo-visualizer-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

/* Window mode styling */
.theo-visualizer-window {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 400px;
    min-width: 300px;
    min-height: 200px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    z-index: 2147483647;
    pointer-events: auto;
    resize: both;
}

.theo-visualizer-window .theo-visualizer-canvas {
    border-radius: 0 0 8px 8px;
}

/* Fullscreen mode styling */
.theo-visualizer-fullscreen {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    transform: none !important;
    z-index: 2147483648;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* Background underlay mode styling */
.theo-visualizer-background {
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: 0.3;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.theo-visualizer-background.active {
    opacity: 0.3;
}

/* Controls bar for window mode */
.theo-visualizer-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    pointer-events: auto;
    z-index: 10;
}

.theo-visualizer-dragbar {
    flex: 1;
    display: flex;
    align-items: center;
    cursor: move;
    user-select: none;
}

.theo-visualizer-title {
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
}

.theo-visualizer-buttons {
    display: flex;
    gap: 4px;
}

.theo-visualizer-fullscreen-btn,
.theo-visualizer-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.theo-visualizer-fullscreen-btn:hover,
.theo-visualizer-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theo-visualizer-close-btn:hover {
    background-color: rgba(255, 0, 0, 0.3);
}

.theo-visualizer-buttons .dashicons {
    font-size: 16px;
    line-height: 1;
}

/* Window mode canvas positioning */
.theo-visualizer-window .theo-visualizer-canvas {
    position: absolute;
    top: 30px;
    left: 0;
    width: 100%;
    height: calc(100% - 30px);
}

/* Loading and error states */
.theo-visualizer-loading,
.theo-visualizer-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 14px;
    text-align: center;
    z-index: 5;
    pointer-events: none;
}

.theo-visualizer-window .theo-visualizer-loading,
.theo-visualizer-window .theo-visualizer-error {
    top: calc(50% + 15px);
}

.theo-visualizer-error {
    color: #ff6b6b;
}

/* Hide controls in fullscreen and background modes */
.theo-visualizer-fullscreen .theo-visualizer-controls,
.theo-visualizer-background .theo-visualizer-controls {
    display: none;
}

.theo-visualizer-fullscreen .theo-visualizer-canvas,
.theo-visualizer-background .theo-visualizer-canvas {
    top: 0;
    height: 100%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .theo-visualizer-window {
        width: 90vw;
        height: 60vh;
        min-width: 280px;
        min-height: 180px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .theo-visualizer-window {
        border-color: #ffffff;
        box-shadow: 0 5px 25px rgba(0, 0, 0, 0.8);
    }
    
    .theo-visualizer-controls {
        background: rgba(0, 0, 0, 0.95);
        border-bottom: 1px solid #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .theo-visualizer-container {
        transition: none;
    }
}

/* Dragging state */
.theo-visualizer-container.dragging {
    transition: none;
    user-select: none;
}

.theo-visualizer-container.dragging .theo-visualizer-dragbar {
    cursor: grabbing;
}

/* Resizing indicators */
.theo-visualizer-window {
    resize: both;
    overflow: hidden;
}

/* Focus styles for accessibility */
.theo-visualizer-fullscreen-btn:focus,
.theo-visualizer-close-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Fullscreen overlay controls */
.theo-visualizer-fullscreen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 20;
}

.theo-visualizer-fullscreen-overlay.visible {
    opacity: 1;
}

.theo-visualizer-fullscreen-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.theo-visualizer-fs-close,
.theo-visualizer-fs-settings {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    padding: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.theo-visualizer-fs-close:hover,
.theo-visualizer-fs-settings:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

.theo-visualizer-fs-close .dashicons,
.theo-visualizer-fs-settings .dashicons {
    font-size: 20px;
    line-height: 1;
}

.theo-visualizer-fullscreen-info {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

/* Hide fullscreen overlay in non-fullscreen modes */
.theo-visualizer-window .theo-visualizer-fullscreen-overlay,
.theo-visualizer-background .theo-visualizer-fullscreen-overlay {
    display: none;
}

/* Preset settings modal */
.theo-visualizer-preset-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    backdrop-filter: blur(5px);
}

/* Visualizer settings modal */
.theo-visualizer-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.theo-visualizer-preset-content,
.theo-visualizer-settings-content {
    position: absolute;
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: default;
}

.theo-visualizer-preset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    cursor: move;
    user-select: none;
    border-radius: 12px 12px 0 0;
}

.theo-visualizer-preset-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.theo-visualizer-preset-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.theo-visualizer-preset-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.theo-visualizer-preset-body {
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

.theo-visualizer-preset-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f3f4f6;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.theo-visualizer-preset-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #374151;
}

.cycle-time-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cycle-time-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

/* Visualizer settings styles */
.settings-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.settings-section h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}

.setting-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: #374151;
    min-width: 120px;
}

.setting-group input[type="range"] {
    flex: 1;
    min-width: 150px;
}

.setting-group input[type="color"] {
    width: 40px;
    height: 30px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
}

.setting-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.setting-group select {
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.theo-visualizer-settings-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

.theo-visualizer-settings-footer button {
    padding: 10px 20px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.theo-visualizer-settings-footer button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.theo-visualizer-settings-footer .settings-apply {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.theo-visualizer-settings-footer .settings-apply:hover {
    background: #059669;
    border-color: #059669;
}
    font-size: 14px;
}

.theo-visualizer-preset-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.preset-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.preset-item:last-child {
    border-bottom: none;
}

.preset-item:hover {
    background: #f3f4f6;
}

.preset-item label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    width: 100%;
}

.preset-checkbox {
    margin: 0;
    cursor: pointer;
}

.preset-name {
    flex: 1;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: color 0.2s ease;
}

.preset-name:hover {
    color: #2563eb;
    text-decoration: underline;
}

.theo-visualizer-preset-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.preset-select-all,
.preset-select-none,
.preset-apply {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.preset-select-all,
.preset-select-none {
    background: #ffffff;
    color: #374151;
}

.preset-select-all:hover,
.preset-select-none:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.preset-apply {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.preset-apply:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* Dark theme support for preset modal */
.theme-dark .theo-visualizer-preset-content {
    background: #1f2937;
    color: #f9fafb;
}

.theme-dark .theo-visualizer-preset-header {
    background: #111827;
    border-bottom-color: #374151;
}

.theme-dark .theo-visualizer-preset-header h3 {
    color: #f9fafb;
}

.theme-dark .theo-visualizer-preset-controls {
    background: #111827;
    border-color: #374151;
}

.theme-dark .theo-visualizer-preset-list {
    background: #111827;
    border-color: #374151;
}

.theme-dark .preset-item {
    border-bottom-color: #374151;
}

.theme-dark .preset-item:hover {
    background: #1f2937;
}

.theme-dark .preset-name {
    color: #e5e7eb;
}

.theme-dark .theo-visualizer-preset-footer {
    background: #111827;
    border-top-color: #374151;
}

.theme-dark .preset-select-all,
.theme-dark .preset-select-none {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
}

.theme-dark .preset-select-all:hover,
.theme-dark .preset-select-none:hover {
    background: #4b5563;
}

/* Dragging state */
body.dragging {
    user-select: none;
    cursor: move !important;
}

body.dragging * {
    cursor: move !important;
}

/* Song titles now use Butterchurn's built-in launchSongTitleAnim() function */

/* Responsive design for mobile */
@media (max-width: 768px) {
    .theo-visualizer-preset-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .theo-visualizer-preset-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .theo-visualizer-preset-footer {
        flex-wrap: wrap;
        gap: 10px;
    }
}
