/* Ex-Log-Website: Website-Chat (chatbot.js) und die Chat-Einstiege der Seiten. Namensraum xc-* fuer den Chat,
   chat-cta* fuer die Abschnitte #bewerbung / #kontaktformular. Baut auf den Variablen aus site.css auf.
   Mobil zuerst (320/360/390 px), logische Eigenschaften fuer RTL. Nach jeder Aenderung ?v=N in fragments.html hochzaehlen.
   Kontrast: Weiss auf --cta (#EA580C) nur mit grosser, fetter Schrift (>= 18,7 px, AA fuer grosse Schrift). */

/* ---------- Seiten: nur mit / nur ohne JavaScript ---------- */
.js-only { display: none !important; }
.js .js-only { display: inline-flex !important; }
.js .btn-block.js-only { display: flex !important; }
.js .no-js-only { display: none !important; }

/* Orange Haupt-Aktion wie der Kontakt-Knopf der Kopfzeile */
.btn-cta {
    background: var(--cta);
    color: var(--white);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: .03em;
    box-shadow: 0 10px 22px rgba(234, 88, 12, .30);
}
.btn-cta:hover { background: var(--blue); color: var(--white); box-shadow: 0 10px 22px rgba(0, 78, 158, .30); }

.chat-cta {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.75rem;
    align-items: center;
    padding: clamp(1.5rem, 1rem + 3vw, 3rem);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.chat-cta > * { min-width: 0; }
.chat-cta-actions { display: flex; flex-direction: column; gap: .75rem; align-items: stretch; }
.chat-cta-actions .btn { width: 100%; }
@media (min-width: 900px) {
    .chat-cta { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 3rem; }
}
.chat-cta-card > p { margin-bottom: 1.25rem; }
.chat-cta-points { list-style: none; display: grid; gap: .6rem; margin: 0 0 1.75rem; }
.chat-cta-points li { position: relative; padding-inline-start: 1.75rem; }
.chat-cta-points li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: .55em;
    width: .7rem;
    height: .7rem;
    border-radius: 50%;
    background: var(--cta);
}
.chat-cta-note { margin-top: 1.25rem; font-size: .9rem; }
.terms-note { margin-top: 1.25rem; font-size: .95rem; }

/* ---------- Schwebender Chat-Knopf ---------- */
.xc-launcher {
    position: fixed;
    z-index: 60;
    right: max(1rem, env(safe-area-inset-right, 0px));
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 56px;
    padding: .55rem 1.25rem .55rem 1rem;
    border: 0;
    border-radius: 999px;
    background: var(--cta);
    color: var(--white);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: .03em;
    text-transform: uppercase;
    box-shadow: 0 12px 28px rgba(234, 88, 12, .35), 0 2px 6px rgba(11, 31, 58, .18);
    cursor: pointer;
    transition: background-color .2s ease, box-shadow .2s ease;
}
.xc-launcher:hover { background: var(--blue); box-shadow: 0 12px 28px rgba(0, 78, 158, .35); }
.xc-launcher:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.xc-launcher-icon { width: 1.6rem; height: 1.6rem; }
/* Mobil ueber der Aktionsleiste schweben (die Leiste ist hoechstens --action-h hoch). */
@media (max-width: 899.98px) {
    .js .xc-launcher { bottom: calc(var(--action-h) + env(safe-area-inset-bottom, 0px) + .75rem); }
}
html.xc-open .xc-launcher { display: none; }

/* ---------- Chat-Fenster ---------- */
.xc-panel {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: var(--white);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    overflow: hidden;
}
.xc-panel[hidden] { display: none; }
@media (max-width: 599.98px) {
    html.xc-open, html.xc-open body { overflow: hidden; }
}
@media (min-width: 600px) {
    .xc-panel {
        inset: auto;
        /* Physisch rechts: das Fenster traegt selbst dir="rtl", die Seite bleibt links-nach-rechts. */
        right: 1.5rem;
        bottom: 1.5rem;
        width: min(420px, calc(100vw - 3rem));
        height: min(700px, calc(100vh - 3rem));
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
    }
}
@media (prefers-reduced-motion: no-preference) {
    .xc-panel:not([hidden]) { animation: xc-in .25s cubic-bezier(.2, .7, .2, 1) both; }
}
@keyframes xc-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.xc-panel *, .xc-panel *::before, .xc-panel *::after { box-sizing: border-box; }
.xc-panel :focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

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

.xc-icon {
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
[dir="rtl"] .xc-icon-flip { transform: scaleX(-1); }

/* Kopf */
.xc-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: calc(.75rem + env(safe-area-inset-top, 0px)) max(.75rem, env(safe-area-inset-right, 0px)) .75rem max(1rem, env(safe-area-inset-left, 0px));
    background: linear-gradient(160deg, var(--blue-dark) 0%, var(--blue) 100%);
    color: var(--white);
}
@media (min-width: 600px) { .xc-head { padding: .85rem .75rem .85rem 1.15rem; } }
.xc-titles { flex: 1 1 auto; min-width: 0; }
.xc-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1.15;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--white);
}
.xc-subtitle { margin: .1rem 0 0; font-size: .85rem; color: rgba(255, 255, 255, .88); overflow-wrap: anywhere; }
.xc-lang {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 8.5rem;
    min-height: 44px;
    padding: .35rem .5rem;
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .12);
    color: var(--white);
    font: inherit;
    font-size: .95rem;
    text-overflow: ellipsis;
}
.xc-lang option { color: var(--ink); background: var(--white); }
.xc-lang[hidden] { display: none; }
.xc-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--white);
    cursor: pointer;
}
.xc-close:hover { background: rgba(255, 255, 255, .15); }
.xc-close .xc-icon { width: 1.5rem; height: 1.5rem; }
.xc-head :focus-visible { outline-color: var(--orange-light); }

/* Fortschritt */
.xc-progress { padding: .55rem 1rem .4rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.xc-progress[hidden] { display: none; }
.xc-progress-track { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.xc-progress-bar { width: 0; height: 100%; border-radius: 999px; background: var(--blue); transition: width .3s ease; }
.xc-progress-text { margin: .3rem 0 0; font-size: .8rem; font-weight: 600; color: var(--muted); }

/* Verlauf */
.xc-log {
    flex: 1 1 auto;
    min-height: 6rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--white);
}
.xc-log:focus { outline: none; }
.xc-msg {
    max-width: 88%;
    padding: .7rem .9rem;
    border-radius: 16px;
    overflow-wrap: anywhere;
    word-break: normal;
}
.xc-msg p { margin: 0; }
.xc-msg-text { white-space: pre-line; }
.xc-msg-bot {
    align-self: start;
    background: var(--surface);
    border: 1px solid var(--line);
    border-end-start-radius: 4px;
    color: var(--ink);
}
.xc-msg-user {
    align-self: end;
    background: var(--blue);
    color: var(--white);
    border-end-end-radius: 4px;
}
.xc-msg-pending { color: var(--muted); font-style: italic; }
.xc-msg-note { margin-top: .5rem !important; font-size: .8rem; color: var(--muted); }
.xc-facts { margin: .5rem 0 0; padding-inline-start: 1.15rem; display: grid; gap: .3rem; font-weight: 600; }
.xc-contact { display: grid; gap: .5rem; margin-top: .5rem; }
.xc-contact p { display: flex; flex-direction: column; }
.xc-contact a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 1.05rem; }
.xc-contact-label { font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.xc-break { overflow-wrap: anywhere; }
.xc-result { display: grid; gap: .5rem; }
.xc-result-title { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; text-transform: uppercase; color: var(--blue); }
.xc-result-note { font-size: .9rem; color: var(--muted); }

/* Eingabebereich */
.xc-controls {
    flex: 0 0 auto;
    max-height: 62%;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    background: var(--white);
    overflow-y: auto;
    overscroll-behavior: contain;
}
@media (min-width: 600px) { .xc-controls { padding-bottom: 1rem; } }
.xc-controls:empty { display: none; }

.xc-choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: .55rem; }
.xc-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    width: 100%;
    min-height: 52px;
    padding: .7rem 1rem;
    border: 2px solid var(--blue);
    border-radius: 14px;
    background: var(--white);
    color: var(--blue);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.xc-btn:hover { background: var(--blue-tint); }
.xc-btn-label { overflow-wrap: anywhere; }
.xc-btn-hint { font-weight: 400; font-size: .9rem; color: var(--muted); }
.xc-choice.xc-btn-primary { background: var(--blue); border-color: var(--blue); color: var(--white); }
.xc-choice.xc-btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.xc-choice.xc-btn-primary .xc-btn-hint { color: rgba(255, 255, 255, .92); }
/* Weiter / Absenden: Orange mit grosser, fetter Schrift */
.xc-btn-primary:not(.xc-choice) {
    flex-direction: row;
    gap: .5rem;
    border-color: var(--cta);
    background: var(--cta);
    color: var(--white);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.xc-btn-primary:not(.xc-choice):hover { background: var(--blue); border-color: var(--blue); }
.xc-btn-block { width: 100%; }
.xc-btn[disabled] { opacity: .7; cursor: progress; }
.xc-choice-compact { min-height: 48px; padding: .5rem .85rem; font-size: 1rem; }
.xc-country-list { max-height: 15.5rem; overflow-y: auto; padding: 2px; }

.xc-nav { display: flex; justify-content: flex-start; }
.xc-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 44px;
    padding: .25rem .25rem;
    border: 0;
    background: transparent;
    color: var(--blue);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: .18em;
    cursor: pointer;
}
.xc-link:hover { color: var(--blue-dark); }

/* Felder (gleiche Masse wie die Formulare der Website: 16 px, kein Zoom auf iOS) */
.xc-form { display: flex; flex-direction: column; gap: .7rem; margin: 0; }
.xc-field { min-width: 0; }
.xc-label { display: block; margin-bottom: .3rem; font-weight: 600; font-size: .95rem; color: var(--ink); }
.xc-input {
    display: block;
    width: 100%;
    min-height: 52px;
    padding: .7rem .85rem;
    border: 1.5px solid var(--field-border);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    line-height: 1.4;
}
.xc-textarea { min-height: 7rem; resize: vertical; }
.xc-select { padding-inline: .6rem; text-overflow: ellipsis; }
.xc-input:focus { outline: 2px solid transparent; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 78, 158, .25); }
.has-error .xc-input, .xc-form.has-error .xc-select { border-color: var(--error); }
.xc-hint { margin: .3rem 0 0; font-size: .85rem; color: var(--muted); }
.xc-error { margin: .3rem 0 0; font-size: .9rem; font-weight: 500; color: var(--error); }
.xc-error:empty { display: none; }

.xc-row { display: grid; gap: .6rem; }
.xc-row-street { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }
.xc-row-city { grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr); }
.xc-date-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .5rem; }
@media (max-width: 379.98px) {
    .xc-date-row { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); }
}

/* Einwilligung */
.xc-consent { padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: .95rem; }
.xc-consent p { margin: 0 0 .4rem; }
.xc-consent-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* Zusammenfassung */
.xc-summary { display: grid; gap: .1rem; margin: 0; }
.xc-summary-row { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.xc-summary-row dt { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.xc-summary-row dd { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0; }
.xc-summary-value { min-width: 0; overflow-wrap: anywhere; font-weight: 500; color: var(--ink); }
.xc-edit { flex: 0 0 auto; }

/* Honeypot */
.xc-hp { position: absolute; inset-inline-start: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

@media (forced-colors: active) {
    .xc-btn, .xc-launcher, .xc-msg, .xc-panel { border: 1px solid CanvasText; }
}
@media print {
    .xc-launcher, .xc-panel { display: none !important; }
}
