/* ==========================================================================
   SlicePost Design V2 — Editor workbench polish
   Loaded AFTER site-v2-extras.css on every route. This file finishes the
   Reframe Studio modal / timeline surfaces that still carry legacy inline
   colors (#1a1c23, #242731, #2d313f, #0d0e12, #a0aec0). Inline styles win
   the cascade, so targeted `!important` rules are used ONLY here, scoped to
   the editor modal and its direct controls. Everything else keeps tokens.

   Order: site-v2.css -> site-v2-components.css -> site-v2-extras.css -> THIS
   ========================================================================== */

/* ---- modal frame: legacy inline bg replaced by V2 slate ---- */
#editor-modal {
    background: rgba(5, 5, 5, 0.97) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

#editor-modal > div {
    background: var(--v2-slate) !important;
    border-color: var(--v2-border-strong) !important;
    border-radius: var(--r-lg) !important;
    box-shadow: var(--v2-card-shadow) !important;
    color: var(--v2-white) !important;
}

#editor-modal h3,
#editor-modal h4,
#editor-modal h5 {
    color: var(--v2-white) !important;
}

#editor-title {
    color: var(--v2-blue-light) !important;
    font-weight: 800;
    letter-spacing: -0.02em;
}

#editor-modal button[onclick="closeFramingEditor()"],
#editor-modal .editor-modal-close {
    color: var(--v2-muted) !important;
}

/* ---- scene blocks column ---- */
#editor-scenes-list h4,
#editor-modal .editor-grid h4 {
    color: var(--v2-muted) !important;
    letter-spacing: 0.08em;
}

/* ---- workspace panel ---- */
#editor-workspace > div {
    background: var(--v2-ink) !important;
    border-color: var(--v2-border) !important;
    border-radius: var(--r-md) !important;
}

#preview-container {
    border-color: var(--v2-border-strong) !important;
    border-radius: var(--r-sm) !important;
    box-shadow: 0 0 0 1px rgba(16, 20, 239, 0.12);
}

#editor-preview-hint {
    color: var(--v2-muted) !important;
}

#editor-seek-info,
#scrub-time-current,
#scrub-time-total {
    color: var(--v2-dim) !important;
    font-family: 'JetBrains Mono', ui-monospace, monospace !important;
}

#editor-play-btn,
#editor-vol-btn {
    filter: saturate(1.2);
}

/* ---- editor tabs: V2 selected state ---- */
.editor-tabs {
    border-bottom: 1px solid var(--v2-border) !important;
    gap: 4px;
}
.editor-tab {
    font-weight: 700 !important;
    color: var(--v2-muted) !important;
    border-radius: 10px 10px 0 0;
    transition: color .15s ease, background .15s ease;
}
.editor-tab:hover { color: var(--v2-white) !important; background: rgba(255,255,255,0.04); }
.editor-tab.active {
    color: var(--v2-blue-light) !important;
    border-bottom: 2px solid var(--v2-blue-light) !important;
    background: rgba(16, 20, 239, 0.08);
}

/* ---- tab panels (framing / hook / music / transcript) ---- */
#editor-tab-framing,
#editor-tab-hook,
#editor-tab-music,
#editor-tab-transcript {
    background: var(--v2-slate-2) !important;
    border-radius: var(--r-md) !important;
    border: 1px solid var(--v2-border);
}

#editor-tab-framing label,
#editor-tab-hook label,
#editor-tab-music label,
#editor-tab-transcript label,
#editor-modal select + label,
#editor-modal label {
    color: var(--v2-muted) !important;
    font-weight: 700;
    font-size: 0.78rem !important;
    letter-spacing: 0.04em;
}

/* ---- selects & inputs inside the modal ---- */
#editor-modal select,
#editor-modal input[type="text"],
#editor-modal input[type="number"] {
    background: var(--v2-ink) !important;
    border-color: var(--v2-border-strong) !important;
    color: var(--v2-white) !important;
    border-radius: 8px !important;
    outline: none !important;
    transition: border-color .15s ease, box-shadow .15s ease;
}
#editor-modal select:focus,
#editor-modal input[type="text"]:focus {
    border-color: var(--v2-blue-light) !important;
    box-shadow: 0 0 0 3px rgba(16, 20, 239, 0.18);
}
#editor-modal select option { background: var(--v2-slate); color: var(--v2-white); }

/* ---- range sliders ---- */
#editor-modal input[type="range"] {
    accent-color: var(--v2-blue);
}

/* ---- scene zoom / reset buttons ---- */
#control-scene-zoom button,
#control-single-vertical button,
#control-split-screen button,
#control-horizontal-blur button,
#control-center-crop button,
#editor-modal button[onclick="resetSceneZoom()"] {
    background: var(--v2-slate-3) !important;
    border-color: var(--v2-border-strong) !important;
    color: var(--v2-white) !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    transition: all .15s ease;
}
#editor-modal button[onclick="resetSceneZoom()"]:hover {
    border-color: var(--v2-blue-light);
    color: var(--v2-blue-light);
}

/* ---- scene speaker box ---- */
#scene-speaker-name {
    color: var(--v2-blue-light) !important;
    font-family: 'JetBrains Mono', ui-monospace, monospace !important;
}

/* ---- control hints: quiet, consistent ---- */
.control-hint {
    color: var(--v2-dim) !important;
    font-size: 0.78rem !important;
    line-height: 1.5;
}

/* ---- trim controls ---- */
.clip-trim-controls > div > div > div:first-child > div:first-child {
    color: var(--v2-white) !important;
    font-weight: 700;
}

/* ---- save / close row ---- */
#editor-modal .btn-primary,
#editor-modal .btn-action {
    background: var(--v2-blue) !important;
    border: 1px solid rgba(16, 20, 239, 0.5) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 6px 24px rgba(16,20,239,0.4) !important;
    color: #fff !important;
}
#editor-modal .btn-primary:hover { filter: brightness(1.1); }

/* ==========================================================================

/* ---- light theme: keep the workbench dark (video surface), only chrome flips ---- */
html[data-theme="light"] #editor-modal > div {
    background: var(--v2-slate-2) !important;
}
html[data-theme="light"] #editor-tab-framing,
html[data-theme="light"] #editor-tab-hook,
html[data-theme="light"] #editor-tab-music,
html[data-theme="light"] #editor-tab-transcript {
    background: var(--v2-paper-steel) !important;
}
html[data-theme="light"] #editor-modal select,
html[data-theme="light"] #editor-modal input[type="text"] {
    background: #fff !important;
    border-color: var(--v2-border-strong) !important;
    color: var(--v2-paper-text) !important;
}

/* ==========================================================================
   Pixel-grid loader — futuristic processing indicator (header status pill)
   3x3 grid, chevron wavefront sweeping right; shimmering label; live elapsed
   timer in mono tabular figures. Reduced motion freezes the grid dim.
   ========================================================================== */

.pixel-loader {
    display: inline-flex; align-items: center; gap: 9px;
    font-size: 0.9rem; font-weight: 600; color: var(--v2-white);
    white-space: nowrap;
}

/* 3x3 grid of 4px cells */
.pixel-grid {
    display: grid;
    grid-template-columns: repeat(3, 4px);
    gap: 1.5px;
    flex: none;
}
.pixel-cell {
    width: 4px; height: 4px;
    background: var(--v2-blue-light);
    border-radius: 1px;
    opacity: 0.14;
}
.pixel-cell.on { animation: pixel-on 650ms ease-in-out infinite; }
.pixel-cell.round { border-radius: 50%; }
@keyframes pixel-on {
    0%, 100% { opacity: 0.14; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.15); box-shadow: 0 0 6px rgba(16,20,239,0.6); }
}

/* shimmering label */
.pixel-label {
    background-image: linear-gradient(90deg,
        var(--v2-dim) 35%, var(--v2-white) 50%, var(--v2-dim) 65%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: shimmer-text 1.4s linear infinite;
}
@keyframes shimmer-text {
    to { background-position: -200% 0; }
}

/* elapsed timer */
.pixel-elapsed {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.78rem;
    color: var(--v2-dim);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* reduced motion: freeze the grid dim, timer keeps ticking */
@media (prefers-reduced-motion: reduce) {
    .pixel-cell.on { animation: none; opacity: 0.14; }
    .pixel-label { animation: none; -webkit-text-fill-color: var(--v2-muted); color: var(--v2-muted); }
}
