/* =============================================================================
   Eagles Cup - Design-System (Schema-unabhängig, zero-dependency)
   EINE Quelle für Farben, Typografie, Abstände & Komponenten. Alle Oberflächen
   (Teilnehmer, Verwaltung, Beamer, Druck, E-Mail-Vorschau) bauen darauf auf.
   Light + Dark über prefers-color-scheme; per [data-theme] erzwingbar.
   ============================================================================= */

/* ---------- Design-Tokens ---------- */
:root {
  /* Marken-Primitive (Navy / Gold) */
  --navy-900: #05112a; --navy-800: #081c3a; --navy-700: #0b2545; --navy-600: #13315c;
  --navy-500: #1c4374; --navy-400: #2f5c96; --navy-300: #5c82b4;
  --gold-600: #b8860b; --gold-500: #f3b21b; --gold-400: #ffc63f; --gold-300: #ffd75e; --gold-200: #ffe6a3;
  /* Blau-Palette (bleibt fuer Info-/Blautoene verfuegbar; der Marken-Akzent ist Gold) */
  --blue-700: #1d4ed8; --blue-600: #2563eb; --blue-500: #3b82f6; --blue-400: #60a5fa;
  --blue-300: #93c5fd; --blue-200: #bfdbfe; --blue-100: #dbeafe; --blue-50: #eff6ff;

  /* Semantische Signalfarben */
  --live: #ff4d4d; --ok: #23b26d; --warn: #e79a1a; --danger: #e5484d; --info: #2f79e0;
  /* --warn als TEXT auf hellem Grund reicht nur 2,3:1. Fuer Schrift daher --warn-ink
     (4,9:1 auf Weiss). --warn bleibt fuer Flaechen/Rahmen/Icons. */
  --warn-ink: #a16207;

  /* Typografie */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-base: 1rem; --fs-lg: 1.125rem;
  --fs-xl: 1.375rem; --fs-2xl: 1.75rem; --fs-3xl: 2.25rem; --fs-display: 3.25rem;
  --fw-normal: 500; --fw-med: 600; --fw-bold: 800; --fw-black: 900;
  --lh-tight: 1.1; --lh: 1.5;

  /* Abstände (4er-Raster) */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem;
  --s-6: 2rem; --s-7: 3rem; --s-8: 4rem;

  /* Radien / Schatten / Übergänge (Radien leicht groesser, Schatten deutlich leiser
     = ruhigeres, "papierartiges" Light-Theme statt sichtbar gezeichneter Karten) */
  --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-xl: 26px; --r-full: 999px;
  --sh-1: 0 1px 2px rgba(16,24,40,.05);
  --sh-2: 0 4px 16px rgba(16,24,40,.07);
  --sh-3: 0 16px 40px rgba(16,24,40,.10);
  --t-fast: .12s ease; --t: .2s ease; --t-slow: .4s ease;
  --focus: 0 0 0 3px rgba(243,178,27,.55);

  /* Semantische Flächen-Tokens (LIGHT als Standard)
     Modernisiert (08/2026, siehe VERBESSERUNGEN.md §6): warmes Off-White statt
     Blaustich-Grau, kein Flaechen-Gradient mehr, Hairlines statt sichtbarer Rahmen,
     EIN weicher Schatten statt dreier sichtbarer Stufen. */
  --bg: #f7f8fa; --bg-grad: none;
  --surface: #ffffff; --surface-2: #f3f5f8; --surface-3: #ebeef3;
  --text: #101828; --text-soft: #475467; --text-muted: #667085; --text-inv: #ffffff;
  --border: #e9edf3; --border-strong: #d5dce6;
  /* WICHTIG: Gold ist HELL -> --accent-ink ist dunkles Navy. Jede Flaeche in --accent
     muss ihren Text ueber --accent-ink beziehen, sonst wird es unlesbar.
     --accent-strong ist bewusst DUNKLER als Gold-600: als Schrift auf hellem Grund
     erreicht #b8860b nur 3,3:1, #8a5a00 dagegen 5,9:1 (AA). */
  --brand: var(--navy-700); --brand-ink: #ffffff; --accent: var(--gold-500); --accent-ink: var(--navy-700);
  --accent-soft: #fdf4e3; --accent-strong: #8a5a00;
  --ring: rgba(16,24,40,.05);
  --chip-bg: #f0f2f6; --chip-text: #33465f;
  --header-grad: linear-gradient(135deg, var(--navy-700), var(--navy-600));
  --shadow-color: rgba(16,24,40,.12);
  /* Teilnehmer-Kopfzeile: blauer Marken-Header (Navy-Verlauf) mit weisser Schrift und
     goldenem Unterstrich - identisch in Light und Dark. */
  --pub-head-bg: var(--header-grad);
  --pub-head-text: #ffffff;
  --pub-head-sub: var(--gold-200);
  --pub-head-muted: #9db4d4;
  --pub-head-border: transparent;
  --pub-head-shadow: var(--sh-2);
  color-scheme: light;
}

/* Dark-Mode: automatisch nach Systempräferenz – aber NUR im Auto-Modus (ohne data-theme),
   damit ein erzwungenes data-theme="light" bei dunklem System wirklich hell bleibt. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #05112a; --bg-grad: radial-gradient(120% 120% at 80% -10%, #163e73 0%, #0b2545 42%, #05112a 100%);
    --surface: rgba(255,255,255,.055); --surface-2: rgba(255,255,255,.09); --surface-3: rgba(255,255,255,.14);
    --text: #eaf1fb; --text-soft: #c3d2e8; --text-muted: #9db4d4; --text-inv: #0b2545;
    --border: rgba(255,255,255,.12); --border-strong: rgba(255,255,255,.22);
    --brand: #3f74d6; --brand-ink: #ffffff; --accent: var(--gold-500); --accent-ink: var(--navy-700);
    --accent-soft: rgba(243,178,27,.16); --accent-strong: var(--gold-300);
    --chip-bg: rgba(255,255,255,.10); --chip-text: #eaf1fb;
    --header-grad: linear-gradient(135deg, #0a2140, #13315c);
    --sh-1: 0 1px 2px rgba(0,0,0,.3); --sh-2: 0 6px 18px rgba(0,0,0,.34); --sh-3: 0 16px 40px rgba(0,0,0,.45);
    --shadow-color: rgba(0,0,0,.4);
    --pub-head-bg: var(--header-grad); --pub-head-text: #ffffff; --pub-head-sub: var(--gold-200);
    --pub-head-muted: #9db4d4; --pub-head-border: transparent; --pub-head-shadow: var(--sh-2);
  }
}
/* ... und per Umschalter erzwingbar */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05112a; --bg-grad: radial-gradient(120% 120% at 80% -10%, #163e73 0%, #0b2545 42%, #05112a 100%);
  --surface: rgba(255,255,255,.055); --surface-2: rgba(255,255,255,.09); --surface-3: rgba(255,255,255,.14);
  --text: #eaf1fb; --text-soft: #c3d2e8; --text-muted: #9db4d4; --text-inv: #0b2545;
  --border: rgba(255,255,255,.12); --border-strong: rgba(255,255,255,.22);
  --brand: #3f74d6; --brand-ink: #ffffff; --accent: var(--gold-500); --accent-ink: var(--navy-700);
    --accent-soft: rgba(243,178,27,.16); --accent-strong: var(--gold-300);
  --chip-bg: rgba(255,255,255,.10); --chip-text: #eaf1fb;
  --header-grad: linear-gradient(135deg, #0a2140, #13315c);
  --sh-1: 0 1px 2px rgba(0,0,0,.3); --sh-2: 0 6px 18px rgba(0,0,0,.34); --sh-3: 0 16px 40px rgba(0,0,0,.45);
  --shadow-color: rgba(0,0,0,.4);
  --pub-head-bg: var(--header-grad); --pub-head-text: #ffffff; --pub-head-sub: var(--gold-200);
  --pub-head-muted: #9db4d4; --pub-head-border: transparent; --pub-head-shadow: var(--sh-2);
}
/* data-theme="light" braucht KEINE eigenen Tokens – die hellen :root-Standardwerte gelten
   automatisch, weil der Dark-@media-Block dank :not([data-theme]) nur im Auto-Modus greift. */

/* ---------- Reset / Basis ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-weight: var(--fw-normal);
  font-size: var(--fs-base); line-height: var(--lh); color: var(--text);
  background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0 0 var(--s-3); line-height: var(--lh-tight); font-weight: var(--fw-bold); color: var(--text); }
h1 { font-size: var(--fs-3xl); letter-spacing: -.02em; }
h2 { font-size: var(--fs-2xl); letter-spacing: -.01em; }
h3 { font-size: var(--fs-xl); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
::selection { background: var(--gold-300); color: var(--navy-700); }

/* ---------- Typo-/Layout-Helfer ---------- */
.display { font-size: var(--fs-display); font-weight: var(--fw-black); line-height: 1; letter-spacing: -.03em; }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.container { max-width: 1080px; margin-inline: auto; padding-inline: var(--s-4); }
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.grid { display: grid; gap: var(--s-4); }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Icons ---------- */
.ic { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -.2em; flex: none; stroke: currentColor; }
.ic-lg { width: 1.6em; height: 1.6em; }
.ic-xl { width: 2.4em; height: 2.4em; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font: inherit; font-weight: var(--fw-bold); font-size: var(--fs-sm);
  padding: .65rem 1.1rem; min-height: 44px; border-radius: var(--r-sm);
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd);
  cursor: pointer; transition: transform var(--t-fast), box-shadow var(--t), background var(--t), border-color var(--t);
  white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; box-shadow: var(--sh-1); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: var(--brand-ink); --btn-bd: transparent; }
.btn-primary:hover { box-shadow: var(--sh-2); filter: brightness(1.06); }
.btn-accent { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-bd: transparent; }
.btn-accent:hover { box-shadow: 0 6px 18px rgba(243,178,27,.45); filter: brightness(1.06); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--text); --btn-bd: var(--border-strong); }
.btn-danger { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { --btn-bg: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn-sm { padding: .4rem .7rem; min-height: 34px; font-size: var(--fs-xs); }
.btn-lg { padding: .85rem 1.5rem; min-height: 52px; font-size: var(--fs-base); }
.btn-icon { padding: 0; width: 44px; min-height: 44px; }
.btn-block { width: 100%; }

/* ---------- Chips / Badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-1); padding: .3rem .7rem;
  border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-bold);
  background: var(--chip-bg); color: var(--chip-text); line-height: 1.4; white-space: nowrap;
}
.chip-accent { background: var(--accent); color: var(--accent-ink); }
.chip-brand { background: var(--brand); color: var(--brand-ink); }
.chip-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-soft); }
.badge {
  display: inline-flex; align-items: center; gap: .4em; padding: .25rem .6rem; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: var(--fw-bold); line-height: 1.4;
  background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info);
}
.badge-ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge-warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn-ink); }
.badge-danger { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.badge-live { background: color-mix(in srgb, var(--live) 15%, transparent); color: var(--live); }
.dot { width: .6em; height: .6em; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.dot-live { background: var(--live); box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); } 50% { box-shadow: 0 0 0 7px transparent; } }

/* ---------- Karten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); overflow: hidden;
}
.card-pad { padding: var(--s-5); }
.card-hd { padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); font-weight: var(--fw-bold); display: flex; align-items: center; gap: var(--s-2); }
.card-accent { border-top: 3px solid var(--accent); }

/* KPI-Kachel */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-4) var(--s-5); box-shadow: var(--sh-1); }
.kpi-val { font-size: var(--fs-3xl); font-weight: var(--fw-black); line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-top: var(--s-2); }
.kpi-sub { font-size: var(--fs-sm); color: var(--text-soft); margin-top: var(--s-1); }
.kpi-accent .kpi-val { color: var(--accent); }

/* ---------- Formularfelder ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field > label, .label { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--text-soft); }
.input, .select, .textarea {
  font: inherit; font-size: var(--fs-base); color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: .6rem .8rem; min-height: 44px;
  width: 100%; transition: border-color var(--t), box-shadow var(--t);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea { min-height: 96px; resize: vertical; line-height: var(--lh); }
.field-hint { font-size: var(--fs-xs); color: var(--text-muted); }
.field-error { color: var(--danger); }
.field.invalid .input, .field.invalid .select { border-color: var(--danger); }
/* Stepper (Zahl hoch/runter) */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.stepper button { width: 44px; height: 44px; border: none; background: var(--surface-2); color: var(--text); font-size: var(--fs-xl); font-weight: var(--fw-bold); cursor: pointer; }
.stepper button:hover { background: var(--surface-3); }
.stepper .val { min-width: 3ch; text-align: center; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }

/* ---------- Tabellen ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: var(--fw-bold); text-align: left; padding: var(--s-3) var(--s-4); position: sticky; top: 0; background: var(--surface); }
.table td { padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; }
.table--zebra tbody tr:nth-child(odd) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--border); }

/* ---------- Tabs / Segmented ---------- */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: var(--s-3) var(--s-4); font-weight: var(--fw-bold); color: var(--text-muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; background: none; border-top: none; border-left: none; border-right: none; font-size: var(--fs-sm); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--accent); }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-full); padding: 3px; }
.segmented button { border: none; background: none; color: var(--text-muted); font: inherit; font-weight: var(--fw-bold); font-size: var(--fs-sm); padding: .4rem 1rem; border-radius: var(--r-full); cursor: pointer; }
.segmented button.on { background: var(--surface); color: var(--brand); box-shadow: var(--sh-1); }

/* ---------- Toast / Modal / Progress ---------- */
.toast { display: inline-flex; align-items: center; gap: var(--s-2); background: var(--navy-700); color: #fff; padding: var(--s-3) var(--s-4); border-radius: var(--r); box-shadow: var(--sh-3); font-weight: var(--fw-med); border: 1px solid rgba(255,255,255,.1); }
.toast-ok { background: var(--ok); } .toast-danger { background: var(--danger); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(5,17,42,.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: var(--s-4); z-index: 100; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-3); max-width: 460px; width: 100%; overflow: hidden; }
.progress { height: 10px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-400), var(--gold-500)); border-radius: inherit; }

/* ---------- Leerzustand / Skeleton ---------- */
.empty { text-align: center; color: var(--text-muted); padding: var(--s-7) var(--s-4); font-weight: var(--fw-med); }
.empty .ic { color: var(--border-strong); }
.skel { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%); background-size: 200% 100%; border-radius: var(--r-sm); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Bewegung reduzieren ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
