/*
 * /debug — log viewer styles.
 *
 * Tab strip (one per channel), filter controls, monospace output with
 * server-side syntax tokens (.dh-ts, .dh-lvl, .dh-file, .dh-method, etc.)
 * coloured from the theme so /theme recolours this page too.
 */

/* ── Tabs ──────────────────────────────────────────────────────────── */
.debug-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    border-bottom: 1px solid var(--border);
    margin: 0 0 1.25rem;
    padding-bottom: 0;
}
.debug-tab {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem 0.9rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}
.debug-tab:hover { color: var(--text); text-decoration: none; }
.debug-tab.is-active {
    background: var(--bg);
    color: var(--text);
    border-bottom-color: var(--bg);
    box-shadow: inset 0 2px 0 var(--accent);
}
.debug-tab-name { font-weight: 600; }
.debug-tab-meta { font-size: 0.72rem; color: var(--muted); }

/* ── Controls row ──────────────────────────────────────────────────── */
.debug-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    align-items: end;
}
.debug-control { display: flex; flex-direction: column; gap: 0.25rem; }
.debug-control-wide { grid-column: span 2; }
.debug-control-check, .debug-control-actions { justify-content: flex-end; }
.debug-control label { color: var(--muted); font-size: 0.8rem; }
.debug-control select,
.debug-control input[type=number],
.debug-control input[type=text] {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    /* Explicit height + box-sizing so <select> renders the same size as
       <input> across browsers (Chrome/Safari pad selects taller by default). */
    height: 2.4rem;
    box-sizing: border-box;
    padding: 0 0.7rem;
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.2;
    width: 100%;
}
.debug-control select {
    /* Custom caret so we control vertical alignment. */
    appearance: none;
    -webkit-appearance: none;
    padding-right: 1.9rem;
    background-image:
        linear-gradient(45deg,  transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 16px) 50%,
        calc(100% - 11px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}
.debug-control select:focus,
.debug-control input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.18);
}

/* Clear-log form below the control row. */
.debug-clear { margin: -0.5rem 0 1.25rem; text-align: right; }

/* ── Output frame ──────────────────────────────────────────────────── */
.debug-output-wrap {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
}
.debug-output-head {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--panel-2);
}
.debug-output-head h2 { margin: 0; font-size: 0.95rem; }
.debug-count { color: var(--muted); font-size: 0.82rem; }
.debug-meta  { color: var(--muted); font-size: 0.78rem; margin-left: auto; }

.debug-output {
    max-height: 70vh;
    overflow: auto;
    font: 12px/1.55 SFMono-Regular, Menlo, Consolas, monospace;
    background: var(--bg);
}
.debug-line {
    padding: 0.18rem 1rem;
    border-bottom: 1px solid rgba(31, 41, 55, 0.45);
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}
.debug-line:last-child { border-bottom: 0; }
.debug-line-err  { background: rgba(248, 113, 113, 0.07); color: #fca5a5; }
.debug-line-warn { background: rgba(251, 191, 36, 0.06); color: #fcd34d; }
.debug-line-info { color: var(--text); }
.debug-line-dim  { color: var(--muted); }
.debug-empty {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
}

/* ── Syntax tokens ─────────────────────────────────────────────────── */
.dh-ts        { color: #6b7280; }
.dh-lvl       { display: inline-block; padding: 0 .35em; border-radius: 3px; font-weight: 700; font-size: 11px; letter-spacing: .04em; }
.dh-lvl-ERROR, .dh-lvl-FATAL { background: rgba(248, 113, 113, 0.2); color: #fca5a5; }
.dh-lvl-WARNING              { background: rgba(251, 191, 36, 0.18); color: #fcd34d; }
.dh-lvl-INFO                 { background: rgba(6, 182, 212, 0.18);  color: #67e8f9; }
.dh-lvl-DEBUG                { background: rgba(136, 146, 168, 0.18); color: var(--muted); }
.dh-file      { color: var(--accent-2); }
.dh-ln        { color: var(--accent); font-weight: 600; }
.dh-method    { color: var(--accent); font-weight: 700; }
.dh-ip        { color: var(--good); }
.dh-sid       { color: #a78bfa; }
.dh-ms        { color: #fbbf24; }
.dh-status    { display: inline-block; padding: 0 .3em; border-radius: 3px; font-weight: 700; }
.dh-status-ok    { color: var(--good);  background: rgba(52, 211, 153, 0.12); }
.dh-status-redir { color: var(--accent-2); background: rgba(6, 182, 212, 0.12); }
.dh-status-cli   { color: #fcd34d;       background: rgba(251, 191, 36, 0.12); }
.dh-status-srv   { color: var(--bad);   background: rgba(248, 113, 113, 0.14); }
