/* LevelAudio — Design System */
:root {
    /* Colors */
    --color-bg: #0a0a0c;
    --color-surface: #141418;
    --color-surface-hover: #1c1c22;
    --color-border: #2a2a32;
    --color-text: #ffffff;
    --color-text-secondary: #9ca3af;
    --color-text-muted: #6b7280;
    
    /* Accent Colors */
    --color-primary: #8b5cf6;
    --color-primary-light: #a78bfa;
    --color-primary-dark: #6d28d9;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    --gradient-meter: linear-gradient(90deg, #10b981 0%, #f59e0b 50%, #ef4444 100%);
    --gradient-glow: radial-gradient(circle at center, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-lg: 18px;
    --text-xl: 24px;
    --text-2xl: 32px;
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.3);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: var(--space-lg);
    background-image: var(--gradient-glow);
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

/* Header */
.header {
    padding: var(--space-lg);
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.logo-icon {
    font-size: var(--text-xl);
}

.logo-text {
    font-size: var(--text-xl);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* Main Panel */
.main-panel {
    padding: var(--space-lg);
}

/* Power Section */
.power-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.power-toggle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--color-surface-hover);
    border: 3px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.power-toggle:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.power-toggle.active {
    background: var(--gradient-primary);
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-glow);
}

.power-icon {
    font-size: var(--text-2xl);
    color: var(--color-text-muted);
    transition: color var(--transition-base);
}

.power-toggle.active .power-icon {
    color: white;
}

.power-label {
    margin-top: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-weight: 500;
}

/* Visualization Section */
.visualization-section {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.viz-header {
    display: flex;
    justify-content: space-between;
    padding: 0 var(--space-sm);
    margin-bottom: var(--space-sm);
}

.viz-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.viz-container {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.waveform {
    flex: 1;
    height: 60px;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.wave-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 100%;
    padding: var(--space-xs);
    gap: 2px;
}

.wave-bar {
    flex: 1;
    background: var(--gradient-meter);
    border-radius: 2px;
    transition: height 100ms ease;
}

.compression-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
}

.compression-arrow {
    color: var(--color-primary);
    font-size: var(--text-lg);
    font-weight: bold;
}

.compression-value {
    font-size: var(--text-xs);
    color: var(--color-success);
    font-weight: 600;
}

/* Gain Reduction Meter */
.gain-reduction {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.gr-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    min-width: 90px;
}

.gr-meter {
    flex: 1;
    height: 6px;
    background: var(--color-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.gr-bar {
    height: 100%;
    width: 0;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width 100ms ease;
}

.gr-value {
    font-size: var(--text-xs);
    color: var(--color-primary);
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

/* Mode Selection */
.modes-section {
    margin-bottom: var(--space-lg);
}

.section-title {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-md);
    font-weight: 500;
}

.mode-buttons {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.mode-btn {
    flex: 1;
    min-width: 70px;
    padding: var(--space-sm) var(--space-xs);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
}

.mode-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-surface-hover);
}

.mode-btn.active {
    background: var(--gradient-primary);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.mode-icon {
    font-size: var(--text-lg);
}

.mode-name {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    font-weight: 500;
}

.mode-btn.active .mode-name {
    color: white;
}

/* Sliders */
.slider-section {
    margin-bottom: var(--space-lg);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.slider-label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.slider-value {
    font-size: var(--text-sm);
    color: var(--color-primary);
    font-weight: 600;
}

.slider {
    width: 100%;
    height: 6px;
    background: var(--color-bg);
    border-radius: var(--radius-full);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: transform var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-hints {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-xs);
}

.slider-hints span {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* Toggle Section */
.toggle-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.toggle-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.toggle-label {
    font-size: var(--text-sm);
    font-weight: 500;
}

.toggle-desc {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-surface-hover);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--gradient-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Current App */
.current-app {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.app-icon {
    font-size: var(--text-xl);
}

.app-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-name {
    font-size: var(--text-sm);
    font-weight: 600;
}

.app-status {
    font-size: var(--text-xs);
    color: var(--color-success);
}

.app-profile-btn {
    font-size: var(--text-xs);
    color: var(--color-primary);
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.app-profile-btn:hover {
    background: var(--color-surface-hover);
}

/* Demo Section */
.demo-section {
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.demo-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.demo-panel {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border: 1px solid var(--color-border);
}

.demo-panel.with-levelaudio {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.demo-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: var(--space-sm);
}

.demo-panel.with-levelaudio .demo-label {
    color: var(--color-primary);
}

.demo-viz {
    height: 50px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.demo-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 100%;
    padding: var(--space-xs);
    gap: 2px;
}

.demo-bar {
    flex: 1;
    background: var(--gradient-meter);
    border-radius: 2px;
    transition: height 100ms ease;
}

.demo-desc {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.loud-warning, .quiet-warning {
    font-size: var(--text-xs);
    color: var(--color-danger);
}

.good-indicator {
    font-size: var(--text-xs);
    color: var(--color-success);
}

.demo-btn {
    width: 100%;
    padding: var(--space-md);
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.demo-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Footer */
.footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.footer-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
}

.footer-link {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--color-primary);
}

/* Responsive */
@media (max-width: 440px) {
    body {
        padding: 0;
    }
    
    .app-container {
        border-radius: 0;
        min-height: 100vh;
    }
    
    .mode-buttons {
        flex-wrap: wrap;
    }
    
    .mode-btn {
        min-width: calc(33% - 8px);
    }
}
