/* ============================================================
   DESIGN-SYSTEM: "Notfallausweis" - inspiriert von Boarding
   Pass / Gepäckanhänger. Ruhig, hochkontrastig, sofort lesbar
   in Stresssituationen. Kein Klein-Klein: große Ziele, klare
   Hierarchie, ein Signal-Akzentton (Rettungswesten-Orange).
   ============================================================ */

:root {
  --navy-950: #0b1d3a;
  --navy-900: #10254a;
  --navy-800: #17325f;
  --paper: #f7f5ef;
  --paper-dim: #ece8dd;
  --ink: #10203a;
  --ink-muted: #566178;
  --flare: #ff6a3d;      /* Signalfarbe: Notfall-Buttons, Akzente */
  --flare-dark: #e2531f;
  --ok: #1f8a5f;
  --danger: #cf3d3d;
  --line: rgba(16, 32, 58, 0.14);

  --font-display: 'Space Grotesk', 'Archivo', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;

  --radius: 18px;
  --tap: 56px; /* Mindestgröße für Tap-Targets im Notfall */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--navy-950);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 15% 8%, rgba(255, 106, 61, 0.10), transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(255, 255, 255, 0.05), transparent 45%);
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

p { margin: 0 0 12px; line-height: 1.5; }

a { color: inherit; }

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

/* ---------- Layout ---------- */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 18px 48px;
}

.topbar {
  width: 100%;
  max-width: 460px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  color: var(--paper);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  color: var(--paper);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--flare);
  display: grid;
  place-items: center;
  color: var(--navy-950);
  font-weight: 800;
  font-family: var(--font-display);
}

.eyebrow {
  color: var(--flare);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 10px;
}

/* ---------- Boarding-Pass Karte (Signatur-Element) ---------- */
.pass {
  width: 100%;
  max-width: 460px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  position: relative;
}

.pass-header {
  padding: 22px 24px 18px;
  border-bottom: 2px dashed var(--line);
  position: relative;
}

/* Perforationskreise am Rand - Boarding-Pass-Signatur */
.pass-header::before,
.pass-header::after {
  content: '';
  position: absolute;
  bottom: -12px;
  width: 24px;
  height: 24px;
  background: var(--navy-950);
  border-radius: 50%;
}
.pass-header::before { left: -12px; }
.pass-header::after { right: -12px; }

.pass-body {
  padding: 22px 24px 26px;
}

.pass-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}

.pass-title {
  font-size: 26px;
  font-weight: 700;
}

/* ---------- Formulare ---------- */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-size: 17px;
  font-family: var(--font-body);
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(255, 106, 61, 0.35);
  border-color: var(--flare);
}

.field textarea { min-height: 90px; resize: vertical; }

/* ---------- Telefon-Feld (Vorwahl-Select + Nummer) ---------- */
.phone-field {
  display: flex;
  gap: 8px;
}

.phone-field .phone-country-code {
  /* Feste, knappe Breite (reicht für "+971 AE") statt "auto" - vorher konnten
     lange Ländernamen im geschlossenen Select das Feld aufblähen und die
     Nummernspalte daneben auf wenige Pixel zusammenquetschen. */
  flex: 0 0 92px;
  width: 92px;
  min-width: 0;
  min-height: var(--tap);
  padding: 12px 6px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  font-family: var(--font-mono);
  background: #fff;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phone-field .phone-number {
  flex: 1 1 auto;
  min-width: 120px;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-size: 17px;
  font-family: var(--font-body);
  background: #fff;
  color: var(--ink);
}

.phone-field .phone-country-code:focus,
.phone-field .phone-number:focus {
  outline: 3px solid rgba(255, 106, 61, 0.35);
  border-color: var(--flare);
}

.contact-edit-row .phone-field {
  flex: 1;
  min-width: 0;
}

@media (max-width: 380px) {
  .phone-field { flex-wrap: wrap; }
  .phone-field .phone-country-code { flex-basis: 100%; }
  .phone-field .phone-number { flex-basis: 100%; }
}

.pin-hint {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 4px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 0 0 20px;
  padding: 16px 16px 4px;
}

legend {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  padding: 0 8px;
  color: var(--navy-900);
}

.legend-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--paper-dim);
  color: var(--ink-muted);
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
}

.legend-badge.premium {
  background: var(--flare);
  color: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  border: none;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
  text-decoration: none;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--flare);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-dark {
  background: var(--navy-950);
  color: var(--paper);
}

.btn-outline {
  background: transparent;
  color: var(--navy-950);
  border: 2px solid var(--navy-950);
}

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border: 2px solid rgba(247, 245, 239, 0.35);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 2px solid var(--danger);
}
.btn-danger:hover { background: rgba(207, 61, 61, 0.08); }

/* ---------- Gefahrenzone (Konto löschen) ---------- */
.danger-card {
  border: 1.5px solid rgba(207, 61, 61, 0.35);
  background-color: #fbf3f2;
}
.danger-card h2 { color: var(--danger); }

.btn-sm {
  min-height: 44px;
  font-size: 14px;
  padding: 0 16px;
  width: auto;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-row { display: flex; gap: 12px; }

/* ---------- Landing ---------- */
.hero {
  width: 100%;
  max-width: 460px;
  color: var(--paper);
  text-align: left;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 34px;
  line-height: 1.08;
}

.hero p {
  color: rgba(247, 245, 239, 0.75);
  font-size: 16px;
}

.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 460px;
  margin: 22px 0 26px;
}

.feature-chip {
  background: rgba(247, 245, 239, 0.06);
  border: 1px solid rgba(247, 245, 239, 0.14);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--paper);
  font-size: 13px;
}

.feature-chip strong {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  margin-bottom: 2px;
  color: var(--flare);
}

/* ---------- Alerts / Status ---------- */
.alert {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: rgba(207, 61, 61, 0.12); color: var(--danger); border: 1px solid rgba(207, 61, 61, 0.3); }
.alert-ok { background: rgba(31, 138, 95, 0.12); color: var(--ok); border: 1px solid rgba(31, 138, 95, 0.3); }

.link-row {
  text-align: center;
  margin-top: 18px;
  color: var(--ink-muted);
  font-size: 14px;
}
.link-row a { color: var(--flare-dark); font-weight: 700; text-decoration: none; }

/* ---------- Dashboard ---------- */
.dash-header {
  width: 100%;
  max-width: 520px;
  color: var(--paper);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 18px;
}

.dash-header .who { font-size: 22px; font-family: var(--font-display); font-weight: 700; }
.dash-header .sub { color: rgba(247,245,239,0.65); font-size: 13px; }

.card {
  width: 100%;
  max-width: 520px;
  background: var(--paper);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.22);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-title h2 { font-size: 16px; margin: 0; }

.contact-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--ink);
}

.contact-tile:hover { border-color: var(--flare); }

.contact-tile .name { font-weight: 700; font-family: var(--font-display); }
.contact-tile .phone { font-family: var(--font-mono); color: var(--ink-muted); font-size: 14px; }

.call-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  background: var(--flare);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.locked-card {
  position: relative;
  overflow: hidden;
}

.locked-overlay {
  position: absolute;
  inset: 0;
  background: rgba(247, 245, 239, 0.9);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 20px;
}

.premium-tag {
  display: inline-block;
  background: var(--navy-950);
  color: var(--flare);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--ink-muted); }
.kv-row .v { font-family: var(--font-mono); font-weight: 600; }

/* PIN Dots (visuelles Feedback beim Login) */
.pin-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 6px 0 4px;
}
.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: transparent;
}
.pin-dot.filled { background: var(--flare); border-color: var(--flare); }

.skeleton {
  background: linear-gradient(90deg, var(--paper-dim) 25%, #fff 37%, var(--paper-dim) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
  height: 16px;
}
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- Meldungen (Fehler/Erfolg) ---------- */
.error,
.success {
  width: 100%;
  max-width: 520px;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  margin: 16px 0 0;
}
.error:empty,
.success:empty {
  display: none;
  margin: 0;
  padding: 0;
  border: none;
}
.error {
  background: rgba(207, 61, 61, 0.12);
  color: var(--danger);
  border: 1px solid rgba(207, 61, 61, 0.3);
}
.success {
  background: rgba(31, 138, 95, 0.12);
  color: var(--ok);
  border: 1px solid rgba(31, 138, 95, 0.3);
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 29, 58, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-content {
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

/* ---------- Sprachumschalter ---------- */
.lang-switch {
  display: flex;
  gap: 4px;
  background: rgba(247, 245, 239, 0.08);
  border: 1px solid rgba(247, 245, 239, 0.16);
  border-radius: 10px;
  padding: 3px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: rgba(247, 245, 239, 0.6);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  min-height: auto;
}
.lang-btn.active {
  background: var(--flare);
  color: #fff;
}

/* ---------- Ad Slot (nur Free-Version) ---------- */
.ad-slot {
  width: 100%;
  max-width: 520px;
  background: var(--paper-dim);
  border: 1.5px dashed var(--ink-muted);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.ad-slot .ad-label {
  position: absolute;
  margin-top: -26px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}
.ad-slot .ad-icon {
  font-size: 26px;
  min-width: 40px;
  text-align: center;
}
.ad-slot .ad-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.ad-slot .ad-body {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin: 0 0 8px;
}

/* ---------- Kontakte bearbeiten (Dashboard) ---------- */
.contact-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.contact-edit-row input {
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  flex: 1;
  min-width: 0;
}
.contact-edit-row .remove-contact-btn {
  flex: none;
  min-height: 48px;
  padding: 0 14px;
}

@media (max-width: 380px) {
  .contact-edit-row { flex-wrap: wrap; }
  .contact-edit-row input { flex-basis: 100%; }
  .contact-edit-row .phone-field { flex-basis: 100%; }
  .contact-edit-row .remove-contact-btn { margin-left: auto; }
}

/* ---------- Security Log ---------- */
.log-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.log-row:last-child { border-bottom: none; }
.log-row .evt { font-weight: 600; }
.log-row .evt.ok { color: var(--ok); }
.log-row .evt.fail { color: var(--danger); }
.log-row .ts { color: var(--ink-muted); font-family: var(--font-mono); font-size: 12px; }

footer.foot {
  color: rgba(247,245,239,0.45);
  font-size: 12px;
  margin-top: 20px;
  text-align: center;
}

@media (max-width: 380px) {
  .hero h1 { font-size: 28px; }
  .feature-row { grid-template-columns: 1fr; }
}

/* ---------- Zustimmungs-Checkbox (AGB/Datenschutz bei Registrierung) ---------- */
.consent-field {
  margin-bottom: 16px;
}
.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-muted);
  text-transform: none;
  font-weight: 400;
}
.consent-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  flex: none;
  margin-top: 2px;
  accent-color: var(--flare);
}
.consent-label a {
  color: var(--flare-dark);
  font-weight: 600;
}

/* ---------- Premium-Plan-Auswahl (Dashboard) ---------- */
.plan-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.15s ease;
}
.plan-option:has(input:checked) {
  border-color: var(--flare);
}
.plan-option input[type="radio"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  flex: none;
  accent-color: var(--flare);
}

/* ---------- Rechtstexte (Impressum/Datenschutz/AGB) ---------- */
.legal-card {
  width: 100%;
  max-width: 720px;
  background: var(--paper);
  border-radius: var(--radius);
  padding: 32px clamp(20px, 5vw, 48px) 40px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.legal-card h1 {
  font-size: 26px;
  margin-bottom: 4px;
}
.legal-updated {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 24px;
}
.legal-card h2 {
  font-size: 18px;
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.legal-card h2:first-of-type {
  border-top: none;
  padding-top: 0;
}
.legal-card h3 {
  font-size: 15px;
  margin-top: 16px;
}
.legal-card p,
.legal-card li {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
}
.legal-card ul,
.legal-card ol {
  padding-left: 20px;
  margin: 0 0 12px;
}
.legal-card a {
  color: var(--flare-dark);
  font-weight: 600;
}
.legal-card .placeholder {
  background: rgba(255, 106, 61, 0.14);
  border: 1px dashed var(--flare);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--flare-dark);
  font-weight: 700;
  white-space: nowrap;
}
.legal-nav {
  width: 100%;
  max-width: 720px;
  margin-bottom: 16px;
}
.legal-nav a {
  color: var(--paper);
  opacity: 0.75;
  font-size: 14px;
  text-decoration: none;
}
.legal-nav a:hover {
  opacity: 1;
  text-decoration: underline;
}
footer.foot a {
  color: inherit;
  text-decoration: underline;
}

/* ---------- Anleitung ("So funktioniert's") ---------- */
.howto-card h2:first-of-type {
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.howto-steps {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 18px 0 8px;
}

.howto-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.howto-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--flare);
  display: grid;
  place-items: center;
}

.howto-icon svg {
  width: 26px;
  height: 26px;
}

.howto-step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--flare-dark);
  font-weight: 700;
  margin-bottom: 2px;
}

.howto-text h3 {
  font-size: 16px;
  margin: 0 0 4px;
}

.howto-text p {
  font-size: 14px;
  margin: 0;
}

.benefit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 18px 0 8px;
}

.benefit-card {
  background: var(--paper-dim);
  border-radius: 14px;
  padding: 16px 16px 18px;
}

.benefit-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 106, 61, 0.14);
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.benefit-icon svg {
  width: 20px;
  height: 20px;
}

.benefit-card h3 {
  font-size: 15px;
  margin: 0 0 4px;
}

.benefit-card p {
  font-size: 13px;
  margin: 0;
  color: var(--ink-muted);
}

.howto-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 26px 0 18px;
}

.howto-note {
  font-size: 13px;
  color: var(--ink-muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

@media (max-width: 520px) {
  .benefit-grid { grid-template-columns: 1fr; }
  .howto-cta { flex-direction: column; }
  .howto-cta a { max-width: none !important; }
}

/* Sichtbarer Fokus überall (Barrierefreiheit im Notfall wichtig) */
:focus-visible {
  outline: 3px solid var(--flare);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
