/* =========================================================
   N-JOY – style.css
   Themes: light (warm hell), dark (warm dunkel).
   Token-Namen wie bei Weedbook, damit man zwischen den
   Projekten springen kann, ohne sich neu zu orientieren.
========================================================= */

/* =========================================================
   THEME TOKENS
========================================================= */
:root,
[data-theme="light"] {
    --bg: #f6f2ea;
    --bg-2: #efe8db;
    --surface: #ffffff;
    --surface-2: #faf7f0;
    --text: #2b2620;
    --text-soft: #4a4238;
    --text-muted: #77695a;
    --line: rgba(43, 38, 32, 0.12);
    --line-strong: rgba(43, 38, 32, 0.22);

    --accent: #b4562a;           /* warmes Holz/Bernstein — Gitarrenkorpus */
    --accent-strong: #93441f;
    --accent-soft: rgba(180, 86, 42, 0.14);
    --accent-2: #3c6e71;         /* Petrol als zweite Farbe */
    --accent-2-soft: rgba(60, 110, 113, 0.16);
    --ok: #3f7d3a;
    --ok-soft: rgba(63, 125, 58, 0.14);
    --danger: #b23a3a;
    --danger-soft: rgba(178, 58, 58, 0.12);
    --warn: #b9840a;
    --warn-soft: rgba(185, 132, 10, 0.14);

    --font-body: "Segoe UI", system-ui, -apple-system, Verdana, sans-serif;
    --font-zahl: "Segoe UI", system-ui, -apple-system, sans-serif;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 6px 16px rgba(43, 38, 32, 0.08);
    --shadow-md: 0 14px 32px rgba(43, 38, 32, 0.10);
}

[data-theme="dark"] {
    --bg: #17151a;
    --bg-2: #1d1a20;
    --surface: #221f26;
    --surface-2: #29252e;
    --text: #ece6dd;
    --text-soft: #d2cbc0;
    --text-muted: #a1978a;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);

    --accent: #e0834f;
    --accent-strong: #c86c3a;
    --accent-soft: rgba(224, 131, 79, 0.18);
    --accent-2: #6fb0b3;
    --accent-2-soft: rgba(111, 176, 179, 0.18);
    --ok: #63b356;
    --ok-soft: rgba(99, 179, 86, 0.16);
    --danger: #e07474;
    --danger-soft: rgba(224, 116, 116, 0.14);
    --warn: #e0b84a;
    --warn-soft: rgba(224, 184, 74, 0.14);

    --shadow-sm: 0 6px 16px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.36);
}

/* =========================================================
   GRUNDLAGEN
========================================================= */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; margin-top: 14px; }
p { margin: 0 0 10px; }
code { font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
ul, ol { margin: 0; padding-left: 20px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sprung-link {
    position: absolute; left: -9999px; top: 8px; z-index: 100;
    background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 10px;
}
.sprung-link:focus { left: 8px; }

/* =========================================================
   LAYOUT — Seitenleiste am Schreibtisch, Leiste unten am Handy
========================================================= */
.app-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.haupt-nav {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; gap: 4px;
    padding: 20px 12px;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.marke { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.marke-zeichen { font-size: 28px; }
.marke-text h1 { font-size: 1.2rem; }
.marke-text p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.marke-build { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); }

.nav-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px; border: none; border-radius: var(--radius-md);
    background: transparent; color: var(--text-soft); text-align: left; font-weight: 600;
}
.nav-btn:hover { background: var(--surface-2); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.nav-icon { font-size: 1.2rem; width: 26px; text-align: center; }

.inhalt { padding: 24px clamp(14px, 3vw, 36px) 40px; max-width: 1180px; width: 100%; }

.view-kopf {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
    margin-bottom: 18px;
}
.untertitel { color: var(--text-muted); margin: 4px 0 0; }

@media (max-width: 860px) {
    .app-layout { grid-template-columns: 1fr; }
    .haupt-nav {
        position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 20;
        flex-direction: row; justify-content: space-around; gap: 0;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        border-right: none; border-top: 1px solid var(--line);
    }
    .marke { display: none; }
    .nav-btn { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 0.7rem; min-width: 56px; }
    .nav-icon { width: auto; }
    .inhalt { padding-bottom: 96px; }
    .view-kopf h2 { font-size: 1.35rem; }
}

/* =========================================================
   KARTEN
========================================================= */
.karten-raster {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.karte {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-lg); padding: 18px 18px 16px;
    box-shadow: var(--shadow-sm);
}
.karte-breit { grid-column: 1 / -1; }
.karte-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

.pille {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent-strong); font-size: 0.8rem; font-weight: 700;
}
.pille.ok { background: var(--ok-soft); color: var(--ok); }
.pille.laeuft { background: var(--ok-soft); color: var(--ok); }
.hinweis-klein { color: var(--text-muted); font-size: 0.85rem; margin: 8px 0 0; }
.regeln ol, .regeln ul { color: var(--text-soft); font-size: 0.92rem; }
.regeln li { margin-bottom: 5px; }

/* =========================================================
   KNÖPFE UND FELDER
========================================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--text); font-weight: 600; min-height: 42px;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primaer { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primaer:hover { background: var(--accent-strong); }
.btn-gefahr { color: var(--danger); border-color: var(--danger); }
.btn-gefahr:hover { background: var(--danger-soft); }
.btn-klein { padding: 6px 12px; min-height: 34px; font-size: 0.85rem; }
.btn-gross { padding: 14px 24px; font-size: 1.05rem; min-height: 52px; }
.btn-datei { cursor: pointer; }
.btn.aktiv { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.knopfzeile { display: flex; flex-wrap: wrap; gap: 8px; }

input[type="text"], input[type="number"], input[type="date"], select {
    width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--text); min-height: 42px;
}
input:focus-visible, select:focus-visible { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--text-soft); font-weight: 600; }
.feld-inline { flex-direction: row; align-items: center; gap: 8px; }
.feld-inline select { width: auto; }
.schalter { flex-direction: row; align-items: center; gap: 8px; }
.schalter input { width: 20px; height: 20px; }

/* =========================================================
   HEUTE
========================================================= */
.wochenziel { font-weight: 600; color: var(--accent-2); margin-bottom: 10px; }
.wochenziel.leer { color: var(--text-muted); font-weight: 400; font-style: italic; }

.block-liste { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.block {
    display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
    padding: 10px 12px; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line);
}
.block.erledigt { background: var(--ok-soft); border-color: transparent; }
.block-haken {
    width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--line-strong);
    background: var(--surface); font-size: 1.2rem; display: grid; place-items: center;
}
.block.erledigt .block-haken { background: var(--ok); border-color: var(--ok); color: #fff; }
.block-text strong { display: block; }
.block-text span { font-size: 0.85rem; color: var(--text-muted); }
.block-knoepfe { display: flex; gap: 6px; }
@media (max-width: 600px) {
    .block { grid-template-columns: auto 1fr; }
    .block-knoepfe { grid-column: 2; }
}

.wochenleiste { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 90px; margin-top: 4px; }
.tag-saeule { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.tag-balken { width: 100%; border-radius: 6px 6px 3px 3px; background: var(--accent-2-soft); min-height: 3px; transition: height .2s; }
.tag-saeule.heute .tag-balken { background: var(--accent); }
.tag-saeule.geuebt .tag-balken { background: var(--accent-2); }
.tag-saeule.heute.geuebt .tag-balken { background: var(--accent); }
.tag-name { font-size: 0.7rem; color: var(--text-muted); }
.tag-saeule.heute .tag-name { color: var(--accent-strong); font-weight: 700; }

.bestwerte { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bestwerte li { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.bestwerte li:last-child { border-bottom: none; }
.bestwerte .wert { font-weight: 800; font-size: 1.15rem; color: var(--accent-strong); }
.bestwerte .datum { font-size: 0.8rem; color: var(--text-muted); margin-left: 6px; }
.leer-hinweis { color: var(--text-muted); font-style: italic; font-size: 0.9rem; }

.session-liste { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.session {
    display: grid; grid-template-columns: 62px 1fr auto; gap: 10px; align-items: center;
    padding: 8px 10px; border-radius: 10px; background: var(--surface-2);
}
.session-datum { font-weight: 700; color: var(--text-soft); }
.session-text { font-size: 0.92rem; }
.session-text .notiz { color: var(--text-muted); }
.session-werte { display: flex; gap: 6px; flex-wrap: wrap; }
.session-werte span { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-size: 0.8rem; }

/* =========================================================
   METRONOM
========================================================= */
.metronom-anzeige { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 10px; }
.tempo-btn {
    width: 56px; height: 56px; border-radius: 16px; border: 1px solid var(--line-strong);
    background: var(--surface-2); font-weight: 700; font-size: 1.05rem;
}
.tempo-btn.klein { width: 44px; height: 44px; font-size: 0.9rem; }
.tempo-btn:hover { background: var(--accent-soft); }
.bpm-wert { display: flex; flex-direction: column; align-items: center; min-width: 130px; }
.bpm-wert output { font-family: var(--font-zahl); font-size: 3.4rem; font-weight: 800; line-height: 1; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.bpm-wert span { font-size: 0.85rem; color: var(--text-muted); }

input[type="range"] { width: 100%; accent-color: var(--accent); margin: 4px 0 12px; }

.schlag-punkte { display: flex; justify-content: center; gap: 12px; height: 26px; margin-bottom: 14px; }
.schlag-punkt { width: 18px; height: 18px; border-radius: 50%; background: var(--line-strong); transition: transform .06s, background .06s; }
.schlag-punkt.betont { width: 22px; height: 22px; }
.schlag-punkt.an { background: var(--accent); transform: scale(1.35); }
.schlag-punkt.betont.an { background: var(--accent-2); }

.metronom-steuerung { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.profile { display: flex; flex-direction: column; gap: 6px; }
.profil-knoepfe { display: flex; flex-wrap: wrap; gap: 6px; }

/* =========================================================
   WECHSEL-TIMER
========================================================= */
.timer-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.anker-hinweis { font-size: 0.85rem; color: var(--accent-2); }
.tipp-flaeche {
    width: 100%; min-height: 200px; border-radius: var(--radius-lg);
    border: 3px dashed var(--line-strong); background: var(--surface-2);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    user-select: none; touch-action: manipulation;
}
.tipp-flaeche.aktiv { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.tipp-flaeche:active { transform: scale(0.99); }
.tipp-zahl { font-family: var(--font-zahl); font-size: 5rem; font-weight: 800; line-height: 1; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.tipp-text { color: var(--text-muted); font-size: 0.9rem; padding: 0 20px; text-align: center; }
.timer-steuerung { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.timer-ergebnis { padding: 12px 14px; border-radius: var(--radius-md); background: var(--ok-soft); margin-bottom: 8px; }
.timer-ergebnis strong { font-size: 1.4rem; }
.timer-ergebnis .btn { margin-top: 8px; }

/* =========================================================
   SONGS
========================================================= */
.song-liste { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.song {
    display: flex; justify-content: space-between; gap: 10px; align-items: center;
    padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
}
.song-titel { font-weight: 700; }
.song-meta { font-size: 0.82rem; color: var(--text-muted); }
.song-akkorde { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.song-akkorde span { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 0.8rem; font-weight: 600; }
.eignung { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 4px; }
.eignung li { background: var(--warn-soft); color: var(--text-soft); border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; }

/* =========================================================
   FORTSCHRITT
========================================================= */
.verlauf { display: flex; gap: 6px; align-items: flex-end; height: 160px; overflow-x: auto; padding-bottom: 4px; }
.verlauf-saeule { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-width: 34px; height: 100%; }
.verlauf-balken { width: 100%; background: var(--accent-2); border-radius: 6px 6px 2px 2px; position: relative; min-height: 3px; }
.verlauf-balken.best { background: var(--accent); }
.verlauf-wert { font-size: 0.75rem; font-weight: 700; }
.verlauf-datum { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }
.verlauf-ziel { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--ok); }
.monatsliste { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.monatsliste li strong { display: block; }
.monatsliste li span { color: var(--text-soft); font-size: 0.92rem; }

/* =========================================================
   MEHR
========================================================= */
.stammdaten { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 0.92rem; }
.stammdaten dt { color: var(--text-muted); }
.stammdaten dd { margin: 0; font-weight: 600; }

/* =========================================================
   DIALOGE
========================================================= */
.dialog {
    border: none; border-radius: var(--radius-lg); padding: 0;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-md);
    width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
}
.dialog::backdrop { background: rgba(20, 15, 10, 0.5); }
.formular { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 12px; }
.feld-raster { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.feld-breit { grid-column: 1 / -1; }
@media (max-width: 480px) { .feld-raster { grid-template-columns: 1fr; } }
.dialog-knoepfe { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.dehner { flex: 1; }

.block-editor { display: flex; flex-direction: column; gap: 8px; }
.block-zeile { display: grid; grid-template-columns: 1.4fr 0.7fr 0.7fr auto; gap: 8px; align-items: end; }
.block-zeile label { font-size: 0.75rem; }
.block-zeile .btn { min-height: 42px; }

/* =========================================================
   TOAST
========================================================= */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
    box-shadow: var(--shadow-md); font-weight: 600; z-index: 50; max-width: calc(100vw - 32px);
}
@media (max-width: 860px) { .toast { bottom: 96px; } }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
