/*
 * sc-selina.css — Selina im Kundenportal (Betreiber 21.10.2026), zu sc-selina.js.
 * Dunkel wie das Portal (#0b0b0f, Akzent #4cb3d6, Montserrat), die Blase weiß wie auf der
 * Website. Ebenen: Vollbild-Schicht 45, Aktionsleiste 47, Selina 48, Modals 50 und höher.
 * Das Wurzelelement bekommt bewusst KEIN transform: Panel und Schleier sind am Handy
 * position: fixed und müssen sich auf das Fenster beziehen, nicht auf den Knopf.
 */
.sc-sel {
  --sc-sel-knopf: 56px;
  --sc-sel-akzent: #4cb3d6;
  --sc-sel-akzent-tinte: #06232e;
  --sc-sel-gruen: #48bf91;
  --sc-sel-flaeche: #141419;
  --sc-sel-flaeche-2: #1b1b22;
  --sc-sel-grund: #0b0b0f;
  --sc-sel-linie: #26262e;
  --sc-sel-linie-stark: #34343e;
  --sc-sel-text: #e5e5e9;
  --sc-sel-leise: #9b9ba6;
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--sc-sel-unten, 16px) + env(safe-area-inset-bottom, 0px));
  z-index: 48;
  width: var(--sc-sel-knopf);
  height: var(--sc-sel-knopf);
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  transition: bottom 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Unabhängig von Tailwinds Preflight: Maße gelten mit Rand und Innenabstand. */
.sc-sel,
.sc-sel *,
.sc-sel *::before,
.sc-sel *::after { box-sizing: border-box; }

.sc-sel-vorlesen {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Knopf ─────────────────────────────────────────────────────────────────────────── */
.sc-sel-knopf {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.sc-sel-knopf:hover { transform: scale(1.05); }
.sc-sel-knopf:focus-visible { outline: 2px solid var(--sc-sel-akzent); outline-offset: 3px; }
.sc-sel.is-ohne-knopf .sc-sel-knopf {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.sc-sel-avatar,
.sc-sel-kopfbild {
  position: relative;
  display: block;
}
.sc-sel-avatar { width: 100%; height: 100%; }
.sc-sel-avatar picture,
.sc-sel-kopfbild picture { display: block; width: 100%; height: 100%; }
.sc-sel-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--sc-sel-akzent);
  background: var(--sc-sel-flaeche-2);
}
.sc-sel-punkt {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--sc-sel-gruen);
  border: 2px solid var(--sc-sel-grund);
}

/* ── Chat-Panel (Desktop: über dem Knopf) ──────────────────────────────────────────── */
.sc-sel-schleier { display: none; }
.sc-sel-panel {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(22rem, calc(100vw - 2rem));
  /* Nie höher als der Platz über dem Knopf; der Grußbereich gibt dann nach. */
  max-height: calc(100vh - var(--sc-sel-unten, 16px) - var(--sc-sel-knopf) - 6rem);
  max-height: calc(100dvh - var(--sc-sel-unten, 16px) - var(--sc-sel-knopf) - 6rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--sc-sel-flaeche);
  color: var(--sc-sel-text);
  border: 1px solid var(--sc-sel-linie-stark);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}
.sc-sel.is-offen .sc-sel-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}
.sc-sel-panel:focus { outline: none; }

.sc-sel-kopf {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.5rem 0.625rem 1rem;
  background: var(--sc-sel-flaeche-2);
  border-bottom: 1px solid var(--sc-sel-linie);
}
.sc-sel-kopfbild { flex: none; width: 40px; height: 40px; }
.sc-sel-kopfbild img { display: block; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.sc-sel-kopfbild .sc-sel-punkt { width: 11px; height: 11px; right: -1px; bottom: -1px; border-color: var(--sc-sel-flaeche-2); }
.sc-sel-kopftext { flex: 1; min-width: 0; line-height: 1.15; }
.sc-sel-kopftext strong {
  display: block;
  font-family: 'Bebas Neue', 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 21px;
  letter-spacing: 0.04em;
  color: var(--sc-sel-text);
}
.sc-sel-kopftext span { font-size: 12px; color: var(--sc-sel-gruen); }
.sc-sel-zu {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--sc-sel-leise);
  cursor: pointer;
}
.sc-sel-zu:hover { background: rgba(255, 255, 255, 0.06); color: var(--sc-sel-text); }
.sc-sel-zu:focus-visible,
.sc-sel-senden:focus-visible,
.sc-sel-bezug button:focus-visible,
.sc-sel-anruf a:focus-visible { outline: 2px solid var(--sc-sel-akzent); outline-offset: 2px; }

.sc-sel-koerper {
  flex: 1 1 7rem;
  min-height: 3.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  background: var(--sc-sel-grund);
}
.sc-sel-nachricht {
  max-width: 88%;
  padding: 10px 14px;
  background: var(--sc-sel-flaeche-2);
  border: 1px solid var(--sc-sel-linie);
  border-radius: 4px 14px 14px 14px;
  color: var(--sc-sel-text);
  font-size: 14px;
  line-height: 1.45;
}
.sc-sel-bezug {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 4px 3px 10px;
  border: 1px solid rgba(76, 179, 214, 0.35);
  border-radius: 999px;
  background: rgba(76, 179, 214, 0.08);
  color: var(--sc-sel-leise);
  font-size: 12px;
}
.sc-sel-bezug[hidden] { display: none; }
.sc-sel-bezug span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-sel-bezug button {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
}

.sc-sel-fuss {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 12px 8px;
  background: var(--sc-sel-flaeche);
  border-top: 1px solid var(--sc-sel-linie);
}
.sc-sel-fuss textarea {
  flex: 1;
  min-width: 0;
  min-height: 2.75rem;
  max-height: 8rem;
  resize: none;
  padding: 0.6875rem 1rem;
  background: #0f0f14;
  border: 1px solid var(--sc-sel-linie-stark);
  border-radius: 1.375rem;
  color: var(--sc-sel-text);
  font-family: inherit;
  /* 16 px, nicht 14: Unter 16 px zoomt iOS beim Antippen in die ganze Seite. */
  font-size: 16px;
  line-height: 1.25;
}
.sc-sel-fuss textarea::placeholder { color: #6b6b76; }
.sc-sel-fuss textarea:focus-visible { outline: 2px solid var(--sc-sel-akzent); outline-offset: 1px; border-color: var(--sc-sel-akzent); }
.sc-sel-senden {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: var(--sc-sel-akzent);
  color: var(--sc-sel-akzent-tinte);
  cursor: pointer;
}
.sc-sel-senden:hover { background: #63c0e0; }
.sc-sel-anruf {
  flex: none;
  padding: 0 16px 12px;
  background: var(--sc-sel-flaeche);
  color: var(--sc-sel-leise);
  font-size: 12px;
}
.sc-sel-anruf a { color: var(--sc-sel-akzent); font-weight: 600; text-decoration: none; }
.sc-sel-anruf a:hover { text-decoration: underline; }

/* ── Spruch-Blase (links neben dem Knopf) ──────────────────────────────────────────── */
.sc-sel-blase {
  position: absolute;
  z-index: 3;
  right: calc(100% + 12px);
  bottom: 0;
  width: max-content;
  max-width: min(17rem, calc(100vw - var(--sc-sel-knopf) - 2.75rem));
  pointer-events: none;
}
.sc-sel.is-ohne-knopf .sc-sel-blase { display: none; }
.sc-sel-karte {
  position: relative;
  pointer-events: auto;
  padding: 0.75rem 2.25rem 0.75rem 0.875rem;
  background: #fff;
  color: #0b0b0b;
  border-radius: 1rem 1rem 0.25rem 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 0.875rem;
  line-height: 1.4;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform-origin: 100% 100%;
  animation: sc-sel-rein 0.22s ease-out both;
}
/* Zipfel Richtung Selina, auf halber Knopfhöhe */
.sc-sel-karte::after {
  content: '';
  position: absolute;
  right: -5px;
  bottom: calc(var(--sc-sel-knopf) / 2 - 6px);
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 0 3px 0 0;
  transform: rotate(45deg);
}
.sc-sel-blase.is-weg .sc-sel-karte { animation: sc-sel-raus 0.18s ease-in both; }
.sc-sel-text {
  display: block;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: inherit;
  text-decoration: none;
  cursor: pointer;
}
p.sc-sel-text { cursor: inherit; }
.sc-sel-zusatz {
  display: block;
  margin-top: 0.3rem;
  font-weight: 700;
  color: #126f91; /* 5,7 : 1 auf Weiß */
}
.sc-sel-blase-zu {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  display: grid;
  place-items: center;
  width: 1.625rem;
  height: 1.625rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #0b0b0b;
  opacity: 0.6;
  cursor: pointer;
}
/* Trefferfläche ~42 px, sichtbar bleibt der kleine Kreis */
.sc-sel-blase-zu::before { content: ''; position: absolute; inset: -0.5rem; }
.sc-sel-blase-zu:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }
.sc-sel-aktionen { display: flex; gap: 0.5rem; margin-top: 0.625rem; }
.sc-sel-wahl {
  min-width: 4rem;
  min-height: 2.375rem;
  padding: 0.375rem 1rem;
  border: 1.5px solid #0b0b0b;
  border-radius: 999px;
  background: transparent;
  color: #0b0b0b;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.sc-sel-wahl--ja { background: var(--sc-sel-akzent); border-color: var(--sc-sel-akzent); color: var(--sc-sel-akzent-tinte); }
/* Blauer Fokusring auf Weiß hat zu wenig Kontrast */
.sc-sel-blase :focus-visible { outline: 2px solid #0b0b0b; outline-offset: 2px; }

@keyframes sc-sel-rein {
  from { opacity: 0; transform: translateY(6px) scale(0.92); }
  to { opacity: 1; transform: none; }
}
@keyframes sc-sel-raus {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(4px) scale(0.96); }
}

/* ── Handy: Panel als Blatt von unten, über der Aktionsleiste ─────────────────────── */
@media (max-width: 768px) {
  .sc-sel {
    --sc-sel-knopf: 52px;
    right: max(12px, env(safe-area-inset-right, 0px));
  }
  .sc-sel-schleier {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    touch-action: none;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  }
  .sc-sel.is-offen .sc-sel-schleier { opacity: 1; visibility: visible; transition: opacity 0.2s ease, visibility 0s; }
  .sc-sel-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    /* Blatt mit fester Obergrenze statt Tastatur-Kleber (siehe Kopf von sc-selina.js) */
    max-height: min(78vh, 36rem);
    max-height: min(78dvh, 36rem);
    border-radius: 18px 18px 0 0;
    border-width: 1px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(24px);
    transform-origin: bottom center;
  }
  .sc-sel-kopf { position: relative; padding-top: 1.1rem; }
  .sc-sel-kopf::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 2px;
    background: var(--sc-sel-linie-stark);
  }
  .sc-sel.is-offen .sc-sel-knopf { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-sel,
  .sc-sel-knopf,
  .sc-sel-panel,
  .sc-sel-schleier { transition: none; }
  .sc-sel-knopf:hover { transform: none; }
  .sc-sel-karte,
  .sc-sel-blase.is-weg .sc-sel-karte { animation: none; }
}
