/*
 * RouteHome – css/components.css
 * Pfad: css/components.css
 * Zweck: Styles aller wiederverwendbaren UI-Komponenten.
 *        Setzt base.css und layout.css voraus.
 *        Keine Layout-Strukturen – die bleiben in layout.css.
 */

/* ═══════════════════════════════════════════════════════════════
   1. ONBOARDING OVERLAY
═══════════════════════════════════════════════════════════════ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: var(--c-bg-base);
  background-image:
    radial-gradient(ellipse 70% 60% at 20% 80%, rgba(37,99,235,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 20%, rgba(244,208,63,0.07) 0%, transparent 50%);
  animation: fade-in var(--dur-slow) var(--ease-out);
  /* Safe area */
  padding-top:    max(var(--sp-4), env(safe-area-inset-top));
  padding-bottom: max(var(--sp-4), env(safe-area-inset-bottom));
}

/* Card */
.onboarding-card {
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 48px);
  background: var(--c-bg-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-6) var(--sp-6);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Akzent-Linie oben */
.onboarding-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--c-blue), var(--c-yellow));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  pointer-events: none;
}

/* Logo-Bereich */
.onboarding-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.onboarding-logo__img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
}

.onboarding-logo__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, var(--c-yellow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Schritt-Übergangsanimation */
.onboarding-step {
  display: none;
}
.onboarding-step.onboarding-step--active {
  display: block;
  animation: slide-up var(--dur-std) var(--ease-out);
}

.onboarding-step__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--c-text-primary);
  margin-bottom: var(--sp-2);
}

.onboarding-step__sub {
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
  margin-bottom: var(--sp-5);
  line-height: 1.5;
}

/* Fortschrittspunkte */
.onboarding-dots {
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
}

.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--c-text-muted);
  transition: width var(--dur-std) var(--ease-out), background var(--dur-std);
}

.onboarding-dot--active {
  width: 24px;
  background: var(--c-blue);
}

/* Nav-Buttons */
.onboarding-nav {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

/* Sprach-Grid */
.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-bg-elevated);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-text-primary);
  transition: all var(--dur-fast);
  touch-action: manipulation;
  min-height: 48px;
  cursor: pointer;
  text-align: left;
}

.lang-btn:active,
.lang-btn--selected {
  border-color: var(--c-yellow);
  background: var(--c-yellow-soft);
  color: var(--c-text-primary);
}

/* Routen-Karten */
.route-cards {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.route-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-bg-elevated);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  text-align: left;
  transition: all var(--dur-fast);
  min-height: 60px;
  cursor: pointer;
  touch-action: manipulation;
}

.route-card:active,
.route-card--selected {
  border-color: var(--c-blue);
  background: var(--c-blue-soft);
}

.route-card__flag { font-size: 1.1rem; flex-shrink: 0; }

.route-card__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.route-card__name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--c-text-primary);
}

.route-card__via {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
}

/* Reisety p-Grid */
.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-3);
  background: var(--c-bg-elevated);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-lg);
  transition: all var(--dur-fast);
  min-height: 88px;
  cursor: pointer;
  touch-action: manipulation;
}

.type-card:active,
.type-card--selected {
  border-color: var(--c-yellow);
  background: var(--c-yellow-soft);
}

.type-card__icon { font-size: 1.8rem; }

.type-card__name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-text-secondary);
}

/* ═══════════════════════════════════════════════════════════════
   2. SIDE DRAWER INHALT
═══════════════════════════════════════════════════════════════ */
.drawer-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.drawer-header__title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
}

.drawer-nav {
  flex: 1;
  padding: var(--sp-3) var(--sp-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.drawer-nav__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--c-text-primary);
  text-align: left;
  transition: background var(--dur-fast);
  cursor: pointer;
  min-height: 52px;
  touch-action: manipulation;
  width: 100%;
  background: none;
  border: none;
}

.drawer-nav__item:active,
.drawer-nav__item:hover {
  background: var(--c-bg-elevated);
}

.drawer-nav__icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.drawer-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--c-border);
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  flex-shrink: 0;
  padding-bottom: max(var(--sp-4), env(safe-area-inset-bottom));
}

/* ═══════════════════════════════════════════════════════════════
   3. MODAL SHEET – Inhaltskomponenten
═══════════════════════════════════════════════════════════════ */
.modal-sheet {
  width: 100%;
  max-width: 540px;
  max-height: 85dvh;
  background: var(--c-bg-surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border: 1px solid var(--c-border-strong);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheet-up var(--dur-slow) var(--ease-out);
}

/* Drag-Pill oben */
.modal-sheet::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: var(--c-text-muted);
  border-radius: var(--r-full);
  margin: var(--sp-3) auto 0;
  opacity: 0.4;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-5);
  padding-bottom: max(var(--sp-5), env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* ── Sprach-Modal: Grid ── */
.lang-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}

.lang-modal-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-bg-elevated);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  cursor: pointer;
  min-height: 52px;
  transition: all var(--dur-fast);
  text-align: left;
}

.lang-modal-btn:active,
.lang-modal-btn--active {
  border-color: var(--c-yellow);
  background: var(--c-yellow-soft);
}

.lang-modal-btn--unavailable {
  opacity: 0.4;
  cursor: not-allowed;
}

.lang-modal-btn__flag  { font-size: 1.3rem; flex-shrink: 0; }
.lang-modal-btn__label { font-size: var(--text-sm); font-weight: 600; }

/* ── SOS-Modal ── */
.sos-location {
  padding: var(--sp-4);
  background: var(--c-bg-elevated);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
  margin-bottom: var(--sp-4);
  text-align: center;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sos-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.sos-call-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: rgba(239, 68, 68, 0.10);
  border: 1.5px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--r-lg);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--c-red);
  text-decoration: none;
  transition: background var(--dur-fast);
  min-height: 56px;
  touch-action: manipulation;
}

.sos-call-btn:active {
  background: rgba(239, 68, 68, 0.22);
}

.sos-title { color: var(--c-red); }

/* ═══════════════════════════════════════════════════════════════
   4. TOAST NOTIFICATIONS
═══════════════════════════════════════════════════════════════ */
.toast {
  width: 100%;
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-bg-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  pointer-events: auto;
  animation: toast-in var(--dur-std) var(--ease-out) forwards;
  border-left: 3px solid var(--c-blue);
}

.toast--success { border-left-color: var(--c-green); }
.toast--warning { border-left-color: var(--c-yellow); }
.toast--error   { border-left-color: var(--c-red); }
.toast--info    { border-left-color: var(--c-blue); }

.toast--out {
  animation: toast-out var(--dur-std) var(--ease-in) forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-6px); }
}

.toast__icon { font-size: 1rem; flex-shrink: 0; }
.toast__text { flex: 1; }

/* ═══════════════════════════════════════════════════════════════
   5. SECTION BLOCKS (Tab-Panel-Inhalte)
═══════════════════════════════════════════════════════════════ */
.section-block {
  margin-bottom: var(--sp-6);
}

.section-block:last-child {
  margin-bottom: 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--c-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-3);
  padding-left: var(--sp-2);
  border-left: 2.5px solid var(--c-blue);
}

/* ═══════════════════════════════════════════════════════════════
   6. EMPTY STATE & PLACEHOLDER
═══════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-4);
  gap: var(--sp-3);
  text-align: center;
}

.empty-state__icon { font-size: 2.5rem; opacity: 0.5; }

.empty-state__text {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  max-width: 240px;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   7. LANG-DROPDOWN (Quick-Picker in Top-Bar)
═══════════════════════════════════════════════════════════════ */
.lang-dropdown {
  position: fixed;
  top: calc(var(--header-h) + 6px);
  right: var(--sp-3);
  z-index: 300;
  background: var(--c-bg-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-2);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-1);
  min-width: 220px;
  animation: slide-down-in var(--dur-std) var(--ease-out);
}

.lang-dropdown[hidden] { display: none; }

/* Buttons im Dropdown nutzen .lang-btn Styles von oben */

/* ═══════════════════════════════════════════════════════════════
   8. CARD KOMPONENTEN (für Tab-Panels)
═══════════════════════════════════════════════════════════════ */
.info-card {
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  transition: border-color var(--dur-fast);
}

.info-card--yellow { border-left: 3px solid var(--c-yellow); }
.info-card--green  { border-left: 3px solid var(--c-green);  }
.info-card--red    { border-left: 3px solid var(--c-red);    }
.info-card--blue   { border-left: 3px solid var(--c-blue);   }

.info-card__icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.info-card__content { flex: 1; }

.info-card__title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--c-text-primary);
  margin-bottom: 3px;
}

.info-card__text {
  font-size: var(--text-xs);
  color: var(--c-text-secondary);
  line-height: 1.5;
}

.info-card__value {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--c-text-primary);
  text-align: right;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   9. STATUS-BADGE (für Grenzen, Wartezeiten etc.)
═══════════════════════════════════════════════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 700;
}

.status-badge--green  { background: rgba(34,197,94,0.15);  color: var(--c-green); }
.status-badge--yellow { background: rgba(244,208,63,0.15); color: var(--c-yellow); }
.status-badge--red    { background: rgba(239,68,68,0.15);  color: var(--c-red); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--green  { background: var(--c-green);  box-shadow: 0 0 5px rgba(34,197,94,0.6); }
.status-dot--yellow { background: var(--c-yellow); box-shadow: 0 0 5px rgba(244,208,63,0.6); }
.status-dot--red    { background: var(--c-red);    box-shadow: 0 0 5px rgba(239,68,68,0.6); }

/* ═══════════════════════════════════════════════════════════════
   10. SPINNER / LADEINDIKATOR
═══════════════════════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--c-border-strong);
  border-top-color: var(--c-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.spinner--sm { width: 14px; height: 14px; border-width: 2px; }
.spinner--lg { width: 32px; height: 32px; border-width: 3px; }

/* ═══════════════════════════════════════════════════════════════
   11. INPUT-GRUPPE (für Settings, Modals)
═══════════════════════════════════════════════════════════════ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.input-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--c-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.input-field {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-bg-elevated);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text-primary);
  font-size: var(--text-base);
  min-height: 48px;
  transition: border-color var(--dur-fast);
}

.input-field:focus {
  border-color: var(--c-blue);
  outline: none;
}

.input-field::placeholder { color: var(--c-text-muted); }

select.input-field option {
  background: var(--c-bg-surface);
}
