/* ═══════════════════════════════════════════════════════════════════════
   Echoes Harmony — User Manual
   Theme: matches the broadcast app UI (dark, warm, amber + teal + cyan)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    /* ── Core backgrounds (matching the app's dark panels) ── */
    --bg:           #141517;
    --bg-raised:    #1c1e22;
    --bg-surface:   #22252a;
    --bg-elevated:  #292c32;
    --sidebar-bg:   #111316;

    /* ── Text ── */
    --text-primary:   #e8e8e8;
    --text-secondary: #9a9fa8;
    --text-muted:     #555c66;
    --text-dim:       #333840;

    /* ── Accents — pulled directly from the screenshot ── */
    --amber:         #f5a623;   /* Deck A / playing / jingle color */
    --amber-dim:     rgba(245, 166, 35, 0.1);
    --amber-glow:    rgba(245, 166, 35, 0.22);

    --teal:          #2db87a;   /* Song rows / green indicators */
    --teal-dim:      rgba(45, 184, 122, 0.1);

    --cyan:          #29b8d4;   /* Deck B / incoming waveform */
    --cyan-dim:      rgba(41, 184, 212, 0.1);

    --red:           #c0392b;   /* Missing file / error */
    --red-dim:       rgba(192, 57, 43, 0.1);

    --olive:         #7a8c3a;   /* Commercial rows */
    --olive-dim:     rgba(122, 140, 58, 0.1);

    --border:        rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);

    /* ── Typography ── */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'SF Mono', 'Consolas', 'Courier New', ui-monospace, monospace;

    /* ── Layout ── */
    --sidebar-w: 280px;
    --content-max: 800px;
    --radius: 8px;
    --radius-sm: 5px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ── Reading progress bar ── */
#progress-bar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--amber), var(--cyan));
    transform-origin: left;
    transform: scaleX(0);
    z-index: 1000;
    transition: transform 0.1s linear;
    box-shadow: 0 0 8px var(--amber-glow);
}

/* ══════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════ */
#sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    z-index: 200;
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 16px 14px 13px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--amber-dim);
    border: 1px solid var(--amber-glow);
    color: var(--amber);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sidebar-brand-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

/* Search */
.sidebar-search {
    position: relative;
    padding: 10px 10px 8px;
    flex-shrink: 0;
}

.sidebar-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

#search-input {
    width: 100%;
    height: 32px;
    padding: 0 28px 0 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-raised);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
#search-input:focus {
    border-color: rgba(245, 166, 35, 0.4);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.08);
}
#search-input::placeholder { color: var(--text-muted); }

#search-clear {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    display: none;
    transition: color 0.1s;
}
#search-clear:hover { color: var(--text-primary); }
#search-clear.visible { display: block; }

/* Nav */
nav {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elevated) transparent;
}
nav::-webkit-scrollbar { width: 3px; }
nav::-webkit-scrollbar-track { background: transparent; }
nav::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }

#nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#nav-links li {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background 0.1s, color 0.1s;
    user-select: none;
    line-height: 1.35;
    border: 1px solid transparent;
}

.nav-num {
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--text-dim);
    min-width: 18px;
    transition: color 0.1s;
    flex-shrink: 0;
}

#nav-links li:hover {
    background: var(--bg-raised);
    color: var(--text-primary);
}
#nav-links li:hover .nav-num { color: var(--text-muted); }

#nav-links li.active {
    background: var(--amber-dim);
    border-color: var(--amber-glow);
    color: var(--amber);
}
#nav-links li.active .nav-num { color: rgba(245, 166, 35, 0.45); }

/* Sidebar footer */
.sidebar-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.lang-switcher {
    display: flex;
    gap: 3px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.lang-btn {
    padding: 3px 11px;
    border-radius: 3px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}
.lang-btn.active {
    background: var(--amber-dim);
    color: var(--amber);
    border: 1px solid var(--amber-glow);
}

.section-counter {
    font-family: var(--mono);
    font-size: 0.66rem;
    color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════
   LAYOUT RIGHT
   ══════════════════════════════════════════════════════ */
#layout-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 0;
}

#topbar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-bg);
    flex-shrink: 0;
}

#menu-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.topbar-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Main content */
#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 44px 80px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elevated) transparent;
}
#main-content::-webkit-scrollbar { width: 5px; }
#main-content::-webkit-scrollbar-track { background: transparent; }
#main-content::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 4px; }
#main-content::-webkit-scrollbar-thumb:hover { background: var(--bg-surface); }

/* ══════════════════════════════════════════════════════
   SECTIONS
   ══════════════════════════════════════════════════════ */
.section {
    max-width: var(--content-max);
    margin: 0 auto;
    padding-top: 52px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.section:last-child { border-bottom: none; }

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.section-num {
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--amber);
    background: var(--amber-dim);
    border: 1px solid var(--amber-glow);
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.08em;
    white-space: nowrap;
    flex-shrink: 0;
}

.section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

/* h3 — teal, with left bar (like queue item type indicators) */
.section h3 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--teal);
    margin: 28px 0 9px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.section h3::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 12px;
    background: var(--teal);
    border-radius: 2px;
    flex-shrink: 0;
}

/* h4 — amber, smaller */
.section h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--amber);
    margin: 18px 0 7px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.section p {
    line-height: 1.7;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Lists */
.section ul, .section ol {
    margin: 0 0 14px 0;
    padding-left: 0;
    list-style: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.section li {
    padding: 4px 0 4px 20px;
    position: relative;
    line-height: 1.6;
}
.section ul li::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 12px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
}
.section ol { counter-reset: ol-counter; }
.section ol li { counter-increment: ol-counter; }
.section ol li::before {
    content: counter(ol-counter);
    position: absolute;
    left: 0;
    top: 4px;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--amber);
    width: 16px;
    text-align: right;
}
.section li strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── Code ── */
code {
    font-family: var(--mono);
    font-size: 0.82em;
    font-weight: 600;
    color: var(--cyan);
    background: var(--cyan-dim);
    border: 1px solid rgba(41, 184, 212, 0.18);
    padding: 1px 5px;
    border-radius: 3px;
}

pre {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-left: 3px solid var(--amber);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 14px 0;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.65;
    color: var(--text-secondary);
}
pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

/* ── Keyboard shortcuts — styled like app control labels ── */
kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.16);
    border-bottom-width: 2px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-family: var(--mono);
    font-size: 0.74em;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    box-shadow: 0 1px 0 rgba(0,0,0,0.4);
}

/* ── Images / placeholders ── */
.section img {
    width: 100%;
    height: auto;
    max-height: min(72vh, 760px);
    object-fit: contain;
    border-radius: var(--radius);
    margin: 14px 0;
    border: 1px solid var(--border);
    display: block;
}

.section img.placeholder-img {
    background: var(--bg-raised);
}

.section img.manual-img-portrait {
    width: min(42vw, 430px);
    max-width: 430px;
    max-height: min(78vh, 900px);
    margin: 14px auto 20px;
}

div.placeholder-img {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 14px 0;
    position: relative;
    overflow: hidden;
}
.placeholder-img::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 16px,
        rgba(255,255,255,0.012) 16px,
        rgba(255,255,255,0.012) 17px
    );
}
.placeholder-img::after {
    content: attr(data-label);
    font-size: 0.74rem;
    color: var(--text-muted);
    font-family: var(--mono);
    font-weight: 600;
    letter-spacing: 0.05em;
    position: relative;
    z-index: 1;
    padding: 5px 11px;
    background: var(--bg-elevated);
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* ── Callout boxes — styled like queue row types ── */
.callout {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin: 14px 0;
    font-size: 0.86rem;
    line-height: 1.65;
    border: 1px solid;
    border-left-width: 3px;
}
.callout-icon { font-size: 0.95rem; flex-shrink: 0; margin-top: 1px; }

.callout.tip {
    background: rgba(45, 184, 122, 0.06);
    border-color: rgba(45, 184, 122, 0.2);
    border-left-color: var(--teal);
    color: rgba(45, 184, 122, 0.9);
}
.callout.info {
    background: rgba(41, 184, 212, 0.06);
    border-color: rgba(41, 184, 212, 0.2);
    border-left-color: var(--cyan);
    color: rgba(41, 184, 212, 0.9);
}
.callout.warning {
    background: rgba(245, 166, 35, 0.06);
    border-color: rgba(245, 166, 35, 0.2);
    border-left-color: var(--amber);
    color: rgba(245, 166, 35, 0.9);
}
.callout.danger {
    background: rgba(192, 57, 43, 0.08);
    border-color: rgba(192, 57, 43, 0.2);
    border-left-color: var(--red);
    color: rgba(192, 57, 43, 0.9);
}

/* ── Tables ── */
.section table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    margin: 14px 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.section th {
    text-align: left;
    padding: 9px 12px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
.section td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: top;
    line-height: 1.5;
}
.section tr:last-child td { border-bottom: none; }
.section tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Badges (content-type chips like queue rows) ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    white-space: nowrap;
    font-family: var(--mono);
}
.badge.song    { background: rgba(45,184,122,0.12); color: var(--teal);   border: 1px solid rgba(45,184,122,0.25); }
.badge.jingle  { background: var(--amber-dim);      color: var(--amber);  border: 1px solid var(--amber-glow); }
.badge.spot    { background: rgba(122,140,58,0.12); color: var(--olive);  border: 1px solid rgba(122,140,58,0.25); }
.badge.live    { background: rgba(41,184,212,0.1);  color: var(--cyan);   border: 1px solid rgba(41,184,212,0.22); }
.badge.error   { background: var(--red-dim);        color: var(--red);    border: 1px solid rgba(192,57,43,0.25); }
.badge.gray    { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Commercial Traffic guide helpers ── */
.manual-flow-map {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 16px 0 20px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.006)),
        var(--bg-raised);
}
.manual-flow-map span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border: 1px solid rgba(45, 184, 122, 0.18);
    border-radius: 999px;
    background: rgba(45, 184, 122, 0.07);
    color: rgba(134, 221, 183, 0.92);
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 750;
}
.manual-flow-map span:not(:last-child)::after {
    content: '→';
    color: rgba(134, 221, 183, 0.45);
    margin-left: 2px;
}
.manual-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0;
}
.manual-card-grid div {
    display: grid;
    gap: 6px;
    min-height: 96px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.006)),
        var(--bg-raised);
}
.manual-card-grid strong {
    color: var(--text-primary);
    font-size: 0.83rem;
}
.manual-card-grid span {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

/* ── Steps ── */
.steps {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 14px 0;
}
.steps > li {
    counter-increment: step-counter;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 0;
    min-width: 0;
}
.steps > li::before {
    content: counter(step-counter);
    width: 28px;
    min-width: 28px;
    height: 26px;
    border-radius: 4px;
    background: var(--amber-dim);
    border: 1px solid var(--amber-glow);
    color: var(--amber);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 800;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: static !important;
    top: auto !important;
    left: auto !important;
    box-sizing: border-box;
}
.steps > li > .step-body {
    padding-top: 3px;
    flex: 1;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.65;
}

/* ── Search highlight ── */
mark {
    background: rgba(245, 166, 35, 0.28);
    color: var(--amber);
    border-radius: 2px;
    padding: 0 2px;
}

/* ── Search empty state ── */
.search-empty {
    position: fixed;
    inset: 0;
    left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 50;
}
.search-empty svg { opacity: 0.25; }
.search-empty p { font-size: 0.9rem; }
.search-empty strong { color: var(--text-secondary); }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 760px) {
    :root { --sidebar-w: 0px; }
    body { overflow: visible; height: auto; }
    #progress-bar { left: 0; }
    #sidebar {
        position: fixed;
        left: -290px;
        width: 290px;
        height: 100%;
        transition: left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 300;
        box-shadow: 8px 0 32px rgba(0,0,0,0.7);
    }
    #sidebar.open { left: 0; }
    #layout-right { height: 100vh; overflow: hidden; }
    #topbar { display: flex; }
    #main-content { padding: 0 18px 80px; }
    .section h2 { font-size: 1.25rem; }
    .section img.manual-img-portrait {
        width: 100%;
        max-width: none;
        float: none;
        margin: 14px 0;
    }
    .manual-card-grid { grid-template-columns: 1fr; }
    .search-empty { left: 0; }
}
