/* =================================================================
   style.css – Gemeinsame Styles, Dark/Light Theme
   ================================================================= */

/* --- Themes --- */
:root, [data-theme="dark"] {
    --bg: #0b0f1a; --panel: #131829; --border: #252d48;
    --text: #cdd6ec; --dim: #6b7da0; --accent: #3d8bfd; --gz: #ff5533;
    --input-bg: var(--bg);
    --diagram-bg: #080c18;
    --sun-text: #000;
    --sun-fill: #ffe066;
    --toggle-on-mix: color-mix(in srgb, var(--c) 12%, var(--bg));
    --best-bg: color-mix(in srgb, var(--accent) 6%, transparent);
    --border-dim: color-mix(in srgb, var(--border) 40%, transparent);
}
[data-theme="light"] {
    --bg: #f0f2f5; --panel: #ffffff; --border: #d0d5dd;
    --text: #1a1a2e; --dim: #5a6478; --accent: #1a6ddb; --gz: #d93025;
    --input-bg: #fff;
    --diagram-bg: #e8ecf2;
    --sun-text: #000;
    --sun-fill: #ffcc00;
    --toggle-on-mix: color-mix(in srgb, var(--c) 10%, #fff);
    --best-bg: color-mix(in srgb, var(--accent) 8%, transparent);
    --border-dim: color-mix(in srgb, var(--border) 40%, transparent);
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, Helvetica, Arial, sans-serif;
    background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5;
}

/* --- Navigation --- */
nav.topnav {
    display: flex; align-items: center; gap: 0;
    border-bottom: 1px solid var(--border); background: var(--panel);
}
nav.topnav a {
    padding: 0.55rem 1.2rem; color: var(--dim); text-decoration: none;
    font-size: 0.85rem; border-bottom: 2px solid transparent; transition: all 0.15s;
}
nav.topnav a:hover { color: var(--text); }
nav.topnav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-spacer { flex: 1; }
.nav-controls {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0 0.8rem; font-size: 0.8rem;
}
.nav-controls select {
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
    padding: 0.2rem 0.4rem; border-radius: 3px; font-size: 0.78rem;
    cursor: pointer;
}
.nav-controls select:focus { border-color: var(--accent); outline: none; }
.theme-btn {
    background: none; border: 1px solid var(--border); color: var(--dim);
    height: 28px; border-radius: 4px; cursor: pointer; padding: 0 8px;
    display: flex; align-items: center; gap: 4px;
    font-size: 0.85rem; transition: all 0.15s;
}
.theme-btn .theme-icon { font-size: 1rem; }
.theme-btn .theme-text { font-size: 0.75rem; }
.theme-btn:hover { color: var(--text); border-color: var(--accent); }

/* --- Header --- */
header { text-align: center; padding: 0.7rem 1rem 0.5rem; }
header h1 { font-size: 1.2rem; font-weight: 600; color: var(--accent); }
header p  { font-size: 0.75rem; color: var(--dim); margin-top: 0.1rem; }

/* --- Layout --- */
.main { max-width: 1400px; margin: 0 auto; padding: 0.8rem; }
.main.wide { max-width: 1500px; }
.controls-bar {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.8rem 1rem; margin-bottom: 0.8rem;
}
.row { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: flex-end; margin-bottom: 0.55rem; }
.row:last-child { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 0.2rem; }
.field label {
    font-size: 0.7rem; color: var(--dim);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.field input, .field select {
    background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
    padding: 0.35rem 0.55rem; border-radius: 4px; font-size: 0.88rem;
    font-family: 'SF Mono','Fira Code','Consolas', monospace;
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.field input[type=number] { width: 100px; }

/* --- Checkbox --- */
.check-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--dim); cursor: pointer; }
.check-label input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* --- Order cell --- */
.order-cell { font-family: 'SF Mono','Fira Code','Consolas', monospace; font-size: 0.82rem; white-space: nowrap; letter-spacing: 0.02em; }

/* --- Date link (klickbare Konjunktions-Daten) --- */
.date-link { cursor: pointer; text-decoration: underline dotted; text-decoration-color: var(--dim); }
.date-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* --- Animation bar --- */
.anim-bar { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.abtn {
    padding: 0.32rem 0.55rem; background: var(--bg); color: var(--dim); border: none;
    border-right: 1px solid var(--border); cursor: pointer; font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}
.abtn:last-child { border-right: none; }
.abtn:hover { color: var(--text); }
.abtn.active { background: var(--accent); color: #fff; }

/* --- Buttons --- */
.btn {
    padding: 0.38rem 0.9rem; background: var(--accent); color: #fff; border: none;
    border-radius: 4px; cursor: pointer; font-size: 0.85rem; white-space: nowrap;
}
.btn:hover { opacity: 0.85; }
.btn.cancel { background: #c0392b; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Calendar info --- */
.cal-info {
    display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem;
    font-family: 'SF Mono','Fira Code','Consolas', monospace;
    font-size: 0.82rem; color: var(--dim);
}
.cal-info span { white-space: nowrap; }
.cal-info .lbl { color: var(--dim); }
.cal-info .val { color: var(--text); }

/* --- Toggles --- */
.toggles { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.toggle {
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.25rem 0.55rem; border-radius: 4px;
    border: 1px solid var(--border); background: var(--bg);
    color: var(--text); cursor: pointer; font-size: 0.82rem;
    user-select: none; transition: border-color 0.2s, background 0.2s;
}
.toggle.on { border-color: var(--c); background: var(--toggle-on-mix); }
.toggle .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

/* --- Unit bar --- */
.unit-bar { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.ubtn {
    padding: 0.32rem 0.7rem; background: var(--bg); color: var(--dim); border: none;
    border-right: 1px solid var(--border); cursor: pointer; font-size: 0.82rem;
    transition: background 0.15s, color 0.15s;
}
.ubtn:last-child { border-right: none; }
.ubtn.on { background: var(--accent); color: #fff; }

/* --- Panels --- */
.panel {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.8rem 1rem;
}
.panel h2 { font-size: 0.95rem; font-weight: 500; color: var(--accent); margin-bottom: 0.6rem; }

/* --- Content grid (Positionen) --- */
.content { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.diagram-wrap { display: flex; justify-content: center; align-items: center; }
#diagram { width: 100%; max-width: 600px; }

/* --- Datentabelle --- */
.dtable { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.dtable th {
    text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border);
    color: var(--dim); font-weight: 500; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.dtable td {
    padding: 0.38rem 0.5rem;
    border-bottom: 1px solid var(--border-dim);
    font-family: 'SF Mono','Fira Code','Consolas', monospace;
}
.dtable .pname { display: flex; align-items: center; gap: 0.35rem; font-family: inherit; }
.dtable .cdot  { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.moon-row td   { color: var(--dim); font-size: 0.78rem; padding-left: 1.6rem; }
.accuracy-note {
    margin-top: 0.6rem; font-size: 0.72rem; color: var(--dim);
    border-top: 1px solid var(--border); padding-top: 0.5rem;
}

/* --- Progress --- */
.progress-wrap {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.7rem 1rem; margin-bottom: 0.8rem;
    display: flex; align-items: center; gap: 0.8rem;
}
.progress-bar { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s; border-radius: 3px; }
.progress-text { font-size: 0.8rem; color: var(--dim); white-space: nowrap; min-width: 180px; }

/* --- Ergebnis-Tabelle (Konjunktionen) --- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rtable { width: 100%; border-collapse: collapse; font-size: 0.78rem; white-space: nowrap; }
.rtable th {
    text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border);
    color: var(--dim); font-weight: 500; font-size: 0.68rem;
    text-transform: uppercase; letter-spacing: 0.03em;
    position: sticky; top: 0; background: var(--panel);
}
.rtable td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border-dim);
    font-family: 'SF Mono','Fira Code','Consolas', monospace;
}
.rtable .date-cell { white-space: pre-line; font-size: 0.74rem; line-height: 1.35; min-width: 200px; }
.rtable .dev-cell { text-align: right; }
.rtable .mean-cell { text-align: right; font-weight: 600; color: var(--accent); }
.rtable .best-row td { background: var(--best-bg); }
.rtable .now-marker td { border-top: 2px solid var(--gz); }
.no-results { padding: 2rem; text-align: center; color: var(--dim); font-size: 0.9rem; }
.info-note {
    font-size: 0.72rem; color: var(--dim); margin-top: 0.5rem;
    border-top: 1px solid var(--border); padding-top: 0.4rem;
}

/* --- Responsive --- */
@media (max-width: 860px) {
    .content { grid-template-columns: 1fr; }
    .row { flex-direction: column; align-items: stretch; }
    .field input, .field select { width: 100%; }
    .field input[type=number] { width: 100%; }
    .nav-controls { padding: 0 0.4rem; gap: 0.3rem; }
}
