/* Hilfe-Assistent „Kalli“ auf www.sl-urlaubsplaner.de (_hilfe_chat/): Startknopf und Chatfenster.
   Grundgerüst und Verhalten wie der Hilfe-Chat von sl-up.com (gleiches Markup aus _hilfe_chat/kern/widget.php,
   gleiches js/hilfe-chat.js), die Optik ist eigen: hell, Website-Blau, Systemschrift wie die Seite, ruhige Ecken.
   Der eine auffällige Moment: Das Kalenderblatt klappt beim Öffnen im Kopf herunter, beim Nachdenken wippt es.
   Farben kommen als --hc-* aus dem Profil (Inline-Variablen am .hc-Element).

   Jede Regel steht unter .hc (mindestens zwei Klassen), damit Bootstrap 4 und modern-business.css der Seite das
   Widget nicht verändern und Widget-Regeln keine Seitenelemente treffen. */

.hc {
    --hc-schrift: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --hc-schrift-titel: var(--hc-schrift);
    --hc-text: var(--hc-tinte);
    --hc-text-2: #2c3e55;
    --hc-text-3: #55657a;
    --hc-linie: rgba(11, 58, 102, .12);
    --hc-weiss: #ffffff;
    --hc-schatten: 0 1px 2px rgba(11, 58, 102, .08), 0 10px 24px -6px rgba(11, 58, 102, .20), 0 32px 64px -24px rgba(11, 58, 102, .28);
    --hc-weich: cubic-bezier(.2, .8, .2, 1);
    /* Belegte Höhe fester Leisten am unteren Rand (Einwilligungsbanner, CTA-Leiste); setzt hilfe-chat.js. */
    --hc-unten: 0px;
    --hc-rand: 24px;
    position: fixed;
    right: var(--hc-rand);
    bottom: calc(var(--hc-rand) + var(--hc-unten));
    z-index: 900;
    font-family: var(--hc-schrift);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--hc-text);
    -webkit-font-smoothing: antialiased;
}
/* Erst nach der ersten Messung gleiten (kein Sprung beim Laden). */
.hc[data-unten-bereit] { transition: bottom .3s var(--hc-weich); }
.hc *, .hc *::before, .hc *::after { box-sizing: border-box; }
.hc button { font: inherit; }
.hc .hc-unsichtbar { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Avatar ------------------------------------------------------------------------------------------- */
.hc .hc-avatar { display: block; overflow: visible; }
.hc .hc-avatar-eigen svg { width: 100%; height: 100%; display: block; }
.hc .hc-strahl { fill: var(--hc-sonne); opacity: .55; }
.hc .hc-strahl-lang { opacity: .9; }
.hc .hc-strahlen { transform-origin: 32px 32px; transition: transform .6s var(--hc-weich); }
.hc .hc-augen { fill: var(--hc-tinte); transform-origin: 32px 29.5px; animation: hc-blinzeln 6s infinite; }
.hc .hc-mund { stroke: var(--hc-tinte); }
.hc .hc-wangen { fill: #f08a5d; opacity: .35; }
@keyframes hc-blinzeln { 0%, 46%, 50%, 100% { transform: scaleY(1); } 48% { transform: scaleY(.1); } }
.hc .hc-avatar-eigen .hc-augen { transform-origin: 32px 38px; }
.hc[data-denkt="1"] .hc-kopf .hc-avatar-eigen svg { transform-origin: 32px 55px; animation: hc-wippen 1.1s ease-in-out infinite; }
@keyframes hc-wippen { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-6deg); } 70% { transform: rotate(6deg); } }

/* Startknopf --------------------------------------------------------------------------------------- */
.hc .hc-start {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: 0;
    padding: .4rem 1.3rem .4rem .45rem;
    border: 0;
    border-radius: 999px;
    /* Gefüllt im Website-Blau: Ein weißer Knopf ging auf den weißen Seiten unter. */
    background: var(--hc-sonne);
    color: #fff;
    box-shadow: var(--hc-schatten);
    cursor: pointer;
    transition: transform .25s var(--hc-weich), background .25s var(--hc-weich);
}
/* Dezenter Puls-Ring alle 7 s, solange der Chat zu ist; das Kalenderblatt winkt etwa alle 11 s. */
.hc .hc-start::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    animation: hc-puls 7s ease-out 1.5s infinite;
}
@keyframes hc-puls {
    0% { box-shadow: 0 0 0 0 rgba(0, 104, 189, .45); }
    22%, 100% { box-shadow: 0 0 0 16px rgba(0, 104, 189, 0); }
}
.hc .hc-start .hc-avatar { width: 46px; height: 46px; padding: 4px; border-radius: 50%; background: #fff; }
.hc .hc-start .hc-avatar-eigen svg { transform-origin: 32px 55px; animation: hc-winken 11s ease-in-out 3s infinite; }
@keyframes hc-winken {
    0%, 86%, 100% { transform: rotate(0); }
    89% { transform: rotate(-10deg); }
    92% { transform: rotate(8deg); }
    95% { transform: rotate(-5deg); }
    98% { transform: rotate(2deg); }
}
.hc .hc-start-text { font-weight: 600; font-size: 1rem; letter-spacing: -.005em; white-space: nowrap; }
.hc .hc-start:hover { transform: translateY(-2px); background: var(--hc-tinte); }
.hc .hc-start:hover::after { animation: none; }
.hc .hc-start:hover .hc-strahlen { transform: rotate(30deg); }
.hc .hc-start:focus-visible, .hc button:focus-visible, .hc a:focus-visible {
    outline: 3px solid var(--hc-sonne);
    outline-offset: 3px;
}
.hc[data-zustand="offen"] .hc-start { display: none; }

/* Fenster ------------------------------------------------------------------------------------------ */
/* Am Desktop endet das Fenster oberhalb fester Leisten (--hc-unten), die Knöpfe des Banners bleiben bedienbar. */
.hc .hc-fenster {
    position: absolute;
    right: 0;
    bottom: 0;
    /* Wächst mit dem Bildschirm: breiter ab ca. 1360 px (30 % der Breite, höchstens 560 px), so hoch wie möglich bis
       960 px, lässt oben 72 px für die feste Navigation frei. Auf kleinen Höhen gilt wie bisher bis 660 px. */
    width: min(clamp(408px, 30vw, 560px), calc(100vw - 32px));
    height: max(
        min(660px, calc(100vh - 2 * var(--hc-rand) - var(--hc-unten))),
        min(960px, calc(100vh - 2 * var(--hc-rand) - var(--hc-unten) - 72px))
    );
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    background: var(--hc-papier);
    border-radius: 16px;
    box-shadow: var(--hc-schatten), 0 0 0 1px var(--hc-linie);
    overflow: hidden;
    transform-origin: bottom right;
    animation: hc-auf .42s var(--hc-weich);
}
.hc .hc-fenster[hidden] { display: none; }
@keyframes hc-auf { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }

.hc .hc-kopf {
    position: relative;
    display: flex;
    align-items: flex-end;
    grid-template-columns: none;
    align-items: center;
    gap: .9rem;
    margin: 0;
    padding: 1.1rem 1.1rem 1rem 1.2rem;
    background: linear-gradient(180deg, var(--hc-weiss) 0%, var(--hc-sonne-hell) 100%);
    border-bottom: 1px solid var(--hc-linie);
    color: var(--hc-tinte);
}
/* Horizont: die Sonne sitzt halb darüber und geht beim Öffnen auf. */
.hc .hc-horizont {
    position: relative;
    flex: none;
    width: 56px;
    height: 56px;
    perspective: 240px;
}
.hc .hc-horizont .hc-avatar {
    position: absolute;
    left: 0;
    top: 0;
    width: 56px;
    height: 56px;
    padding: 0;
    transform-origin: 50% 0;
    animation: hc-blatt .8s .08s var(--hc-weich) both;
}
@keyframes hc-blatt { from { opacity: 0; transform: rotateX(-80deg); } to { opacity: 1; transform: none; } }
.hc .hc-kopf-text { flex: 1; min-width: 0; padding-bottom: .1rem; }
.hc .hc-titel {
    margin: 0;
    padding: 0;
    font-family: var(--hc-schrift-titel);
    font-weight: 700;
    font-size: 1.45rem;
    line-height: 1.1;
    letter-spacing: -.02em;
    text-wrap: wrap;
    hyphens: manual;
    color: var(--hc-tinte);
}
.hc .hc-untertitel { margin: .25rem 0 0; font-size: .875rem; line-height: 1.35; color: var(--hc-text-3); }
.hc .hc-schliessen {
    flex: none;
    align-self: flex-start;
    width: 48px;
    height: 48px;
    margin: -.4rem -.35rem 0 0;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 104, 189, .08);
    cursor: pointer;
    transition: background .2s;
}
.hc .hc-schliessen:hover { background: rgba(0, 104, 189, .16); }
.hc .hc-schliessen svg { width: 18px; height: 18px; stroke: var(--hc-tinte); stroke-width: 2; stroke-linecap: round; fill: none; }

/* Verlauf ------------------------------------------------------------------------------------------ */
.hc .hc-verlauf {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0;
    padding: 1.25rem 1.1rem .5rem;
    scroll-behavior: smooth;
}
.hc .hc-nachricht { margin: 0 0 1rem; font-size: 1rem; line-height: 1.55; }
.hc .hc-nachricht p { margin: 0 0 .6em; padding: 0; line-height: inherit; }
.hc .hc-nachricht p:last-child { margin-bottom: 0; }
.hc .hc-nachricht ol, .hc .hc-nachricht ul { margin: .2em 0 .7em; padding-left: 1.3em; }
.hc .hc-nachricht li { margin: .28em 0; padding-left: .15em; }
.hc .hc-nachricht ol li::marker { color: var(--hc-tinte-2); font-weight: 700; }
.hc .hc-nachricht ul li::marker { color: var(--hc-sonne); }
.hc .hc-nachricht strong { font-weight: 650; color: var(--hc-tinte); }
/* Verweise auf Hilfeseiten (nur eigene Domains, siehe links_klickbar): lange Adressen dürfen umbrechen. */
.hc .hc-nachricht a { color: var(--hc-tinte-2); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.hc .hc-nachricht a:hover { color: var(--hc-tinte); }
.hc .hc-von-person a { color: #fff; }

.hc .hc-von-assistent {
    position: relative;
    max-width: 92%;
    padding: .85rem 1rem;
    background: var(--hc-weiss);
    border-radius: 4px 14px 14px 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 41, .05), 0 0 0 1px var(--hc-linie);
    color: var(--hc-text-2);
}
.hc .hc-von-person {
    margin-left: auto;
    width: fit-content;
    max-width: 82%;
    padding: .65rem .95rem;
    background: var(--hc-tinte-2);
    color: #fff;
    border-radius: 14px 14px 4px 14px;
    overflow-wrap: anywhere;
}
.hc .hc-neu { animation: hc-einblenden .35s var(--hc-weich) both; }
@keyframes hc-einblenden { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Vorschläge: je Zielgruppe eine Frage */
.hc .hc-vorschlaege { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.hc .hc-vorschlaege li { margin: 0; padding: 0; }
.hc .hc-vorschlag {
    width: 100%;
    height: 100%;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    margin: 0;
    padding: .7rem .8rem;
    text-align: left;
    background: transparent;
    border: 1.5px solid var(--hc-papier-2);
    border-radius: 12px;
    background: var(--hc-weiss);
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.hc .hc-vorschlag:hover { border-color: var(--hc-sonne); background: var(--hc-sonne-hell); }
.hc .hc-vorschlag-gruppe { font-size: .875rem; font-weight: 600; line-height: 1.3; color: var(--hc-tinte-2); }
.hc .hc-vorschlag-frage { font-size: 1rem; font-weight: 500; line-height: 1.35; color: var(--hc-tinte); }
.hc[data-gestartet="1"] .hc-vorschlaege { display: none; }

/* Denken */
.hc .hc-denkt { display: flex; align-items: center; gap: .6rem; color: var(--hc-text-3); font-size: .875rem; }
.hc .hc-punkte { display: inline-flex; gap: 4px; }
.hc .hc-punkte i { width: 6px; height: 6px; border-radius: 50%; background: var(--hc-sonne); animation: hc-punkt 1.2s infinite ease-in-out; }
.hc .hc-punkte i:nth-child(2) { animation-delay: .15s; }
.hc .hc-punkte i:nth-child(3) { animation-delay: .3s; }
@keyframes hc-punkt { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.hc .hc-fehler { color: #8a2c0d; background: #fff4ee; box-shadow: 0 0 0 1px #f6d3c2; }
/* landing.css kennt ein eigenes .hc-rest (Pille im Hero-Kalender): Darstellung hier vollständig festlegen. */
.hc .hc-nachricht .hc-rest {
    display: block;
    margin: .7em 0 0;
    padding: .6em 0 0;
    background: none;
    border: 0;
    border-top: 1px solid var(--hc-linie);
    border-radius: 0;
    font-size: .875rem;
    font-weight: 400;
    line-height: 1.45;
    white-space: normal;
    color: var(--hc-text-3);
}

/* Neues Gespräch: erst nach der ersten Antwort sichtbar, Klickfläche mindestens 48 px hoch */
.hc .hc-aktionen { flex: none; display: flex; justify-content: center; margin: 0; padding: 0 .85rem; }
.hc .hc-neues-gespraech {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 48px;
    margin: 0;
    padding: .4rem 1rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--hc-text-2);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.hc .hc-neues-gespraech[hidden] { display: none; }
.hc .hc-neues-gespraech svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hc .hc-neues-gespraech:hover:not(:disabled) { background: var(--hc-papier-2); color: var(--hc-text); }
.hc .hc-neues-gespraech:disabled { opacity: .4; cursor: default; }

/* Eingabe ------------------------------------------------------------------------------------------ */
.hc .hc-eingabe {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    margin: .4rem .85rem 0;
    padding: .3rem .3rem .3rem 1.1rem;
    background: var(--hc-weiss);
    border-radius: 14px;
    box-shadow: 0 0 0 1.5px var(--hc-papier-2);
    transition: box-shadow .2s;
}
.hc .hc-eingabe:focus-within { box-shadow: 0 0 0 2px var(--hc-sonne); }
/* 16 px: darunter zoomt iOS beim Fokus. */
.hc .hc-eingabe textarea {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    max-height: 132px;
    margin: 0;
    padding: .75rem 0;
    border: 0;
    resize: none;
    background: transparent;
    font: inherit;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--hc-text);
}
.hc .hc-eingabe textarea:focus, .hc .hc-eingabe textarea:focus-visible { outline: none; }
.hc .hc-eingabe textarea::placeholder { color: #667085; }
.hc .hc-senden {
    flex: none;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: var(--hc-sonne);
    cursor: pointer;
    transition: transform .2s var(--hc-weich), background .2s, opacity .2s;
}
.hc .hc-senden svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hc .hc-senden:hover:not(:disabled) { transform: scale(1.06); }
.hc .hc-senden:disabled { opacity: .4; cursor: default; }
.hc .hc-hinweis { margin: .55rem 1.1rem .75rem; padding: 0; font-size: .875rem; line-height: 1.45; color: var(--hc-text-3); text-align: center; }
/* Klickfläche 48 px hoch, ohne die Zeile zu verschieben (negativer Außenabstand gleicht den Innenabstand aus). */
.hc .hc-hinweis a {
    display: inline-block;
    padding: calc((48px - 1.45em) / 2) .35rem;
    margin: calc((1.45em - 48px) / 2) -.35rem;
    color: var(--hc-text-2);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Telefon: Fenster als Blatt über die ganze Fläche, dann auch über dem Einwilligungsbanner
   (Einwilligungsbanner der Seite). Am Desktop bleibt das Fenster darunter und endet oberhalb des Banners. */
@media (max-width: 560px) {
    .hc { --hc-rand: 16px; }
    .hc .hc-start { padding: .4rem; }
    .hc .hc-start-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .hc .hc-start .hc-avatar { width: 52px; height: 52px; }
    .hc[data-zustand="offen"] { inset: 0; z-index: 2147483001; }
    .hc .hc-fenster { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
    .hc .hc-vorschlaege { grid-template-columns: 1fr; }
}

/* Niedrige Bildschirme (Telefon quer): ganze Fläche, Kopf und Hinweis kompakt, damit der Verlauf Platz hat */
@media (max-height: 520px) {
    .hc[data-zustand="offen"] { inset: 0; z-index: 2147483001; }
    .hc .hc-fenster { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
    .hc .hc-kopf { padding: .45rem 1rem .45rem 1.1rem; align-items: center; }
    .hc .hc-horizont { width: 40px; height: 40px; }
    .hc .hc-horizont .hc-avatar { width: 40px; height: 40px; animation: none; }
    .hc .hc-titel { font-size: 1.15rem; }
    .hc .hc-untertitel { display: none; }
    .hc .hc-schliessen { align-self: center; margin: 0; }
    .hc .hc-verlauf { padding-top: .8rem; }
    .hc .hc-vorschlaege { grid-template-columns: repeat(4, 1fr); }
    .hc .hc-hinweis { margin: .35rem 1rem .5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .hc, .hc[data-unten-bereit] { transition: none; }
    .hc *, .hc *::before, .hc *::after { animation: none !important; transition: none !important; }
}

@media print {
    .hc { display: none !important; }
}
