/* SFX Maker - Cyberpunk Theme */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Rajdhani:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
    /* Colors - Cyberpunk Palette */
    --bg-primary: #000000;
    --bg-secondary: #0a0a0f;
    --bg-panel: #12121a;
    --bg-input: #0a0a0f;

    --border-color: #1a1a25;
    --border-highlight: #2a2a3a;

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #5a5a70;

    --accent-primary: #00f0ff;
    --accent-secondary: #ff00ff;
    --accent-tertiary: #39ff14;
    --accent-warning: #ffbf00;

    --glow-primary: rgba(0, 240, 255, 0.4);
    --glow-secondary: rgba(255, 0, 255, 0.4);
    --glow-tertiary: rgba(57, 255, 20, 0.4);

    /* Fonts */
    --font-display: 'Rajdhani', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Sizing */
    --header-height: 60px;
    --footer-height: 40px;
    --panel-padding: 16px;
    --border-radius: 0px;
    --slider-height: 6px;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
}

/* Header */
.app-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--accent-primary);
    box-shadow: 0 0 20px var(--glow-primary);
}

.back-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-primary);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.3s;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
}

.back-link:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px var(--glow-primary);
    text-shadow: 0 0 10px var(--glow-primary);
}

.back-link span {
    font-size: 1.2em;
}

.header-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: center;
}

.app-header h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-primary);
    text-shadow: 0 0 20px var(--glow-primary), 0 0 40px var(--glow-primary);
    line-height: 1;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.header-subtitle {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    gap: 16px;
    padding: 16px;
    overflow: hidden;
    min-height: 0;
}

/* Panels */
.left-panel {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.right-panel {
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--panel-padding);
    position: relative;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    opacity: 0.5;
}

.panel h2 {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-primary);
    margin-bottom: 12px;
    text-shadow: 0 0 10px var(--glow-primary);
}

.panel h3 {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Preset Section */
.preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.preset-btn {
    padding: 10px 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 10px var(--glow-primary);
    text-shadow: 0 0 5px var(--glow-primary);
}

.preset-btn:active {
    transform: scale(0.97);
}

.preset-random {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), rgba(255, 0, 255, 0.1));
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.preset-random:hover {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(255, 0, 255, 0.2));
    box-shadow: 0 0 20px var(--glow-primary), 0 0 20px var(--glow-secondary);
}

/* Waveform Section */
.waveform-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.waveform-btn {
    flex: 1;
    min-width: 60px;
    padding: 8px 6px;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.waveform-btn:hover {
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
    box-shadow: 0 0 10px var(--glow-secondary);
}

.waveform-btn.active {
    background: transparent;
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
    font-weight: 600;
    box-shadow: 0 0 15px var(--glow-secondary), inset 0 0 20px rgba(255, 0, 255, 0.1);
    text-shadow: 0 0 10px var(--glow-secondary);
}

/* Mutate Section */
.mutate-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mutate-amount {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mutate-amount label {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 45px;
}

.mutate-amount input {
    flex: 1;
}

.mutate-amount span {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 30px;
    text-align: right;
}

/* Actions Section */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-buttons .btn {
    flex: 1;
}

/* Visualizer */
.visualizer-section {
    height: 180px;
    padding: 0;
    overflow: hidden;
}

#waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: var(--border-radius);
}

/* Parameters Section */
.params-section {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.param-group {
    background: var(--bg-secondary);
    border-radius: 0;
    padding: 12px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: visible;
}

.param-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--glow-primary);
}

.param-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.param-row:last-child {
    margin-bottom: 0;
}

.param-row label {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 55px;
    flex-shrink: 0;
}

.param-row input[type="range"] {
    flex: 1;
    min-width: 80px;
}

.param-row label {
    font-family: var(--font-mono);
}

.param-value {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--accent-primary);
    min-width: 45px;
    text-align: right;
    text-shadow: 0 0 5px var(--glow-primary);
    flex-shrink: 0;
}

/* Lock Button */
.lock-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.lock-btn:hover {
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
    box-shadow: 0 0 10px var(--glow-secondary);
}

.lock-btn.locked {
    background: transparent;
    border-color: var(--accent-warning);
    color: var(--accent-warning);
    box-shadow: 0 0 10px rgba(255, 191, 0, 0.4);
}

/* Export Section */
.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-export {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
}

/* JSON Section */
.json-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Keyboard Section */
.keyboard-hints {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hint {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--text-secondary);
}

kbd {
    display: inline-block;
    padding: 3px 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    background: var(--bg-input);
    border: 1px solid var(--accent-primary);
    border-radius: 0;
    color: var(--accent-primary);
    min-width: 45px;
    text-align: center;
    text-shadow: 0 0 5px var(--glow-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 1px solid var(--border-color);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: transparent;
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-primary:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    box-shadow: 0 0 20px var(--glow-primary), 0 0 40px var(--glow-primary);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 15px var(--glow-primary);
}

.btn-small {
    padding: 6px 12px;
    font-size: 10px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-small:hover {
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
    box-shadow: 0 0 10px var(--glow-secondary);
}

.btn:active {
    transform: scale(0.97);
}

/* Sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: var(--slider-height);
    background: var(--bg-input);
    border-radius: 0;
    outline: none;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 8px var(--glow-primary);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px var(--glow-primary);
}

input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border: none;
    border-radius: 0;
    cursor: pointer;
    box-shadow: 0 0 8px var(--glow-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 0;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 0;
    box-shadow: 0 0 5px var(--glow-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
    box-shadow: 0 0 10px var(--glow-secondary);
}

/* Footer */
.app-footer {
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--accent-primary);
    box-shadow: 0 0 20px var(--glow-primary);
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1200px) {
    .params-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
        overflow-y: auto;
    }

    .left-panel,
    .right-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .left-panel .panel,
    .right-panel .panel {
        flex: 1;
        min-width: 150px;
    }

    .center-panel {
        order: -1;
    }

    .params-grid {
        grid-template-columns: 1fr;
    }

    .visualizer-section {
        height: 120px;
    }
}

@media (max-width: 600px) {
    .app-header {
        padding: 0 12px;
    }

    .app-header h1 {
        font-size: 18px;
    }

    .main-content {
        padding: 8px;
        gap: 8px;
    }

    .panel {
        padding: 12px;
    }

    .preset-grid {
        grid-template-columns: 1fr;
    }

    .preset-random {
        grid-column: span 1;
    }
}

/* Animation */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 var(--glow-primary);
    }
    50% {
        box-shadow: 0 0 20px 5px var(--glow-primary);
    }
}

.btn-primary:focus {
    animation: pulse 1.5s infinite;
}

/* Toast notification (for copy success) */
.toast {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--bg-panel);
    border: 1px solid var(--accent-primary);
    border-radius: 6px;
    color: var(--accent-primary);
    font-size: 13px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
}

/* ==================== GAME PRESETS SECTION ==================== */

.game-presets-section {
    padding: var(--panel-padding);
}

.game-presets-scroll {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preset-category-group {
    /* No extra margin needed, gap handles spacing */
}

.category-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding-left: 2px;
}

.preset-grid-small {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.preset-grid-small .preset-btn {
    padding: 6px 4px;
    font-size: 10px;
}

/* Make left panel scrollable */
.left-panel {
    overflow-y: auto;
}

/* ==================== FILENAME INPUT ==================== */

.filename-section {
    padding: 12px;
}

.filename-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.filename-input-wrapper:focus-within {
    border-color: var(--accent-primary);
}

.filename-input {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'SF Mono', 'Consolas', monospace;
    outline: none;
}

.filename-input::placeholder {
    color: var(--text-muted);
}

.filename-extension {
    padding: 10px 12px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 12px;
    font-family: 'SF Mono', 'Consolas', monospace;
    border-left: 1px solid var(--border-color);
}

.filename-hint {
    margin-top: 6px;
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

/* Adjust preset section to not be too tall */
.preset-section .preset-grid {
    max-height: none;
}

/* ==================== TOOLTIPS ==================== */

.preset-btn[title] {
    position: relative;
}

.preset-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 10px;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
}

.preset-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--border-color);
    z-index: 100;
    pointer-events: none;
}
