/*
 * RouteHome – css/base.css
 * Pfad: css/base.css
 * Zweck: Design-Token-System (CSS Custom Properties), Reset, Typografie.
 *        KEINE Layout-Regeln – das gehört in layout.css.
 *        KEINE Komponenten-Styles – das gehört in components.css.
 */

/* ═══════════════════════════════════════════════════════════════
   1. DESIGN TOKENS – Dark Mode (Standard)
═══════════════════════════════════════════════════════════════ */
:root {
  /* ── Hintergrundfarben ── */
  --c-bg-base:      #0B132B;   /* Tiefstes Dunkelblau – Nachtfahrt-optimiert  */
  --c-bg-surface:   #111D3C;   /* Surfaces (Cards, Panels)                    */
  --c-bg-elevated:  #182248;   /* Erhöhte Elemente (Dropdowns, Modals)        */
  --c-bg-card:      #1B2A5E;   /* Karten-Hintergrund                          */
  --c-bg-overlay:   rgba(11, 19, 43, 0.92);

  /* ── Akzentfarben ── */
  --c-blue:         #2563EB;
  --c-blue-hover:   #1D4ED8;
  --c-blue-soft:    rgba(37, 99, 235, 0.15);
  --c-blue-border:  rgba(37, 99, 235, 0.40);

  --c-yellow:       #F4D03F;   /* Sicherheits-Gelb: Alerts, CTAs              */
  --c-yellow-hover: #ECC900;
  --c-yellow-soft:  rgba(244, 208, 63, 0.15);
  --c-yellow-border:rgba(244, 208, 63, 0.40);

  --c-green:        #22C55E;
  --c-green-soft:   rgba(34, 197, 94, 0.15);

  --c-red:          #EF4444;
  --c-red-soft:     rgba(239, 68, 68, 0.15);

  --c-orange:       #F97316;

  /* ── Textfarben ── */
  --c-text-primary:   #EDF2F7;
  --c-text-secondary: #94A3B8;
  --c-text-muted:     #4A6080;
  --c-text-on-accent: #0B132B;  /* Text auf farbigem Hintergrund              */

  /* ── Rahmen ── */
  --c-border:       rgba(255, 255, 255, 0.07);
  --c-border-strong:rgba(255, 255, 255, 0.14);

  /* ── Schatten ── */
  --shadow-sm:  0 1px  3px rgba(0, 0, 0, 0.50);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.50);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.60);
  --shadow-glow:0 0   24px rgba(37, 99, 235, 0.35);

  /* ── Typografie ── */
  --font-display: 'Syne',     sans-serif;
  --font-body:    'DM Sans',  sans-serif;

  --text-xs:   0.688rem;   /*  11px */
  --text-sm:   0.813rem;   /*  13px */
  --text-base: 0.938rem;   /*  15px */
  --text-md:   1.063rem;   /*  17px */
  --text-lg:   1.25rem;    /*  20px */
  --text-xl:   1.5rem;     /*  24px */
  --text-2xl:  1.875rem;   /*  30px */

  /* ── Abstände ── */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* ── Radien ── */
  --r-sm:   6px;
  --r-md:  12px;
  --r-lg:  18px;
  --r-xl:  24px;
  --r-full:9999px;

  /* ── Layout-Konstanten ── */
  --header-h:       56px;
  --bottom-nav-h:   64px;
  --map-h-portrait: 42dvh;   /* Kartenhöhe im Portrait-Modus                 */

  /* ── Übergänge ── */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:   cubic-bezier(0.4, 0, 1, 1);
  --ease-std:  cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast:  150ms;
  --dur-std:   250ms;
  --dur-slow:  400ms;
}

/* ═══════════════════════════════════════════════════════════════
   2. LIGHT MODE TOKENS  (umgeschaltet via [data-theme="light"])
═══════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --c-bg-base:      #F0F4FF;
  --c-bg-surface:   #FFFFFF;
  --c-bg-elevated:  #EBF0FF;
  --c-bg-card:      #DDEAFF;
  --c-bg-overlay:   rgba(240, 244, 255, 0.95);

  --c-text-primary:   #0D1B3E;
  --c-text-secondary: #3A5280;
  --c-text-muted:     #7A94BB;
  --c-text-on-accent: #FFFFFF;

  --c-border:       rgba(0, 0, 0, 0.08);
  --c-border-strong:rgba(0, 0, 0, 0.16);

  --shadow-sm:  0 1px  3px rgba(0, 0, 0, 0.10);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.15);
  --shadow-glow:0 0   24px rgba(37, 99, 235, 0.20);
}

/* ═══════════════════════════════════════════════════════════════
   3. RESET
═══════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--c-text-primary);
  background: var(--c-bg-base);
  min-height: 100dvh;
  overflow: hidden;             /* App ist kein scrollendes Dokument          */
  overscroll-behavior: none;    /* Verhindert Pull-to-Refresh im Browser      */
  /* Subtiler Hintergrund-Verlauf für Tiefe */
  background-image: radial-gradient(
    ellipse 80% 50% at 50% -10%,
    rgba(37, 99, 235, 0.10) 0%,
    transparent 70%
  );
  transition:
    background-color var(--dur-std) var(--ease-std),
    color           var(--dur-std) var(--ease-std);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

a {
  text-decoration: none;
  color: inherit;
}

img, svg {
  display: block;
  max-width: 100%;
}

ul, ol {
  list-style: none;
}

/* ── Custom Scrollbar (Webkit) ── */
::-webkit-scrollbar         { width: 3px; height: 3px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: var(--c-text-muted); border-radius: var(--r-full); }

/* ═══════════════════════════════════════════════════════════════
   4. FOKUS-STILE (Barrierefreiheit)
═══════════════════════════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--c-yellow);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ═══════════════════════════════════════════════════════════════
   5. TYPOGRAFIE-BASIS
═══════════════════════════════════════════════════════════════ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--c-text-primary);
  line-height: 1.2;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl);  }
h3 { font-size: var(--text-lg);  }
h4 { font-size: var(--text-md);  }

p {
  font-size: var(--text-base);
  color: var(--c-text-secondary);
  line-height: 1.65;
}

small {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   6. GLOBAL BUTTON STILE
═══════════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-4) var(--sp-6);
  background: var(--c-blue);
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  border-radius: var(--r-md);
  min-height: 52px;
  letter-spacing: 0.02em;
  transition: background var(--dur-fast), transform var(--dur-fast);
  touch-action: manipulation;
}
.btn-primary:active {
  background: var(--c-blue-hover);
  transform: scale(0.97);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-bg-elevated);
  border: 1.5px solid var(--c-border-strong);
  color: var(--c-text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--r-md);
  min-height: 44px;
  transition: all var(--dur-fast);
  touch-action: manipulation;
}
.btn-secondary:active { transform: scale(0.97); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3) var(--sp-4);
  color: var(--c-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--r-md);
  min-height: 44px;
  transition: color var(--dur-fast);
}
.btn-ghost:hover,
.btn-ghost:active { color: var(--c-text-primary); }

/* Icon-Button: rundes Touch-Target */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  color: var(--c-text-primary);
  transition: background var(--dur-fast);
  touch-action: manipulation;
  flex-shrink: 0;
}
.icon-btn:active { background: var(--c-bg-elevated); }

/* SOS-Button */
.sos-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--sp-4);
  height: 34px;
  background: var(--c-red);
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  border-radius: var(--r-full);
  letter-spacing: 0.08em;
  animation: sos-pulse 2.5s ease-in-out infinite;
  touch-action: manipulation;
}

@keyframes sos-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(239,68,68,0.5); }
  50%       { box-shadow: 0 0 20px rgba(239,68,68,0.8), 0 0 40px rgba(239,68,68,0.3); }
}

/* ═══════════════════════════════════════════════════════════════
   7. UTILITY-KLASSEN
═══════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.full-w { width: 100%; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* Übergangs-Transition für Farbwechsel (Theme-Switching) */
.theme-transition,
.theme-transition * {
  transition:
    background-color var(--dur-std) var(--ease-std),
    border-color     var(--dur-std) var(--ease-std),
    color            var(--dur-std) var(--ease-std) !important;
}

/* ═══════════════════════════════════════════════════════════════
   8. ANIMATIONS (globale Keyframes)
═══════════════════════════════════════════════════════════════ */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-down-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════
   9. PRINT – App hat keine Print-Ansicht
═══════════════════════════════════════════════════════════════ */
@media print {
  body { display: none; }
}
