/* ============================================================
   Tab Guitar Editor — page-specific styles
   Uses design tokens from /css/styles.css
   Tokens: --ink, --ivory, --leaf, --hairline, --text-muted,
           --radius-sm, --radius, --radius-lg, --font-body, --font-mono
   ============================================================ */

/* ── Layout ── */
.editor-page {
    max-width: var(--container);
    margin: 0 auto;
    padding: 48px 24px 64px;
}

.editor-page h1 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    color: var(--ink);
    margin-bottom: 8px;
}

.editor-page .page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 32px;
    max-width: 600px;
}

/* ── Control Panel ── */
.editor-controls {
    background: var(--ivory);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.editor-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-soft);
    white-space: nowrap;
}

.editor-controls select,
.editor-controls input[type="number"] {
    padding: 6px 10px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    background: var(--ivory);
    color: var(--ink);
    font-size: 0.875rem;
    font-family: var(--font-body);
    min-width: 70px;
}

.editor-controls select:focus,
.editor-controls input[type="number"]:focus {
    outline: none;
    border-color: var(--leaf);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.ctrl-separator {
    width: 1px;
    height: 24px;
    background: var(--hairline);
    flex-shrink: 0;
}

.ctrl-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Buttons ── */
.editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    background: var(--ivory);
    color: var(--ink);
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.editor-btn:hover {
    background: var(--ivory-dim);
    border-color: var(--ink-dim);
}

.editor-btn:active {
    background: var(--hairline-soft);
}

.editor-btn--primary {
    background: var(--leaf);
    color: var(--ivory);
    border-color: var(--leaf);
}

.editor-btn--primary:hover {
    background: var(--leaf-dim);
    border-color: var(--leaf-dim);
}

.editor-btn--primary:active {
    background: var(--leaf-dim);
}

.editor-btn--danger {
    color: #DC2626;
    border-color: transparent;
    background: transparent;
}

.editor-btn--danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

.editor-btn--sm {
    padding: 2px 8px;
    font-size: 11px;
}

/* ── Player Bar ── */
.player-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--ivory);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.player-bar .transport-btns {
    display: flex;
    gap: 6px;
}

.player-bar .transport-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--hairline);
    background: var(--ivory);
    color: var(--ink);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.player-bar .transport-btn:hover {
    background: var(--ivory-dim);
    border-color: var(--leaf);
}

.player-bar .transport-btn.active {
    background: var(--leaf);
    color: var(--ivory);
    border-color: var(--leaf);
}

.progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#playerSeek {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--hairline);
    outline: none;
    cursor: pointer;
}

#playerSeek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--leaf);
    cursor: pointer;
    transition: transform 0.15s;
}

#playerSeek:active::-webkit-slider-thumb {
    transform: scale(1.2);
}

#playerSeek::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--leaf);
    border: none;
    cursor: pointer;
}

.time-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.player-bar .io-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Status / Loading ── */
.editor-status {
    text-align: center;
    padding: 8px 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--ivory-dim);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: none;
}

.editor-status.visible {
    display: block;
}

.editor-status.playing {
    background: var(--leaf-soft);
    color: var(--leaf-dim);
    border-color: var(--leaf-light);
}

.editor-status.loading {
    background: #FEF3C7;
    color: #92400E;
    border-color: #FDE68A;
}

/* ── Grid / Systems ── */
#grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.system {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--ivory);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 12px;
    overflow-x: auto;
}

.label-column {
    display: flex;
    flex-direction: column;
    margin-right: 6px;
    flex-shrink: 0;
}

.string-label {
    width: 30px;
    height: 24px;
    text-align: right;
    font-weight: 600;
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 4px;
}

.string-label.delete-label {
    height: 24px;
}

.string-label.config-label {
    height: 28px;
}

.measures-wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 4px;
}

.measure-separator {
    width: 1px;
    background: var(--hairline);
    align-self: stretch;
    flex-shrink: 0;
}

/* ── Measure ── */
.measure-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
}

.measure-controls {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.measure-to {
    display: grid;
    grid-template-rows: 24px 28px repeat(6, 24px);
    grid-template-columns: repeat(var(--beats), 34px);
    gap: 2px;
    border-radius: var(--radius-sm);
}

/* ── Delete column button ── */
.delete-col {
    width: 20px;
    height: 20px;
    font-size: 12px;
    line-height: 1;
    background: rgba(220, 38, 38, 0.1);
    color: #DC2626;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    justify-self: center;
    transition: background 0.15s;
}

.delete-col:hover {
    background: rgba(220, 38, 38, 0.2);
}

/* ── Config input (tinted row) ── */
.beat_config {
    width: 32px;
    height: 24px;
    text-align: center;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    background: #FEF3C7;
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    padding: 0;
    transition: border-color 0.15s;
}

.beat_config:focus {
    outline: none;
    border-color: var(--leaf);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* ── Beat cell ── */
.beat {
    width: 32px;
    height: 24px;
    border: 1px solid var(--hairline);
    background: var(--ivory);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-mono);
    color: var(--ink);
    cursor: text;
    text-align: center;
    transition: all 0.15s;
}

.beat:focus {
    outline: none;
    border-color: var(--leaf);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.beat.filled {
    background: var(--leaf-soft);
    font-weight: 600;
    border-color: transparent;
    color: var(--ink);
}

.beat.active {
    background: rgba(16, 185, 129, 0.12);
    border-color: var(--leaf);
}

.beat.active-play {
    background: #FEF3C7;
    border-color: #F59E0B;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}

/* ── Add buttons ── */
.add-measure-btn {
    margin-left: 8px;
    align-self: center;
}

#add-system {
    margin-top: 12px;
}

/* ── Hidden file input ── */
.file-input-hidden {
    display: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .editor-page {
        padding: 24px 16px 48px;
    }

    .editor-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .editor-controls .ctrl-separator {
        width: 100%;
        height: 1px;
    }

    .ctrl-group {
        flex-wrap: wrap;
    }

    .player-bar {
        flex-wrap: wrap;
    }

    .player-bar .io-btns {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .system {
        overflow-x: auto;
    }
}
