/* charterrr.css - Dark studio/recording console aesthetic */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
    --bg:           #0e0f11;
    --surface:      #16181c;
    --surface2:     #1e2128;
    --border:       #2a2d35;
    --accent:       #f0c040;
    --accent2:      #4a9eff;
    --danger:       #ff5f5f;
    --success:      #4dca7a;
    --text:         #e8eaf0;
    --text-muted:   #6b7280;
    --mono:         'Space Mono', monospace;
    --sans:         'DM Sans', sans-serif;
    --radius:       6px;
    --waveform-h:   120px;
}

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

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

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

header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}

header h1 {
    font-family: var(--mono);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent);
}

header h1 span {
    color: var(--text-muted);
    font-weight: 400;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    margin-left: auto;
    flex-shrink: 0;
}

.status-dot.down { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.status-dot.checking { background: var(--accent); box-shadow: 0 0 6px var(--accent); animation: pulse 1s infinite; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.status-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

main {
    flex: 1;
    padding: 32px;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

/* ── Upload Zone ─────────────────────────────────────────────────────────── */

#upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 60px 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--surface);
}

#upload-zone:hover,
#upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(240,192,64,0.04);
}

#upload-zone .icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    display: block;
}

#upload-zone h2 {
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

#upload-zone p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

#upload-zone input[type="file"] {
    display: none;
}

/* ── Progress ────────────────────────────────────────────────────────────── */

#progress-zone {
    display: none;
    text-align: center;
    padding: 60px 32px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

#progress-zone h3 {
    font-family: var(--mono);
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 8px;
}

#progress-zone p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ── Chart Zone ──────────────────────────────────────────────────────────── */

#chart-zone {
    display: none;
}

.meta-bar {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.meta-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
}

.meta-item label {
    display: block;
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.meta-item value {
    display: block;
    font-family: var(--mono);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

/* ── Waveform ────────────────────────────────────────────────────────────── */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.panel-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.panel-body {
    padding: 16px;
}

#waveform-container {
    position: relative;
}

#waveform {
    width: 100%;
    height: var(--waveform-h);
}

/* Section markers overlay */
#sections-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--waveform-h);
    pointer-events: none;
}

.section-marker {
    position: absolute;
    top: 0;
    height: 100%;
    pointer-events: all;
}

.section-block {
    position: absolute;
    top: 0;
    height: 100%;
    opacity: 0.18;
    border-radius: 2px;
}

.section-handle {
    position: absolute;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-1px);
}

.section-handle:hover { background: #fff; }

.section-label-tag {
    position: absolute;
    top: 4px;
    left: 6px;
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: none;
    white-space: nowrap;
    z-index: 5;
}

/* ── Sections Table ──────────────────────────────────────────────────────── */

#sections-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

#sections-table th {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

#sections-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

#sections-table tr:last-child td { border-bottom: none; }

#sections-table tr:hover td { background: var(--surface2); }

.label-select {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.label-select:focus { outline: 1px solid var(--accent); }

.time-display {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--accent2);
}

/* ── Chord Timeline ──────────────────────────────────────────────────────── */

#chord-timeline {
    display: flex;
    height: 36px;
    overflow: hidden;
    border-radius: 4px;
    gap: 1px;
}

.chord-block {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 2px;
    cursor: default;
    position: relative;
}

.chord-block:hover::after {
    content: attr(data-chord);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: var(--accent);
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 100;
    border: 1px solid var(--border);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

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

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* ── Error / Notice ──────────────────────────────────────────────────────── */

.notice {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 16px;
    display: none;
}

.notice.error   { background: rgba(255,95,95,0.1);  border: 1px solid var(--danger);  color: var(--danger); }
.notice.success { background: rgba(77,202,122,0.1); border: 1px solid var(--success); color: var(--success); }
.notice.warn    { background: rgba(240,192,64,0.1); border: 1px solid var(--accent);  color: var(--accent); }

/* ── Playback controls ───────────────────────────────────────────────────── */

.playback {
    display: flex;
    align-items: center;
    gap: 12px;
}

.play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
    color: #000;
    font-size: 0.9rem;
}

.play-btn:hover { opacity: 0.8; }

.time-scrubber {
    flex: 1;
    accent-color: var(--accent);
    cursor: pointer;
}

.time-counter {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 80px;
    text-align: right;
}

/* ── Section colors ──────────────────────────────────────────────────────── */
.sc-intro    { background: #4a9eff; }
.sc-verse    { background: #4dca7a; }
.sc-chorus   { background: #f0c040; }
.sc-bridge   { background: #c97af0; }
.sc-outro    { background: #ff7f5f; }
.sc-prechorus { background: #4af0d0; }
.sc-solo     { background: #f04a7f; }
.sc-breakdown { background: #f0904a; }
.sc-other    { background: #888; }
