/* ============================================================
   tracedoku – Stylesheet
   Identität: PowerShell-Blau, Datenzeilen in Mono, helles UI.
   Zielauflösungen: Full-HD primär, WQHD komfortabel.
   ============================================================ */

:root {
    --ps-blue:   #012456;   /* PowerShell-Fensterblau */
    --ps-blue-2: #0A3A7A;
    --paper:     #F3F5F8;
    --panel:     #FFFFFF;
    --ink:       #16273B;
    --muted:     #64748B;
    --line:      #D9E0E8;
    --accent:    #0A6ED1;

    --lat-good:  #2E9E5B;   /* <= 20 ms  */
    --lat-mid:   #C88A12;   /* <= 60 ms  */
    --lat-high:  #C4453C;   /*  > 60 ms  */
    --lat-none:  #8A94A0;   /* Timeout   */

    --mono: Consolas, "Cascadia Mono", "Cascadia Code", "Courier New", monospace;
    --sans: "Segoe UI", system-ui, -apple-system, sans-serif;

    --radius: 8px;
    --content-max: 2000px;  /* nutzt WQHD aus, wirkt auf Full-HD nicht verloren */
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--sans);
    font-size: 15px;
    color: var(--ink);
    background: var(--paper);
}

/* ---------- Kopfleiste ---------- */

.topbar {
    background: var(--ps-blue);
    color: #E8EEF7;
    border-bottom: 3px solid var(--ps-blue-2);
}

.topbar-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.brand {
    font-family: var(--mono);
    font-size: 20px;
    font-weight: 400;
    margin: 14px 0;
    letter-spacing: 0.02em;
}

.brand .prompt { color: #FFD34D; }

.brand .cursor {
    display: inline-block;
    width: 9px;
    height: 1.1em;
    margin-left: 4px;
    vertical-align: text-bottom;
    background: #E8EEF7;
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .brand .cursor { animation: none; }
}

.tabs { display: flex; gap: 4px; }

.tab {
    font-family: var(--sans);
    font-size: 15px;
    color: #C7D3E4;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 18px 18px 15px;
    cursor: pointer;
}

.tab:hover { color: #FFFFFF; }

.tab.active {
    color: #FFFFFF;
    border-bottom-color: #FFD34D;
}

.tab:focus-visible, .btn:focus-visible, button:focus-visible {
    outline: 2px solid #FFD34D;
    outline-offset: 2px;
}

/* ---------- Grundlayout ---------- */

.content {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 24px 28px 60px;
}

.view.is-hidden, .is-hidden { display: none !important; }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.panel h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px;
}

.hint { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.muted { color: var(--muted); }

code {
    font-family: var(--mono);
    background: #EDF1F6;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.92em;
}

/* ---------- Erfassen ---------- */

.grid-erfassen {
    display: grid;
    grid-template-columns: minmax(480px, 1fr) minmax(480px, 1fr);
    gap: 20px;
    align-items: start;
}

@media (max-width: 1100px) {
    .grid-erfassen { grid-template-columns: 1fr; }
}

#raw-input {
    width: 100%;
    min-height: 320px;
    resize: vertical;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.5;
    color: #DCE6F2;
    background: var(--ps-blue);
    border: 1px solid var(--ps-blue-2);
    border-radius: var(--radius);
    padding: 12px 14px;
}

#raw-input::placeholder { color: #6B84AB; }

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.form-row label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: var(--muted);
    flex: 1 1 200px;
}

.form-row label.wide { flex: 1 1 100%; }

input[type="text"], input[type="datetime-local"], select, textarea {
    font-family: var(--sans);
    font-size: 14.5px;
    color: var(--ink);
    background: #FFFFFF;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(10, 110, 209, 0.15);
}

#target-hostname, #target-ip { font-family: var(--mono); font-size: 13.5px; }

.form-actions {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.btn {
    font-size: 14.5px;
    padding: 9px 18px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #FFFFFF;
    color: var(--ink);
    cursor: pointer;
}

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #FFFFFF;
}

.btn.primary:disabled {
    background: #9DB8D6;
    border-color: #9DB8D6;
    cursor: not-allowed;
}

.btn.danger { color: var(--lat-high); border-color: var(--lat-high); }

.status { font-size: 13.5px; }
.status.ok  { color: var(--lat-good); }
.status.err { color: var(--lat-high); }

.parse-summary {
    font-size: 14px;
    margin-bottom: 10px;
}

.parse-summary strong { font-family: var(--mono); font-weight: 600; }

/* ---------- Tabellen ---------- */

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    margin-top: 8px;
}

table.data th {
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 10px;
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}

table.data td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

table.data td.mono, table.data th.mono { font-family: var(--mono); font-size: 13px; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: #F0F5FB; }

.rtt { font-family: var(--mono); }
.rtt.good { color: var(--lat-good); }
.rtt.mid  { color: var(--lat-mid); }
.rtt.high { color: var(--lat-high); font-weight: 600; }
.rtt.none { color: var(--lat-none); }

.badge {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    white-space: nowrap;
}

.badge.ok  { color: var(--lat-good); border-color: var(--lat-good); }
.badge.err { color: var(--lat-high); border-color: var(--lat-high); }

.provider-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: baseline;
}

/* ---------- Filterleiste ---------- */

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: var(--muted);
}

.filter-bar select { min-width: 220px; }
.filter-bar .muted { padding-bottom: 9px; font-size: 13px; }

/* ---------- Routenpfad (Signatur) ---------- */

.route-path {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin: 14px 0 6px;
    padding: 14px 10px;
    background: #F7F9FC;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.route-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 52px;
}

.route-node .dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 0 1px var(--line);
}

.route-node .lbl {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
}

.route-link {
    height: 3px;
    flex: 1 1 22px;
    min-width: 22px;
    background: var(--line);
    margin: 0 -2px 18px;
}

/* ---------- Detailansicht ---------- */

.detail-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.detail-head h2 { margin: 0; }

.detail-meta { color: var(--muted); font-size: 13.5px; }

.raw-block {
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.5;
    color: #DCE6F2;
    background: var(--ps-blue);
    border-radius: var(--radius);
    padding: 12px 14px;
    overflow-x: auto;
    white-space: pre;
}

details.raw-details { margin-top: 14px; }
details.raw-details summary { cursor: pointer; color: var(--accent); font-size: 13.5px; }

/* ---------- Vergleich ---------- */

.compare-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.compare-picker .pick {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
}

.compare-picker .pick:hover { background: #F0F5FB; }
.compare-picker .pick .when { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

.chart-wrap { overflow-x: auto; }

.chart-wrap svg { display: block; width: 100%; height: auto; min-width: 700px; }

.legend {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    font-size: 13.5px;
    margin: 8px 0 4px;
}

.legend .item { display: flex; align-items: center; gap: 7px; }

.legend .swatch { width: 18px; height: 4px; border-radius: 2px; }

.compare-table-wrap { overflow-x: auto; }

td.cell-host {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Kleinkram ---------- */

.empty {
    color: var(--muted);
    font-size: 14px;
    padding: 26px 0;
    text-align: center;
}
