:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --border: #30363d;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --danger: #f85149;
    --success: #3fb950;
    
    /* Pedal Colors */
    --temporal-echo: #e74c3c;
    --chromatic-aberration: #9b59b6;
    --motion-blur: #3498db;
    --echo-phantom: #5d6d7e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-full {
    width: 100%;
    margin-top: 12px;
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 16px;
    padding: 16px;
    flex: 1;
    min-height: 0;
}

.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel h2 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    flex-shrink: 0;
}

/* Video Containers */
.video-container {
    flex: 1;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.output-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.output-placeholder.hidden {
    display: none;
}

/* Chain Panel */
.chain-panel {
    padding: 16px 24px;
}

.chain-slots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
}

.chain-slot {
    width: 140px;
    height: 180px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    position: relative;
    flex-shrink: 0;
}

.chain-slot.empty {
    cursor: pointer;
}

.chain-slot.empty:hover {
    border-color: var(--accent);
}

.chain-slot.drag-over {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
}

.chain-slot.occupied {
    border-style: solid;
    border-color: var(--border);
    cursor: pointer;
    padding: 8px;
}

.chain-slot.occupied:hover {
    border-color: var(--accent);
}

.slot-number {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.slot-hint {
    font-size: 11px;
    color: var(--text-secondary);
}

.chain-connector {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: bold;
}

/* Pedal in Chain */
.pedal-in-chain {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
}

.pedal-in-chain img {
    width: 48px;
    height: 48px;
}

.pedal-in-chain h4 {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.pedal-knobs {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-top: auto;
    padding-top: 4px;
}

.pedal-knob {
    flex: 1;
}

.pedal-knob label {
    font-size: 9px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 2px;
}

.pedal-knob input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-primary);
    border-radius: 2px;
    outline: none;
}

.pedal-knob input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.pedal-knob input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.pedal-knob .value {
    font-size: 9px;
    color: var(--accent);
    text-align: center;
    display: block;
    margin-top: 2px;
}

.pedal-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    border: none;
    font-size: 11px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    line-height: 1;
}

.chain-slot.occupied:hover .pedal-remove {
    opacity: 1;
}

/* Bottom Drawer */
.drawer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.drawer.collapsed .drawer-content {
    height: 0;
    overflow: hidden;
}

.drawer.collapsed .drawer-label {
    transform: rotate(0deg);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-tertiary);
}

.drawer-header:hover {
    background: var(--border);
}

.drawer-label {
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.drawer.collapsed .drawer-label {
    transform: rotate(-90deg);
}

.drawer-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

.drawer-content {
    padding: 16px 24px;
    height: 200px;
    overflow-y: auto;
    transition: height 0.3s ease;
}

/* Pedal Grid */
.pedal-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.pedal-card {
    flex: 0 0 160px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: grab;
    transition: all 0.2s;
}

.pedal-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.pedal-card.dragging {
    opacity: 0.5;
}

.pedal-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
}

.pedal-icon img {
    width: 100%;
    height: 100%;
}

.pedal-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.pedal-card p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Empty state */
.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Flash message */
.flash {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    animation: flashIn 0.3s ease;
}

.flash.success {
    background: var(--success);
    color: white;
}

.flash.error {
    background: var(--danger);
    color: white;
}

@keyframes flashIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
