/* Jonas – Oberfläche im TabLog-Design.
   Tokens verbindlich nach Designsystem (TabLog-Blau #1B6FA7, Navy #0B1624,
   Offwhite-Arbeitsfläche, Border statt Schatten, keine Emoji als Bedienelemente). */

:root {
  --tablog-blue: #1b6fa7;
  --tablog-blue-dark: #154e78;
  --tablog-navy: #0b1624;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-label: #374151;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --surface-muted: #f3f4f6;
  --background: #fafafa;
  --white: #ffffff;

  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info-bg: #eaf3f8;
  --info-border: #d4e6f1;

  --radius-control: 12px;
  --radius-card: 18px;
  --shadow-float: 0 10px 30px rgba(11, 22, 36, 0.08);

  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--background);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--tablog-blue);
  outline-offset: 2px;
}

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

/* ---------- Wortmarke (kein Icon, „Tab" regular + „Log" fett in Blau) ------- */

.wortmarke {
  font-weight: 400;
  letter-spacing: -0.5px;
  line-height: 1;
  white-space: nowrap;
}

.wortmarke b {
  font-weight: 700;
  color: var(--tablog-blue);
}

.wortmarke--hell {
  color: var(--white);
}

.wortmarke--dunkel {
  color: var(--tablog-navy);
  font-weight: 500;
}

/* ---------- Statusanzeige: Haken = bereit, Kreis = arbeitet, Dreieck = Eingabe --- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-label);
}

.status__zeichen {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
}

.status__zeichen svg {
  width: 100%;
  height: 100%;
  display: block;
}

.status[data-art="bereit"] {
  color: var(--success);
}

.status[data-art="arbeitet"] {
  color: var(--warning);
}

.status[data-art="fehler"],
.status[data-art="eingabe"] {
  color: var(--danger);
}

.status__kreis {
  width: 14px;
  height: 14px;
  border: 2.5px solid currentColor;
  border-radius: 999px;
  animation: puls 1.6s ease-in-out infinite;
}

@keyframes puls {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font: inherit;
  font-weight: 600;
  min-height: 48px;
  padding: 0 24px;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease,
    color 180ms ease;
}

.btn--primaer {
  background: var(--tablog-blue);
  color: var(--white);
}

.btn--primaer:hover:not(:disabled) {
  background: var(--tablog-blue-dark);
}

.btn--sekundaer {
  background: var(--white);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn--sekundaer:hover:not(:disabled) {
  background: var(--info-bg);
  border-color: var(--info-border);
}

.btn--text {
  background: none;
  border: 0;
  min-height: 44px;
  padding: 0;
  color: var(--tablog-blue);
  font-weight: 600;
  text-align: left;
}

.btn--text:hover:not(:disabled) {
  color: var(--tablog-blue-dark);
  text-decoration: underline;
}

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

/* ---------- Hinweis- und Meldungsflächen ---------- */

.hinweis {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
}

.meldung {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
  border: 1px solid;
}

.meldung__zeichen {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.meldung__zeichen svg {
  width: 100%;
  height: 100%;
  display: block;
}

.meldung__titel {
  font-weight: 700;
  margin-bottom: 2px;
}

.meldung--erfolg {
  background: var(--success-bg);
  border-color: #b9e6d3;
  color: #05563c;
}

.meldung--erfolg .meldung__zeichen {
  color: var(--success);
}

.meldung--fehler {
  background: var(--danger-bg);
  border-color: #f3c6c6;
  color: #8f1d1d;
}

.meldung--fehler .meldung__zeichen {
  color: var(--danger);
}

.verborgen {
  display: none !important;
}

/* ============================ Login-Seite ============================ */

.login-seite {
  min-height: 100dvh;
  display: flex;
  /* flex-start + margin:auto an der Karte: mittig, wenn Platz da ist, aber
     nie oben abgeschnitten, wenn die Karte höher als das Fenster wird. */
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  background-image: radial-gradient(
      1100px 520px at 12% -12%,
      rgba(27, 111, 167, 0.07),
      transparent 62%
    ),
    radial-gradient(
      900px 420px at 108% 112%,
      rgba(11, 22, 36, 0.06),
      transparent 60%
    );
}

.login {
  width: 100%;
  max-width: 940px;
  margin: auto;
  display: grid;
  grid-template-columns: 5fr 6fr;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.login__marke {
  background: var(--tablog-navy);
  color: #d9e2ec;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.028) 0 2px,
    transparent 2px 12px
  );
}

.login__marke .wortmarke {
  font-size: 22px;
}

.login__titel {
  font-size: 34px;
  font-weight: 800;
  color: var(--white);
  margin-top: auto;
}

.login__rolle {
  font-size: 15px;
  color: #aab8cb;
}

.login__grenzen {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  font-size: 14px;
  color: #c7d3e1;
}

.login__grenzen li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.login__grenzen span[aria-hidden] {
  color: var(--tablog-blue);
  flex: 0 0 auto;
  font-weight: 700;
}

.login__form {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login__eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tablog-blue);
}

.login__form h2 {
  font-size: 26px;
  font-weight: 800;
}

.login__erklaerung {
  font-size: 15px;
  color: var(--text-secondary);
}

.feld {
  display: grid;
  gap: 8px;
}

.feld label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-label);
}

.feld input {
  font: inherit;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--white);
  color: var(--text-primary);
  width: 100%;
}

.feld input::placeholder {
  color: #9ca3af;
}

.feld input:focus-visible {
  border-color: var(--tablog-blue);
}

.feld__fehler {
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  display: flex;
  gap: 8px;
  align-items: center;
}

.feld__fehler svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.login__aktion {
  width: 100%;
  margin-top: 16px;
}

.login__sendestatus {
  margin-top: 12px;
}

.login__fuss {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

/* ============================ Chat-Seite ============================ */

.chat-seite {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  padding-top: max(12px, env(safe-area-inset-top));
}

.topbar__marke {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.topbar__marke .wortmarke {
  font-size: 19px;
}

.topbar__trenner {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex: 0 0 1px;
}

.topbar__titel {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar__rolle {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.topbar__status {
  margin-left: auto;
  flex: 0 0 auto;
}

.grenzleiste {
  flex: 0 0 auto;
  background: var(--info-bg);
  border-bottom: 1px solid var(--info-border);
  color: #123a56;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 24px;
}

.verlauf {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
}

.verlauf__inhalt {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Solange nur die Startkarte steht, sitzt sie mittig statt oben mit großer
   Leerfläche darunter. */
.verlauf--leer {
  display: flex;
}

.verlauf--leer .verlauf__inhalt {
  margin: auto;
  width: 100%;
}

/* Startzustand */

.start {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.start h2 {
  font-size: 22px;
  font-weight: 800;
}

.start p {
  font-size: 15px;
  color: var(--text-secondary);
}

.start__vorschlaege {
  display: grid;
  gap: 8px;
}

.start__vorschlag {
  text-align: left;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 12px 14px;
  font: inherit;
  font-size: 14.5px;
  color: var(--text-primary);
  cursor: pointer;
  min-height: 48px;
  transition: border-color 200ms ease, background-color 200ms ease,
    transform 200ms ease;
}

.start__vorschlag:hover {
  border-color: rgba(27, 111, 167, 0.35);
  background: var(--info-bg);
  transform: translateY(-2px);
}

/* Nachrichten */

.nachricht {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 88%;
}

.nachricht__kopf {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nachricht__zeit {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.nachricht__text {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15.5px;
  overflow-wrap: break-word;
}

.nachricht__text > * + * {
  margin-top: 10px;
}

.nachricht__text ul,
.nachricht__text ol {
  margin: 10px 0 0;
  padding-left: 22px;
}

.nachricht__text li + li {
  margin-top: 6px;
}

.nachricht__text code {
  background: var(--surface-muted);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 0.92em;
}

.nachricht--du {
  align-self: flex-end;
  align-items: flex-end;
}

.nachricht--du .nachricht__kopf {
  color: var(--text-secondary);
}

.nachricht--du .nachricht__text {
  background: var(--info-bg);
  border-color: var(--info-border);
  border-bottom-right-radius: 6px;
}

.nachricht--jonas {
  align-self: flex-start;
}

.nachricht--jonas .nachricht__kopf {
  color: var(--tablog-blue);
}

.nachricht--jonas .nachricht__text {
  background: var(--white);
  border-bottom-left-radius: 6px;
}

/* Ladezustand einer Antwort */

.warten {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.warten__zeile {
  height: 11px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    #e9edf2 50%,
    var(--surface-muted) 100%
  );
  background-size: 200% 100%;
  animation: wandern 1.4s ease-in-out infinite;
}

.warten__zeile:nth-child(2) {
  width: 82%;
}

.warten__zeile:nth-child(3) {
  width: 58%;
}

@keyframes wandern {
  0% {
    background-position: 150% 0;
  }
  100% {
    background-position: -50% 0;
  }
}

.warten__hinweis {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Fehler im Verlauf */

.nachricht--stoerung {
  align-self: stretch;
  max-width: 100%;
}

.nachricht--stoerung .meldung {
  flex-wrap: wrap;
}

.nachricht--stoerung .btn--text {
  min-height: 32px;
  margin-top: 6px;
}

/* Eingabebereich */

.eingabe {
  flex: 0 0 auto;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.eingabe__inhalt {
  max-width: 780px;
  margin: 0 auto;
  display: grid;
  gap: 8px;
}

.eingabe__reihe {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.eingabe textarea {
  flex: 1 1 auto;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  min-height: 52px;
  max-height: 38vh;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  resize: none;
  color: var(--text-primary);
  background: var(--white);
}

.eingabe textarea::placeholder {
  color: #9ca3af;
}

.eingabe textarea:focus-visible {
  border-color: var(--tablog-blue);
}

.eingabe__sprache {
  min-height: 52px;
  padding: 0 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: not-allowed;
}

.eingabe__senden {
  min-height: 52px;
  /* Feste Breite, damit die Zeile beim Wechsel auf „Senden …" nicht springt. */
  min-width: 132px;
}

/* ---- Spracheingabe (Push-to-Talk) ---- */

.eingabe__mikro {
  min-height: 52px;
  min-width: 148px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.eingabe__mikro-punkt {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border-radius: 999px;
  border: 2px solid var(--text-secondary);
}

.eingabe__mikro[data-zustand="aufnahme"] {
  border-color: rgba(220, 38, 38, 0.5);
  background: var(--danger-bg);
  color: #8f1d1d;
}

.eingabe__mikro[data-zustand="aufnahme"] .eingabe__mikro-punkt {
  background: var(--danger);
  border-color: var(--danger);
  animation: puls 1.4s ease-in-out infinite;
}

.eingabe__mikro[data-zustand="arbeitet"] .eingabe__mikro-punkt {
  border-color: var(--warning);
  animation: puls 1.6s ease-in-out infinite;
}

.eingabe__vorlesen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.eingabe__vorlesen input {
  width: 16px;
  height: 16px;
  accent-color: var(--tablog-blue);
}

.eingabe__stopp {
  min-height: 24px;
  font-size: 12.5px;
}

.eingabe__fuss {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.eingabe__zaehler {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.eingabe__zaehler[data-knapp="ja"] {
  color: var(--warning);
  font-weight: 600;
}

/* Sperrfläche: nicht angemeldet / Verbindung geprüft */

.sperre {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.sperre__karte {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-float);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  display: grid;
  gap: 14px;
  text-align: left;
}

.sperre__karte h2 {
  font-size: 22px;
  font-weight: 800;
}

.sperre__karte p {
  font-size: 15px;
  color: var(--text-secondary);
}

.sperre__karte .btn--primaer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  justify-self: start;
}

/* ============================ Responsiv ============================ */

@media (max-width: 860px) {
  .login {
    grid-template-columns: 1fr;
    max-width: 520px;
  }

  .login__marke {
    padding: 28px 24px;
    gap: 14px;
  }

  .login__titel {
    font-size: 28px;
    margin-top: 4px;
  }

  .login__form {
    padding: 28px 24px;
  }

  .login__form h2 {
    font-size: 22px;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    gap: 10px;
    flex-wrap: wrap;
  }

  .topbar__rolle {
    display: none;
  }

  .grenzleiste {
    padding: 10px 16px;
    font-size: 13px;
  }

  .verlauf {
    padding: 16px;
  }

  .nachricht {
    max-width: 100%;
  }

  .eingabe {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* Auf schmalen Geräten Textfeld über die volle Breite, Aktionen darunter. */
  .eingabe__reihe {
    flex-wrap: wrap;
  }

  .eingabe textarea {
    flex: 1 1 100%;
  }

  .eingabe__sprache {
    flex: 0 0 auto;
    padding: 0 14px;
  }

  .eingabe__senden {
    flex: 1 1 auto;
  }

  .eingabe__mikro {
    flex: 1 1 40%;
    min-width: 130px;
  }

  .start,
  .sperre__karte {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .status__kreis {
    opacity: 1;
  }

  .warten__zeile {
    background: var(--surface-muted);
  }
}
