/* LogViewer widget styles — loaded as a plain static asset, NOT Razor CSS isolation. LogViewer.razor
   only emits a config root (<div class="lv-root">) plus this stylesheet + logviewer.js; the entire
   toolbar/filter-bar/log-area DOM is built by that script at runtime. CSS isolation's b-xxxxx scope
   attribute is only ever applied to Razor-compiled markup, so JS-generated DOM would be completely
   unstyled if this stayed a *.razor.css file — that's why it moved here. Dark terminal-style log
   area, neutral chrome for the toolbar/filter bar. */

.lv-root {
    display: flex;
    flex-direction: column;
    gap: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 0.875rem;
    color: inherit;
}

/* logviewer.js's buildSkeleton() builds the toolbar/filter-bar/log-area markup into a JS-owned
   .lv-shell wrapper (appended once into .lv-root) instead of assigning innerHTML directly onto
   .lv-root -- see the comment in buildSkeleton() for why. .lv-root's flex-column layout above was
   written assuming its markup (.lv-toolbar, .lv-tz-banner, .lv-filter-bar, .lv-statusbar,
   .lv-log-area) were its own direct children; with .lv-shell now the sole direct child, `display:
   contents` removes .lv-shell from the box tree so those elements still lay out as if they were
   direct flex items of .lv-root, unchanged from before the wrapper was introduced. */
.lv-root > .lv-shell {
    display: contents;
}

/* ── Toolbar ─────────────────────────────────────────────────── */
.lv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    flex-wrap: wrap;
}

.lv-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    color: inherit;
}

.lv-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.lv-file-select {
    border: 1px solid rgba(128, 128, 128, 0.35);
    background: transparent;
    color: inherit;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    max-width: 280px;
    cursor: pointer;
}

.lv-filename {
    font-size: 0.78rem;
    opacity: 0.65;
    font-family: ui-monospace, Consolas, monospace;
}

.lv-btn {
    border: 1px solid rgba(128, 128, 128, 0.35);
    background: transparent;
    color: inherit;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.lv-btn:hover {
    background: rgba(128, 128, 128, 0.12);
}

.lv-auto-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
    opacity: 0.8;
}

/* ── Time zone banner ────────────────────────────────────────── */
.lv-tz-banner {
    font-size: 0.72rem;
    opacity: 0.7;
    padding-bottom: 0.6rem;
    font-style: italic;
}

/* ── Filter bar ──────────────────────────────────────────────── */
.lv-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-top: 1px solid rgba(128, 128, 128, 0.2);
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
    flex-wrap: wrap;
}

.lv-level-btns {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.lv-level-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    background: rgba(128, 128, 128, 0.1);
    color: inherit;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.15s;
}

.lv-level-btn:hover {
    background: rgba(128, 128, 128, 0.18);
}

.lv-level-btn.lv-active {
    border-color: rgba(128, 128, 128, 0.4);
    background: rgba(128, 128, 128, 0.18);
}

/* Level-specific button colors */
.lv-level-btn.lv-warn         { color: #b45309; }
.lv-level-btn.lv-error        { color: #b91c1c; }
.lv-level-btn.lv-warn.lv-active  { background: rgba(180,83,9,0.1);  border-color: #b45309; }
.lv-level-btn.lv-error.lv-active { background: rgba(185,28,28,0.1); border-color: #b91c1c; }

.lv-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(128, 128, 128, 0.2);
    border-radius: 999px;
    padding: 0.05rem 0.38rem;
    line-height: 1.4;
}

/* Text filter fields */
.lv-text-filters {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    flex-wrap: wrap;
    min-width: 0;
}

.lv-filter-field {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 160px;
}

.lv-filter-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.55;
    white-space: nowrap;
    cursor: help;
    flex-shrink: 0;
}

.lv-filter-input {
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(128, 128, 128, 0.3);
    background: transparent;
    color: inherit;
    padding: 0.28rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.lv-filter-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}

/* ── Status bar ──────────────────────────────────────────────── */
.lv-statusbar {
    font-size: 0.75rem;
    opacity: 0.6;
    padding: 0.3rem 0 0.4rem;
    min-height: 1.4em;
}

.lv-error-text {
    color: #b91c1c;
    opacity: 1;
}

.lv-muted {
    opacity: 0.7;
}

/* ── Log area ────────────────────────────────────────────────── */
.lv-log-area {
    overflow-y: auto;
    max-height: 68vh;
    min-height: 200px;
    background: #13131f;
    border-radius: 6px;
    border: 1px solid rgba(128, 128, 128, 0.2);
    font-family: ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, monospace;
    font-size: 0.775rem;
    line-height: 1.55;
}

.lv-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: rgba(200, 200, 220, 0.3);
    font-family: system-ui, sans-serif;
}

/* ── Log entries ─────────────────────────────────────────────── */
.lv-entry {
    display: grid;
    grid-template-columns: 1.4rem 1fr;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.08s;
}

.lv-entry:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lv-entry.lv-selected {
    background: rgba(99, 102, 241, 0.22) !important;
    outline: 1px solid rgba(99, 102, 241, 0.45);
}

.lv-level-mark {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0.28rem 0 0;
    font-weight: 800;
    font-size: 0.65rem;
    border-right: 2px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    opacity: 0.8;
}

.lv-text {
    padding: 0.28rem 0.65rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: rgba(210, 210, 230, 0.82);
}

/* Level-specific entry colors (dark background palette) */
.lv-entry.lv-level-info .lv-level-mark { color: #60a5fa; border-right-color: rgba(37, 99, 235, 0.5); }
.lv-entry.lv-level-info .lv-text       { color: rgba(210, 210, 232, 0.82); }

.lv-entry.lv-level-warn .lv-level-mark { color: #fbbf24; border-right-color: rgba(180, 83, 9, 0.6); }
.lv-entry.lv-level-warn .lv-text       { color: #fde68a; }

.lv-entry.lv-level-error .lv-level-mark { color: #f87171; border-right-color: rgba(185, 28, 28, 0.6); }
.lv-entry.lv-level-error .lv-text       { color: #fca5a5; }

.lv-entry.lv-level-debug .lv-level-mark { color: rgba(148, 148, 200, 0.5); border-right-color: rgba(80, 80, 130, 0.3); }
.lv-entry.lv-level-debug .lv-text       { color: rgba(180, 180, 210, 0.45); }

.lv-entry.lv-level-trace .lv-level-mark { color: rgba(120, 120, 170, 0.35); border-right-color: rgba(60, 60, 100, 0.25); }
.lv-entry.lv-level-trace .lv-text       { color: rgba(160, 160, 195, 0.35); }
