/* ============================================================
   Football Stock Exchange — Design System
   Börsen-Ästhetik mit dezenten Fußball-Akzenten.
   Keine Vereinslogos, keine Fotos — nur Typografie, Zahlen,
   Linien und abstrakte Spielfeld-Geometrie.
   ============================================================ */

:root {
  /* ---- Farben ---- */
  --bg-base:        #0A1628;   /* tiefes Marineblau-Schwarz, Basis */
  --bg-panel:       #101E36;   /* Karten / Panels, einen Ton heller */
  --bg-panel-raised:#152744;   /* hover / aktive Panels */
  --bg-ticker:      #060F1D;   /* dunkler als Basis, für den Ticker-Streifen */

  --line-hairline:  rgba(255, 255, 255, 0.08);
  --line-strong:    rgba(255, 255, 255, 0.16);

  --text-primary:   #EAF1FB;
  --text-secondary: #8CA0BE;
  --text-tertiary:  #5B6E8C;

  --up:             #16C784;   /* Kurs steigt */
  --up-bg:          rgba(22, 199, 132, 0.12);
  --down:           #EA3943;   /* Kurs fällt */
  --down-bg:        rgba(234, 57, 67, 0.12);
  --neutral:        #8CA0BE;

  --gold:           #D4AF37;   /* Champions-League-Akzent */
  --gold-bg:        rgba(212, 175, 55, 0.12);

  --pitch-line:     rgba(255, 255, 255, 0.05); /* Spielfeld-Linien im Hintergrund */

  /* ---- Typografie ---- */
  --font-display: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-body:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:     'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  /* ---- Abstände ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* ---- Radius ---- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* ---- Schatten ---- */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.32);
  --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.48);

  /* ---- Z-Index Ebenen ---- */
  --z-ticker: 10;
  --z-nav: 20;
  --z-modal: 100;
}

/* ============================================================
   Reset
   ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Dezentes Spielfeld-Linienmuster im Hintergrund der gesamten App.
   Simuliert die Mittellinie + Anstoßkreis eines Fußballfelds als
   sehr dezentes, großformatiges Wasserzeichen. Rein geometrisch,
   kein Logo, kein Wappen, kein Foto. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 50% 50%, transparent 0, transparent 120px, var(--pitch-line) 121px, var(--pitch-line) 123px, transparent 124px),
    linear-gradient(to bottom, transparent 0, transparent calc(50% - 1px), var(--pitch-line) calc(50% - 1px), var(--pitch-line) calc(50% + 1px), transparent calc(50% + 1px));
  background-size: 100% 100%;
  background-position: center;
  opacity: 0.6;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ============================================================
   Monospace-Zahlen — für alle Kurse, Beträge, Prozentwerte
   ============================================================ */
.num {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  letter-spacing: -0.02em;
}

.num-lg  { font-size: 28px; font-weight: 600; }
.num-md  { font-size: 18px; font-weight: 600; }
.num-sm  { font-size: 13px; font-weight: 500; }

.up   { color: var(--up); }
.down { color: var(--down); }
.neutral { color: var(--neutral); }

/* ============================================================
   App-Shell Layout
   ============================================================ */
#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.screen {
  flex: 1;
  padding: var(--space-4) var(--space-4) calc(var(--space-7) + 64px);
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-4) var(--space-3);
}

.screen-title {
  font-size: 22px;
  font-weight: 700;
}

.screen-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: var(--space-1);
}

/* ============================================================
   Karten / Panels
   ============================================================ */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--line-hairline);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line-hairline);
}
.card-row:last-child { border-bottom: none; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
  font-family: var(--font-body);
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--up); color: #06231A; }
.btn-primary:hover { opacity: 0.92; }

.btn-danger { background: var(--down); color: #2B0A0C; }
.btn-danger:hover { opacity: 0.92; }

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--bg-panel-raised); }

.btn-block { width: 100%; }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   Formulare
   ============================================================ */
.field {
  margin-bottom: var(--space-4);
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.field input {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-body);
}
.field input:focus {
  outline: none;
  border-color: var(--up);
}
.field input.num {
  font-family: var(--font-mono);
}

.field-error {
  color: var(--down);
  font-size: 13px;
  margin-top: var(--space-2);
}

/* ============================================================
   Badges (Wettbewerbe, Status)
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-ucl  { background: var(--gold-bg); color: var(--gold); }
.badge-1bl  { background: rgba(140, 160, 190, 0.15); color: var(--text-secondary); }
.badge-2bl  { background: rgba(140, 160, 190, 0.15); color: var(--text-secondary); }
.badge-dfbp { background: rgba(140, 160, 190, 0.15); color: var(--text-secondary); }

/* ============================================================
   Bottom Navigation
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-ticker);
  border-top: 1px solid var(--line-hairline);
  display: flex;
  justify-content: space-around;
  padding: var(--space-2) 0 calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-nav);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
}

.nav-item.active { color: var(--up); }
.nav-item svg { width: 22px; height: 22px; }

/* ============================================================
   Ticker-Band (Signature-Element)
   Läuft horizontal wie ein Börsenticker, zeigt aber
   Kursbewegungen mit Wettbewerbskürzeln.
   ============================================================ */
.ticker {
  position: relative;
  width: 100%;
  background: var(--bg-ticker);
  border-bottom: 1px solid var(--line-hairline);
  overflow: hidden;
  height: 36px;
  z-index: var(--z-ticker);
}

.ticker-track {
  display: flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  animation: ticker-scroll 45s linear infinite;
  will-change: transform;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  font-family: var(--font-mono);
  font-size: 12px;
  border-right: 1px solid var(--line-hairline);
}

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

/* ============================================================
   Mini-Sparkline (in StockCard)
   ============================================================ */
.sparkline {
  width: 64px;
  height: 28px;
  flex-shrink: 0;
}

/* ============================================================
   Modal (Trade-Dialog)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: var(--z-modal);
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg-panel);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-5) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-modal);
  animation: sheet-up 0.22s ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ============================================================
   Loading / Empty States
   ============================================================ */
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line-hairline);
  border-top-color: var(--up);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: var(--space-6) auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  color: var(--text-secondary);
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.4; margin-bottom: var(--space-4); }

/* ============================================================
   Toast (Erfolgs-/Fehlermeldungen)
   ============================================================ */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--bg-panel-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 14px;
  box-shadow: var(--shadow-card);
  z-index: var(--z-modal);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast-error { border-color: var(--down); }
.toast.toast-success { border-color: var(--up); }

/* ============================================================
   Utility
   ============================================================ */
.flex-row { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
