/**
 * JARVIS Terminbuchung — öffentliches Frontend.
 * Cleanes, professionelles, responsives Design. Eine Primärfarbe (--jbt-primary)
 * führt alle interaktiven Zustände; Neutraltöne für Struktur. Farben kommen aus
 * --jbt-* (im Widget gesetzt), NICHT aus den JARVIS-CRM-Tokens.
 */
.jbt-widget {
    --jbt-primary: #2563EB;
    --jbt-secondary: #1E293B;
    --jbt-accent: #22C55E;

    --jbt-bg: #ffffff;
    --jbt-surface: #f7f8fa;
    --jbt-border: #e6e8ec;
    --jbt-border-strong: #d3d7de;
    --jbt-text: #111827;
    --jbt-heading: #0b1220;
    --jbt-muted: #6b7280;

    --jbt-danger: #dc2626;
    --jbt-danger-soft: #fef2f2;

    /* abgeleitete Primär-Töne (funktionieren mit jeder Primärfarbe) */
    --jbt-primary-tint: color-mix(in srgb, var(--jbt-primary) 10%, #fff);
    --jbt-primary-tint-strong: color-mix(in srgb, var(--jbt-primary) 16%, #fff);
    --jbt-primary-ring: color-mix(in srgb, var(--jbt-primary) 22%, transparent);
    --jbt-primary-hover: color-mix(in srgb, var(--jbt-primary) 88%, #000);

    --jbt-radius: 12px;
    --jbt-radius-sm: 9px;
    --jbt-radius-pill: 999px;
    --jbt-ctrl-h: 46px;

    max-width: 800px;
    margin: 32px auto;
    padding: 34px 34px 30px;
    background: var(--jbt-bg);
    border: 1px solid var(--jbt-border);
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(16, 24, 40, .12);
    color: var(--jbt-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
.jbt-widget *,
.jbt-widget *::before,
.jbt-widget *::after { box-sizing: border-box; }

.jbt-loading, .jbt-empty { color: var(--jbt-muted); padding: 14px 0; font-size: 15px; }
.jbt-error { color: var(--jbt-danger); }

/* ── Stepper ─────────────────────────────────────────────────────────────── */
.jbt-steps {
    display: flex; align-items: center; justify-content: center; gap: 24px; list-style: none;
    margin: 0 0 26px; padding: 0 0 18px; border-bottom: 1px solid var(--jbt-border);
}
.jbt-step {
    display: flex; align-items: center; gap: 9px; flex: 0 0 auto;
    color: var(--jbt-muted); font-size: 14px; min-width: 0;
    /* Theme-Reset: manche Themes geben <li> ein margin-bottom (mit li:last-child:0),
       was in der zentrierten Flexzeile die ersten Schritte nach oben schiebt → letzter
       Punkt wirkt tiefer. Marge/Padding hier hart nullen. */
    margin: 0; padding: 0;
}
.jbt-step__num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--jbt-bg); border: 1.5px solid var(--jbt-border-strong);
    font-size: 13px; font-weight: 600; flex: none; color: var(--jbt-muted);
    transition: background .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
}
.jbt-step.is-active { color: var(--jbt-heading); font-weight: 600; }
.jbt-step.is-active .jbt-step__num {
    background: var(--jbt-primary); color: #fff; border-color: var(--jbt-primary);
    box-shadow: 0 0 0 4px var(--jbt-primary-ring);
}
.jbt-step.is-done .jbt-step__num {
    background: var(--jbt-primary-tint-strong); color: var(--jbt-primary);
    border-color: color-mix(in srgb, var(--jbt-primary) 35%, #fff);
}
/*
 * Animierte Labels: der aktive Schritt ist voll ausgeschrieben, die anderen sind
 * gekürzt (Ellipsis). Beim Schrittwechsel wächst/schrumpft die max-width weich, und
 * da die Leiste zentriert ist, rutscht der aktive Schritt sanft in die Mitte.
 */
.jbt-step__label {
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    max-width: 76px; opacity: .6;
    transition: max-width .4s cubic-bezier(.4, 0, .2, 1), opacity .3s ease, margin .4s ease;
}
.jbt-step.is-active .jbt-step__label { max-width: 320px; opacity: 1; }

.jbt-intro { color: var(--jbt-muted); margin: -6px 0 20px; font-size: 15px; }

/* ── Terminarten ─────────────────────────────────────────────────────────── */
.jbt-types { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .jbt-types { grid-template-columns: repeat(2, 1fr); } }
.jbt-type {
    position: relative; display: flex; flex-direction: column; gap: 5px;
    align-items: flex-start; text-align: left; padding: 16px 18px;
    border: 1px solid var(--jbt-border); border-radius: var(--jbt-radius);
    background: var(--jbt-bg); cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .12s, background .15s;
}
.jbt-type:hover { border-color: var(--jbt-border-strong); box-shadow: 0 6px 18px -10px rgba(16,24,40,.25); transform: translateY(-1px); }
.jbt-type:focus-visible { outline: none; border-color: var(--jbt-primary); box-shadow: 0 0 0 3px var(--jbt-primary-ring); }
.jbt-type[aria-pressed="true"] {
    border-color: var(--jbt-primary); background: var(--jbt-primary-tint);
    box-shadow: 0 0 0 1px var(--jbt-primary);
}
.jbt-type__title { font-weight: 600; font-size: 16px; color: var(--jbt-heading); }
.jbt-type__desc { color: var(--jbt-muted); font-size: 14px; }
.jbt-type__dur {
    margin-top: 4px; font-size: 12.5px; color: var(--jbt-primary); font-weight: 600;
    background: var(--jbt-primary-tint-strong); padding: 3px 10px; border-radius: var(--jbt-radius-pill);
}

/* ── Gesprächsart ────────────────────────────────────────────────────────── */
.jbt-modes { margin-top: 28px; text-align: center; }
.jbt-modes__q { font-weight: 600; margin: 0 0 18px; color: var(--jbt-heading); font-size: 19px; }
.jbt-mode-group { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.jbt-mode {
    min-height: var(--jbt-ctrl-h); padding: 0 22px; border: 1px solid var(--jbt-border-strong);
    border-radius: var(--jbt-radius-sm); background: var(--jbt-bg); cursor: pointer;
    font-size: 15px; font-weight: 500; color: var(--jbt-text);
    transition: border-color .15s, background .15s, color .15s;
}
.jbt-mode:hover { border-color: var(--jbt-primary); background: var(--jbt-primary-tint); }
.jbt-mode:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--jbt-primary-ring); }
.jbt-mode.is-selected { background: var(--jbt-primary); color: #fff; border-color: var(--jbt-primary); }

/* ── Datum + Zeit ────────────────────────────────────────────────────────── */
/* Kalender oben, Uhrzeiten darunter (untereinander) — der Kalender bekommt so die
   volle Breite und wirkt nicht mehr gequetscht. */
.jbt-datetime { display: block; margin-top: 8px; }
.jbt-cal { max-width: 460px; margin: 0 auto; }
.jbt-slots { margin-top: 22px; }
.jbt-slot-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.jbt-cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.jbt-cal__title { font-weight: 600; color: var(--jbt-heading); text-transform: capitalize; font-size: 15px; }
.jbt-cal__nav {
    width: 36px; height: 36px; border-radius: var(--jbt-radius-sm); border: 1px solid var(--jbt-border-strong);
    background: var(--jbt-bg); cursor: pointer; font-size: 15px; color: var(--jbt-text);
    display: inline-flex; align-items: center; justify-content: center;
    transition: border-color .15s, background .15s;
}
.jbt-cal__nav:hover:not(:disabled) { border-color: var(--jbt-primary); background: var(--jbt-primary-tint); }
.jbt-cal__nav:disabled { opacity: .35; cursor: not-allowed; }
.jbt-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.jbt-cal__wd { text-align: center; font-size: 11.5px; color: var(--jbt-muted); padding: 2px 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.jbt-cal__cell {
    aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 14px; border: 1.5px solid transparent; color: var(--jbt-text);
    transition: background .12s, color .12s, border-color .12s;
}
.jbt-cal__cell.is-empty { border: none; }
.jbt-cal__cell.is-disabled { color: var(--jbt-muted); opacity: .45; }
.jbt-cal__cell.is-available {
    background: var(--jbt-primary-tint); color: var(--jbt-primary); font-weight: 600; cursor: pointer;
}
.jbt-cal__cell.is-available:hover { background: var(--jbt-primary-tint-strong); }
.jbt-cal__cell.is-available:focus-visible { outline: none; border-color: var(--jbt-primary); }
.jbt-cal__cell.is-selected, .jbt-cal__cell.is-selected:hover { background: var(--jbt-primary); color: #fff; }

.jbt-slots__title { margin: 0 0 12px; font-size: 15px; color: var(--jbt-heading); font-weight: 600; text-transform: capitalize; }
.jbt-slots__hint { color: var(--jbt-muted); font-size: 15px; }
.jbt-slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.jbt-slot {
    min-height: 42px; padding: 0 6px; border: 1px solid var(--jbt-border-strong);
    border-radius: var(--jbt-radius-sm); background: var(--jbt-bg); cursor: pointer;
    font-size: 14px; font-weight: 600; color: var(--jbt-text); text-align: center;
    transition: border-color .12s, background .12s, color .12s;
}
.jbt-slot:hover { border-color: var(--jbt-primary); background: var(--jbt-primary-tint); color: var(--jbt-primary); }
.jbt-slot:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--jbt-primary-ring); }
.jbt-slot.is-selected { background: var(--jbt-primary); color: #fff; border-color: var(--jbt-primary); }

/* ── Kontaktformular ─────────────────────────────────────────────────────── */
.jbt-summary {
    background: var(--jbt-surface); border: 1px solid var(--jbt-border);
    border-radius: var(--jbt-radius); padding: 16px 18px; margin: 6px 0 22px;
}
.jbt-summary__row { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; font-size: 15px; }
.jbt-summary__row + .jbt-summary__row { border-top: 1px solid var(--jbt-border); }
.jbt-summary__k { color: var(--jbt-muted); }
.jbt-summary__v { font-weight: 600; text-align: right; color: var(--jbt-heading); }

.jbt-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.jbt-field { display: flex; flex-direction: column; gap: 6px; }
.jbt-field--check { grid-column: 1 / -1; }
.jbt-field label { font-size: 13.5px; font-weight: 600; color: var(--jbt-heading); }
.jbt-field input:not([type="checkbox"]), .jbt-field select {
    height: var(--jbt-ctrl-h); padding: 0 13px; border: 1px solid var(--jbt-border-strong);
    border-radius: var(--jbt-radius-sm); font-size: 15px; width: 100%;
    background: var(--jbt-bg); color: var(--jbt-text); font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.jbt-field select { cursor: pointer; }
.jbt-field input:focus, .jbt-field select:focus {
    outline: none; border-color: var(--jbt-primary); box-shadow: 0 0 0 3px var(--jbt-primary-ring);
}
.jbt-field--check label { display: flex; align-items: flex-start; gap: 9px; font-weight: 400; font-size: 14.5px; color: var(--jbt-text); }
.jbt-field--check input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--jbt-primary); flex: none; }
.jbt-check-text { flex: 1 1 auto; min-width: 0; line-height: 1.5; }
.jbt-field--check a { color: var(--jbt-primary); }
.jbt-req { color: var(--jbt-danger); font-weight: 700; }
.jbt-err { color: var(--jbt-danger); font-size: 13px; min-height: 1em; }
.jbt-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Aktionszeile: Buttons unten rechts. Auf Schritt 3 stehen hier Zurück + Buchen. */
.jbt-actions { grid-column: 1 / -1; margin-top: 8px; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.jbt-nav { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 24px; }
.jbt-btn {
    min-height: var(--jbt-ctrl-h); padding: 0 26px; border-radius: var(--jbt-radius-sm);
    border: 1px solid var(--jbt-border-strong); background: var(--jbt-bg); cursor: pointer;
    font-size: 15px; font-weight: 600; color: var(--jbt-text); font-family: inherit;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.jbt-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--jbt-primary-ring); }
.jbt-btn--primary {
    background: var(--jbt-primary); border-color: var(--jbt-primary); color: #fff;
    box-shadow: 0 1px 2px rgba(16,24,40,.12);
}
.jbt-btn--primary:hover { background: var(--jbt-primary-hover); border-color: var(--jbt-primary-hover); }
.jbt-btn--primary:active { transform: translateY(1px); }
.jbt-btn:disabled { opacity: .55; cursor: default; }
/* Zurück: echter Button im Stil des Submit-Buttons, aber neutral (outline). */
.jbt-btn--back { background: var(--jbt-bg); border-color: var(--jbt-border-strong); color: var(--jbt-text); }
.jbt-btn--back:hover { border-color: var(--jbt-primary); color: var(--jbt-primary); background: var(--jbt-primary-tint); }
.jbt-form-msg { grid-column: 1 / -1; min-height: 1em; }
.jbt-form-msg.jbt-error { color: var(--jbt-danger); font-weight: 500; }
.jbt-form-msg .jbt-btn { margin-top: 8px; }

/* ── Erfolg ──────────────────────────────────────────────────────────────── */
.jbt-success { text-align: center; padding: 20px 8px; }
.jbt-success__icon {
    width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 50%;
    background: var(--jbt-primary); color: #fff; font-size: 34px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 8px var(--jbt-primary-tint);
}
.jbt-success h3 { margin: 0 0 6px; color: var(--jbt-heading); font-size: 20px; }
.jbt-success .jbt-summary { text-align: left; max-width: 420px; margin: 18px auto; }
.jbt-ref { color: var(--jbt-muted); font-size: 12.5px; word-break: break-all; }
.jbt-teams-hint { color: var(--jbt-muted); font-size: 15px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .jbt-widget { padding: 22px 18px; margin: 0 auto; border-radius: 0; border-left: none; border-right: none; }
    .jbt-form { grid-template-columns: 1fr; }
    .jbt-cal { max-width: none; }
    /* Stepper mobil: zentriert (Basis justify-content:center), nur der aktive Schritt
       zeigt seinen Namen; die anderen sind nur Nummern. Weicher Übergang bleibt. */
    .jbt-step:not(.is-active) .jbt-step__label { max-width: 0; opacity: 0; margin: 0; }
    .jbt-step.is-active .jbt-step__label { max-width: 60vw; }
    /* Aktionszeilen stapeln, Buttons volle Breite (Submit unten, gut erreichbar). */
    .jbt-actions, .jbt-nav { flex-direction: column; align-items: stretch; }
    .jbt-actions .jbt-btn, .jbt-nav .jbt-btn { width: 100%; }
}

/*
 * Bewusst KEIN prefers-color-scheme:dark — das Widget lebt auf einer öffentlichen
 * (i.d.R. hellen) Kundenseite und soll unabhängig vom Betriebssystem-Theme konsistent
 * in den konfigurierten Farben auf hellem Grund erscheinen.
 */
