/* ============================================================================
   _chat / chat.css  -  Chat ohne Backend (Knopf unten rechts + Fenster)
   ----------------------------------------------------------------------------
   Eigene Datei neben dem Bausatz; _kit/ bleibt unberuehrt. Alles haengt am
   Wrapper .cb, den chat.js als letztes Kind von <body> anlegt - so faengt kein
   transform/will-change-Vorfahr das fixed-Element ein. Der Praefix .cb vor
   jeder Regel hebt die Gewichtung ueber die Elementregeln von base.css
   (z. B. button:focus-visible setzt dort einen Eckenradius).

   Farben und Schriften kommen aus den Tokens der Seite (tokens.css bzw. dem
   seiteneigenen :root-Block). Jede Variable hat einen sicheren Rueckfall.

   Ebenen: Kopfleiste 60 < Handy-Leiste 70 < Chat 85/86 < Menue 90
           < Modal 100 < Reservierung (.rz) 140 < Sprunglink 200.
   ========================================================================== */

.cb {
  --cb-akzent: var(--accent, #9c5a2e);
  --cb-akzent-hell: var(--accent-soft, var(--cb-akzent));
  --cb-akzent-tinte: var(--accent-ink, var(--cb-akzent));
  --cb-auf-akzent: var(--on-accent, #ffffff);
  --cb-akzent-2: var(--accent-2, var(--cb-akzent-hell));
  --cb-dunkel-0: var(--bg-0, #121010);
  --cb-dunkel: var(--bg-1, #1d1a17);
  --cb-hell: var(--surface, #f6f1ea);
  --cb-hell-2: var(--surface-2, #ffffff);
  --cb-tinte: var(--ink, #2a211b);
  --cb-tinte-weich: var(--ink-soft, #5f544b);
  --cb-text: var(--text, #f4eee6);
  --cb-text-weich: var(--text-soft, #c9bfb2);
  --cb-linie: var(--line-ink, rgba(0, 0, 0, 0.12));
  --cb-linie-stark: var(--line-ink-strong, rgba(0, 0, 0, 0.22));
  --cb-schrift: var(--font-body, system-ui, -apple-system, "Segoe UI", sans-serif);
  --cb-schrift-titel: var(--font-display, Georgia, "Times New Roman", serif);
  --cb-schatten-akzent: var(--shadow-accent, 0 14px 34px -14px rgba(0, 0, 0, 0.5));
  --cb-ease: var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));

  --cb-leiste: 0px;          /* Hoehe der klebenden Handy-Leiste, misst chat.js */
  --cb-fab: 60px;
  --cb-rand: 22px;
  --cb-fab-unten: calc(var(--cb-leiste) + var(--cb-rand));
  --cb-fenster-unten: calc(var(--cb-fab-unten) + var(--cb-fab) + 14px);
}

/* ---------------------------------------------------------------------------
   1  KNOPF
   --------------------------------------------------------------------------- */
.cb .cb-fab {
  position: fixed; right: var(--cb-rand); bottom: var(--cb-fab-unten); z-index: 85;
  width: var(--cb-fab); height: var(--cb-fab); padding: 0; margin: 0;
  display: grid; place-items: center; cursor: pointer;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--cb-hell-2) 50%, transparent);
  background: var(--cb-akzent); color: var(--cb-auf-akzent);
  box-shadow: var(--cb-schatten-akzent), 0 8px 22px -6px rgba(0, 0, 0, 0.38);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.cb .cb-fab:hover { transform: scale(1.06); }
.cb .cb-fab:active { transform: scale(0.96); }
.cb .cb-fab:focus-visible {
  border-radius: 50%;
  outline: 2px solid var(--cb-akzent-2); outline-offset: 3px;
}
.cb .cb-fab svg { width: 27px; height: 27px; display: block; }
.cb .cb-fab .cb-ic-zu { display: none; }
.cb .cb-fab[aria-expanded="true"] .cb-ic-chat { display: none; }
.cb .cb-fab[aria-expanded="true"] .cb-ic-zu { display: block; }
.cb .cb-punkt {
  position: absolute; top: 1px; right: 1px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--cb-akzent-hell); border: 2px solid var(--cb-akzent);
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
   2  FENSTER
   --------------------------------------------------------------------------- */
.cb .cb-fenster {
  position: fixed; right: var(--cb-rand); bottom: var(--cb-fenster-unten); z-index: 86;
  width: min(392px, calc(100vw - 32px));
  height: min(620px, calc(100vh - var(--cb-fenster-unten) - 24px));
  height: min(620px, calc(100dvh - var(--cb-fenster-unten) - 24px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--cb-hell); color: var(--cb-tinte);
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--cb-tinte) 10%, transparent);
  box-shadow: 0 34px 80px -24px rgba(0, 0, 0, 0.6), 0 10px 26px -12px rgba(0, 0, 0, 0.3);
  font-family: var(--cb-schrift); font-size: 15px; line-height: 1.5;
  text-align: left; letter-spacing: normal; text-transform: none;
  transform-origin: 100% 100%;
}
.cb .cb-fenster[hidden] { display: none; }
.cb .cb-fenster.cb-auf { animation: cbAuf 0.32s var(--cb-ease); }
.cb .cb-fenster:focus { outline: none; }
@keyframes cbAuf { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }

/* --- Kopf ------------------------------------------------------------------ */
.cb .cb-kopf {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 14px 12px 14px 16px;
  color: var(--cb-text);
  background:
    radial-gradient(130% 160% at 100% 0%, color-mix(in srgb, var(--cb-akzent) 34%, transparent), transparent 62%),
    var(--cb-dunkel);
  border-bottom: 1px solid color-mix(in srgb, var(--cb-akzent) 40%, transparent);
}
/* Logo-Platte: abgerundetes Rechteck, so breit wie das Logo es braucht (Hoch-,
   Quer- und Wortmarken werden nie angeschnitten). Runde Logos (logoForm "rund",
   vom Generator gemessen) bekommen eine Kreisplatte. */
.cb .cb-marke {
  flex: none; height: 48px; min-width: 48px; max-width: 116px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 5px 7px; box-sizing: border-box; border-radius: 12px;
  background: var(--cb-dunkel-0);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cb-text) 18%, transparent);
}
.cb .cb-marke--hell { background: var(--cb-hell-2); }
.cb .cb-marke--dunkel { background: var(--cb-dunkel-0); }
.cb .cb-marke img {
  display: block; height: 38px; width: auto; max-width: 102px;
  object-fit: contain; object-position: center;
}
.cb .cb-marke--rund { width: 48px; border-radius: 50%; padding: 4px; }
.cb .cb-marke--rund img { width: 40px; height: 40px; max-width: none; }
.cb .cb-marke--zeichen {
  background: var(--cb-akzent); color: var(--cb-auf-akzent);
  font-family: var(--cb-schrift-titel); font-size: 17px; line-height: 1; letter-spacing: 0.02em;
}
.cb .cb-kopf-text { min-width: 0; flex: 1 1 auto; }
.cb .cb-name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  margin: 0; overflow: hidden; color: var(--cb-text);
  font-family: var(--cb-schrift-titel); font-weight: 400; font-size: 18.5px; line-height: 1.15;
  overflow-wrap: anywhere;
}
.cb .cb-zeile { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.cb .cb-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; line-height: 1.3; color: var(--cb-text-weich);
}
.cb .cb-status i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #3fb57a; box-shadow: 0 0 0 3px rgba(63, 181, 122, 0.18); }
.cb .cb-demo {
  flex: none; padding: 2px 8px; border-radius: 999px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.3;
  color: var(--cb-text-weich);
  border: 1px solid color-mix(in srgb, var(--cb-text) 26%, transparent);
}
.cb .cb-zu {
  flex: none; width: 40px; height: 40px; margin: 0; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  border: 0; border-radius: 50%; background: transparent; color: var(--cb-text);
  transition: background-color 0.2s ease;
}
.cb .cb-zu:hover { background: color-mix(in srgb, var(--cb-text) 12%, transparent); }
.cb .cb-zu:focus-visible { border-radius: 50%; outline: 2px solid var(--cb-akzent-2); outline-offset: 1px; }
.cb .cb-zu svg { width: 18px; height: 18px; display: block; }

/* --- Verlauf --------------------------------------------------------------- */
.cb .cb-verlauf {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 16px 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cb-akzent) 7%, var(--cb-hell)), var(--cb-hell) 140px);
}
.cb .cb-msg {
  max-width: 86%; margin: 0; padding: 10px 14px;
  border-radius: 16px; white-space: pre-line; overflow-wrap: anywhere;
  font-size: 15px; line-height: 1.5;
  animation: cbMsg 0.26s ease both;
}
@keyframes cbMsg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cb .cb-bot {
  align-self: flex-start; color: var(--cb-tinte);
  background: var(--cb-hell-2); border: 1px solid var(--cb-linie);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.cb .cb-ich {
  align-self: flex-end; color: var(--cb-auf-akzent); background: var(--cb-akzent);
  border-bottom-right-radius: 6px;
}
.cb .cb-heute {
  display: block; margin-bottom: 6px; padding-bottom: 6px;
  border-bottom: 1px solid var(--cb-linie);
  font-weight: 700; color: var(--cb-tinte);
}
.cb .cb-aktionen { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; white-space: normal; }
.cb .cb-aktionen a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 15px;
  border-radius: 999px; text-decoration: none; cursor: pointer;
  font-size: 14px; font-weight: 650; line-height: 1.2;
  background: var(--cb-akzent); color: var(--cb-auf-akzent);
  border: 1px solid var(--cb-akzent);
  transition: filter 0.2s ease, background-color 0.2s ease;
}
.cb .cb-aktionen a + a {
  background: transparent; color: var(--cb-akzent-tinte);
  border-color: color-mix(in srgb, var(--cb-akzent-tinte) 55%, transparent);
}
.cb .cb-aktionen a:hover { filter: brightness(1.06); }
.cb .cb-aktionen a + a:hover { background: color-mix(in srgb, var(--cb-akzent) 9%, transparent); }
.cb .cb-aktionen a:focus-visible { border-radius: 999px; outline: 2px solid var(--cb-akzent-tinte); outline-offset: 2px; }
.cb .cb-aktionen svg { width: 15px; height: 15px; flex: none; }

.cb .cb-tippt {
  align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px;
  background: var(--cb-hell-2); border: 1px solid var(--cb-linie);
  border-radius: 16px; border-bottom-left-radius: 6px;
}
.cb .cb-tippt i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--cb-tinte-weich);
  animation: cbTippt 1.1s infinite;
}
.cb .cb-tippt i:nth-child(2) { animation-delay: 0.15s; }
.cb .cb-tippt i:nth-child(3) { animation-delay: 0.3s; }
@keyframes cbTippt { 0%, 60%, 100% { transform: none; opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* --- Themen-Knoepfe -------------------------------------------------------- */
.cb .cb-themen {
  flex: none; display: flex; flex-wrap: wrap; gap: 8px;
  padding: 4px 14px 12px; background: var(--cb-hell);
}
.cb .cb-themen--leiste {
  flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; padding-top: 8px;
  border-top: 1px solid var(--cb-linie);
}
.cb .cb-themen--leiste::-webkit-scrollbar { display: none; }
/* Rechts weich ausblenden: zeigt, dass die Leiste weiterlaeuft. Der Innenabstand
   rechts haelt den letzten Knopf am Ende des Rollwegs aus der Blende. */
.cb .cb-themen--leiste {
  padding-right: 34px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
}
.cb .cb-thema {
  flex: none; margin: 0; min-height: 38px; padding: 7px 14px; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--cb-linie-stark);
  background: var(--cb-hell-2); color: var(--cb-tinte);
  font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1.2; white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}
.cb .cb-thema:hover { border-color: var(--cb-akzent); color: var(--cb-akzent-tinte); }
.cb .cb-thema:focus-visible { border-radius: 999px; outline: 2px solid var(--cb-akzent-tinte); outline-offset: 2px; }

/* --- Eingabe --------------------------------------------------------------- */
.cb .cb-eingabe {
  flex: none; display: flex; align-items: center; gap: 8px; margin: 0;
  padding: 10px 12px; background: var(--cb-hell-2);
  border-top: 1px solid var(--cb-linie);
}
.cb .cb-eingabe input {
  flex: 1 1 auto; min-width: 0; min-height: 46px; margin: 0; padding: 10px 16px;
  border: 1px solid var(--cb-linie-stark); border-radius: 999px;
  background: var(--cb-hell); color: var(--cb-tinte);
  font-family: var(--cb-schrift); font-size: 16px; line-height: 1.3;   /* 16px: kein iOS-Zoom */
  -webkit-appearance: none; appearance: none;
}
.cb .cb-eingabe input::placeholder { color: var(--cb-tinte-weich); opacity: 1; }
.cb .cb-eingabe input:focus,
.cb .cb-eingabe input:focus-visible {
  border-radius: 999px; outline: none;
  border-color: var(--cb-akzent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cb-akzent) 20%, transparent);
}
.cb .cb-senden {
  flex: none; width: 46px; height: 46px; margin: 0; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  border: 0; border-radius: 50%;
  background: var(--cb-akzent); color: var(--cb-auf-akzent);
  transition: filter 0.2s ease;
}
.cb .cb-senden:hover { filter: brightness(1.07); }
.cb .cb-senden:focus-visible { border-radius: 50%; outline: 2px solid var(--cb-akzent-tinte); outline-offset: 2px; }
.cb .cb-senden svg { width: 19px; height: 19px; display: block; }
.cb .cb-fuss {
  flex: none; margin: 0; padding: 0 14px 10px;
  background: var(--cb-hell-2); color: var(--cb-tinte-weich);
  font-size: 11px; line-height: 1.4; text-align: center;
}

/* ---------------------------------------------------------------------------
   3  TELEFON
   --------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .cb { --cb-fab: 56px; --cb-rand: 14px; }
  /* Breite Wortmarken schmaler, damit Name und Statuszeile Platz behalten. */
  .cb .cb-marke { max-width: 86px; padding: 5px 6px; }
  .cb .cb-marke img { max-width: 74px; }
  .cb .cb-name { font-size: 17.5px; }
  .cb .cb-fenster {
    left: 10px; right: 10px; width: auto;
    height: auto; top: max(10px, env(safe-area-inset-top, 0px));
  }
  /* Tastatur offen: das Fenster fuellt den sichtbaren Ausschnitt (Hoehe UND
     Oberkante setzt chat.js aus visualViewport). */
  .cb .cb-fenster.cb-tastatur {
    left: 0; right: 0; bottom: auto; border-radius: 0; border: 0;
  }
}

/* ---------------------------------------------------------------------------
   4  WENIGER BEWEGUNG / DRUCK
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .cb .cb-fenster.cb-auf, .cb .cb-msg, .cb .cb-tippt i { animation: none; }
  .cb .cb-fab, .cb .cb-thema, .cb .cb-aktionen a, .cb .cb-zu { transition: none; }
  .cb .cb-fab:hover, .cb .cb-fab:active { transform: none; }
}
@media print { .cb { display: none !important; } }


/* Kopf im geoeffneten Chat: echtes Favicon des Hauses, rund */
.cb .cb-marke--fav { padding: 0; background: #fff; }
.cb .cb-marke--fav img { width: 48px; height: 48px; object-fit: cover; border-radius: 50%; }
