/*
 * Gemeinsame Komponenten. Werte 1:1 aus design/reference/*.html. Klassen, die
 * sich zwischen den Seiten unterscheiden (.tok, .chip, .banner, .field in
 * Rewards, ...), setzt die jeweilige Seite in ihrem eigenen <style>.
 */

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; }

/* --- Buttons (wie der gerenderte DS-Button in reference/) --------------- */
.btn {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; line-height: 1;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 12px 22px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--ink);
  display: inline-flex; align-items: center; gap: 10px;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
  text-decoration: none; white-space: nowrap;
  background: var(--ink); color: var(--bg);
}
.btn:hover { background: var(--olive); border-color: var(--olive); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--olive); border-color: var(--olive); color: #0A0F06; }
.btn-primary:hover { background: var(--olive-deep); border-color: var(--olive-deep); color: #0A0F06; }
.btn-ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn-copper { background: var(--copper); border-color: var(--copper); color: #fff; }
.btn-copper:hover { background: var(--copper-deep); border-color: var(--copper-deep); color: #fff; }
.btn-tiny { font-size: 11px; padding: 7px 12px; gap: 6px; }
/* Mit Pfeil: rechts weniger Innenabstand, der Pfeil ist ein eigenes Element. */
.btn.has-arrow { padding-right: 14px; }
.btn-tiny.has-arrow { padding-right: 8px; }
.btn .arrow { font-size: 14px; transition: transform .15s; }
.btn:hover .arrow { transform: translateX(3px); }

/* --- Navigation ---------------------------------------------------------- */
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 4px; color: var(--ink-soft); text-decoration: none; font-size: 15px; transition: background-color .15s, color .15s; }
.nav-item:hover { background: var(--paper); color: var(--ink); }
.nav-item.is-active { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.nav-num { font-family: var(--font-mono); font-size: 11px; color: var(--mute); width: 18px; }
.is-active .nav-num { color: var(--olive); }
.nav-badge { font-family: var(--font-mono); font-size: 11px; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--copper); color: #140C04; display: inline-flex; align-items: center; justify-content: center; }

/* --- Seitenleiste fest auf Bildschirmhöhe, Navigation scrollt selbst ----- */
/* Nicht in der Vorlage: dort scrollt die Leiste mit, und auf kleinen
   Bildschirmen fielen die unteren Einträge unbemerkt aus dem Bild. */
@media (min-width: 821px) {
  #sidebar { position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow: hidden; }
}
.nav-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.nav-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.nav-more {
  position: absolute; left: 0; right: 0; bottom: 0; height: 56px; pointer-events: none;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px;
  background: linear-gradient(to bottom, transparent, var(--bg-soft) 70%);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--olive);
  transition: opacity .15s;
}
.nav-more[data-hidden="true"] { opacity: 0; }
.nav-more button { pointer-events: auto; background: transparent; border: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; padding: 4px 8px; }
.nav-more button:hover { color: var(--ink); }

/* System-Block eingeklappt: eine Zeile, aufklappbar. */
.sys-toggle { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 24px; }
.sys-toggle:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; border-radius: 2px; }
.sys-toggle .chev { font-family: var(--font-mono); font-size: 11px; color: var(--mute); transition: transform .15s; }
.sys-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }

/* --- System-Block -------------------------------------------------------- */
.health { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.health li { display: flex; align-items: center; gap: 8px; }
.health .hv { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--mute); }

/* --- Punkte -------------------------------------------------------------- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--olive); flex: none; box-shadow: 0 0 0 3px rgba(122,184,48,.16); }
.dot.warn { background: var(--copper); box-shadow: 0 0 0 3px rgba(200,136,64,.2); }
.dot.err { background: var(--err); box-shadow: 0 0 0 3px rgba(232,116,108,.22); }
.dot.busy { background: var(--yellow); box-shadow: 0 0 0 3px rgba(255,234,117,.2); animation: pulse 1s ease-in-out infinite; }
.dot.off { background: var(--mute); box-shadow: none; }
@keyframes pulse { 50% { opacity: .35; } }

/* --- Felder, Sprache, Schalter ------------------------------------------ */
.field { width: 100%; min-height: 40px; padding: 8px 12px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; font-family: var(--font-sans); font-size: 14px; }
.field:focus { outline: none; border-color: var(--olive); box-shadow: 0 0 0 3px rgba(122,184,48,.16); }
.field::placeholder { color: var(--mute); }
textarea.field { resize: vertical; line-height: 1.5; }
.lbl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink); }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.lang button { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; height: 28px; padding: 0 10px; border: 0; background: transparent; color: var(--mute); cursor: pointer; }
.lang button.on { background: var(--ink); color: var(--bg); }
.switch { appearance: none; -webkit-appearance: none; margin: 0; width: 40px; height: 22px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background-color .15s; }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-soft); transition: transform .15s, background-color .15s; }
.switch:checked { background: var(--olive); }
.switch:checked::before { transform: translateX(18px); background: #0A0F06; }
.switch:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
.switch:disabled { opacity: .45; cursor: not-allowed; }

/* --- Tags (Event-Typen) -------------------------------------------------- */
.tag { display: inline-block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 4px; border: 1px solid currentColor; white-space: nowrap; }
.tag-cmd { color: var(--olive); }
.tag-redeem { color: var(--sage-light); }
.tag-raid { color: var(--copper); }
.tag-overlay { color: var(--yellow); }
.tag-auto { color: var(--ink-soft); }
.tag-sys { color: var(--mute); border-color: var(--line); }

/* --- Symbolknopf --------------------------------------------------------- */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink-soft); cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--ink-soft); }
.icon-btn.danger:hover { color: #E8746C; border-color: #E8746C; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }

/* --- Banner -------------------------------------------------------------- */
.banner { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: center; padding: 16px 20px; border-radius: 4px; border: 1px solid; }
.banner.err { background: rgba(232,116,108,.1); border-color: var(--err); }
.banner.warn { background: var(--cream); border-color: rgba(200,136,64,.5); }
.banner.busy { background: rgba(255,234,117,.07); border-color: rgba(255,234,117,.45); }
.banner.ok { background: rgba(122,184,48,.08); border-color: rgba(122,184,48,.45); }
.bicon { flex: none; width: 36px; height: 36px; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.err .bicon { background: var(--err); color: #1A0806; }
.warn .bicon { background: var(--copper); color: #140C04; }
.busy .bicon { background: var(--yellow); color: #1A1806; }
.ok .bicon { background: var(--olive); color: #0A0F06; }

/* --- Leerer Zustand (Zustaende.html) ------------------------------------ */
.empty { padding: 28px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; border-style: dashed; }

/* --- Zeilen mit Hover ---------------------------------------------------- */
.row { transition: background-color .15s; }
.row:hover { background: var(--bg-soft); }

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

/* "Bug melden": Knopf in der Seitenleiste und Dialog (bugReport.js). */
.bug-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px;
  background: transparent; border: 1px dashed var(--copper); border-radius: 4px;
  color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background-color .15s;
}
.bug-btn svg { color: var(--copper); flex: none; }
.bug-btn:hover { background: var(--paper); border-style: solid; }
.bug-btn:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }
.bug-dialog {
  width: min(520px, calc(100vw - 32px)); box-sizing: border-box; padding: 24px;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px;
}
.bug-dialog::backdrop { background: rgba(10, 15, 6, 0.55); }
