/*
 * NhPanel – Live-Chat (Chatfenster in Shop und Kundenkonto, live-chat.js). Schrift kommt von der Seite.
 * Sprache eines Messengers: eigene Nachrichten in der Markenfarbe, Team mit dem Nexthosting-Zeichen, gruppierte
 * Folgenachrichten, Tagestrenner, Lesebestätigung, Tipp-Punkte. Hell als Grundlage, Dunkel über html.nh-dark.
 */
.nhlc {
    --lc-surface: #ffffff;
    --lc-page: #f5f6f9;
    --lc-ink: #0f172a;
    --lc-text: #334155;
    --lc-muted: #64748b;
    --lc-line: #e2e6ee;
    --lc-field: #c9d0dc;
    --lc-primary: #5143d9;
    --lc-primary-ink: #ffffff;
    --lc-primary-hover: #4335c4;
    --lc-own: #5143d9;
    --lc-own-ink: #ffffff;
    --lc-support: #ffffff;
    --lc-on: #16a34a;
    --lc-red: #dc2626;
    --lc-off: #94a3b8;
    --lc-danger: #b42318;
    --lc-shadow: 0 18px 50px rgba(15, 23, 42, .16), 0 2px 8px rgba(15, 23, 42, .06);
    --lc-focus: 0 0 0 3px rgba(81, 67, 217, .28);
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1040;
    font: inherit;
    font-size: 15px;
    line-height: 1.45;
    color: var(--lc-text);
}

html.nh-dark .nhlc {
    --lc-surface: #1a1c22;
    --lc-page: #131519;
    --lc-ink: #eef0f4;
    --lc-text: #cfd5df;
    --lc-muted: #959fb1;
    --lc-line: #2e323c;
    --lc-field: #464c59;
    --lc-primary: #7c70f0;
    --lc-primary-ink: #0d0b24;
    --lc-primary-hover: #968cf5;
    --lc-own: #5a4de0;
    --lc-own-ink: #ffffff;
    --lc-support: #23262e;
    --lc-off: #6b7486;
    --lc-danger: #f97066;
    --lc-shadow: 0 18px 50px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
}

.nhlc *, .nhlc *::before, .nhlc *::after { box-sizing: border-box; }
.nhlc [hidden] { display: none !important; }
.nhlc-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Nexthosting-Zeichen als Absender des Teams; Anwesenheitspunkt in der Ecke */
.nhlc-av {
    position: relative;
    display: inline-flex;
    flex: none;
    width: 28px;
    height: 28px;
}
.nhlc-av svg { width: 100%; height: 100%; display: block; }
.nhlc-av--gap { visibility: hidden; }
.nhlc-av--launch { width: 32px; height: 32px; }
.nhlc-av--head { width: 40px; height: 40px; }
.nhlc-dot {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 12px;
    height: 12px;
    border: 2.5px solid var(--lc-surface);
    border-radius: 50%;
    background: var(--lc-off);
}
.nhlc-dot.is-on { background: var(--lc-on); }
.nhlc-dot.is-off { background: var(--lc-red); }

/* Lasche unten rechts */
.nhlc-launch {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    height: 54px;
    padding: 0 18px 0 11px;
    border: 1px solid var(--lc-line);
    border-radius: 15px;
    background: var(--lc-surface);
    color: var(--lc-ink);
    font: inherit;
    text-align: left;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12), 0 1px 3px rgba(15, 23, 42, .06);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}
.nhlc-launch:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(15, 23, 42, .16), 0 1px 3px rgba(15, 23, 42, .06); }
.nhlc-launch:focus-visible { outline: none; box-shadow: var(--lc-focus); }
.nhlc-launch-text { display: flex; flex-direction: column; line-height: 1.2; }
.nhlc-launch-title { font-size: 15px; font-weight: 650; }
.nhlc-launch-sub { margin-top: 1px; font-size: 12.5px; color: var(--lc-muted); }
.nhlc-launch.is-unread { border-color: var(--lc-primary); }
.nhlc-launch.is-unread .nhlc-launch-sub { color: var(--lc-primary); font-weight: 650; }
.nhlc.is-open .nhlc-launch { display: none; }

/* Fenster */
.nhlc-panel {
    display: flex;
    flex-direction: column;
    width: 392px;
    height: min(620px, calc(100vh - 40px));
    margin: 0;
    padding: 0;
    border: 1px solid var(--lc-line);
    border-radius: 18px;
    background: var(--lc-surface);
    box-shadow: var(--lc-shadow);
    overflow: hidden;
    animation: nhlcIn .18s ease-out both;
}
.nhlc-panel.nhlc-panel--short { height: auto; }
.nhlc-panel--short .nhlc-body { flex: none; padding-bottom: 18px; background: var(--lc-surface); }
.nhlc-panel--short .nhlc-small a { color: var(--lc-primary); }
@keyframes nhlcIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .nhlc-panel, .nhlc-msg.is-new { animation: none; } .nhlc-launch { transition: none; } }

.nhlc-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px 14px 16px;
    border-bottom: 1px solid var(--lc-line);
    background: var(--lc-surface);
}
.nhlc-head-main { flex: 1; min-width: 0; }
.nhlc-title { margin: 0; padding: 0; color: var(--lc-ink); font-size: 15.5px; font-weight: 700; line-height: 1.25; letter-spacing: -.005em; }
.nhlc-status { margin-top: 2px; color: var(--lc-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nhlc-hours { margin-top: 2px; color: var(--lc-muted); font-size: 12px; line-height: 1.4; }
.nhlc-hours.is-off { color: var(--lc-text); }
.nhlc-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--lc-muted);
    cursor: pointer;
}
.nhlc-x:hover { background: var(--lc-page); color: var(--lc-ink); }
.nhlc-x:focus-visible { outline: none; box-shadow: var(--lc-focus); }
.nhlc-x svg { width: 18px; height: 18px; }

.nhlc-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 14px 10px;
    background: var(--lc-page);
}

/* Gespräch */
.nhlc-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.nhlc-list > li { margin: 0; }
.nhlc-day {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 8px !important;
    color: var(--lc-muted);
    font-size: 12px;
    font-weight: 600;
}
.nhlc-day::before, .nhlc-day::after { content: ''; flex: 1; height: 1px; background: var(--lc-line); }

.nhlc-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; margin-top: 10px !important; }
.nhlc-msg.is-cont { margin-top: 3px !important; }
.nhlc-msg--own { align-self: flex-end; justify-content: flex-end; }
.nhlc-msg--support { align-self: flex-start; }
.nhlc-col { display: flex; flex-direction: column; min-width: 0; }
.nhlc-msg--own .nhlc-col { align-items: flex-end; }
.nhlc-msg--support .nhlc-col { align-items: flex-start; }
.nhlc-msg--support .nhlc-av { margin-bottom: 20px; }
.nhlc-msg--support.has-next .nhlc-av { margin-bottom: 0; }

.nhlc-bubble {
    padding: 8px 13px 9px;
    border-radius: 18px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 15px;
    line-height: 1.42;
}
.nhlc-msg--own .nhlc-bubble { background: var(--lc-own); color: var(--lc-own-ink); }
.nhlc-msg--support .nhlc-bubble { background: var(--lc-support); color: var(--lc-ink); box-shadow: inset 0 0 0 1px var(--lc-line); }
/* Gruppen: Ecken zur Gruppe hin enger, wie im Messenger */
.nhlc-msg--own.has-next .nhlc-bubble { border-bottom-right-radius: 6px; }
.nhlc-msg--own.is-cont .nhlc-bubble { border-top-right-radius: 6px; }
.nhlc-msg--support.has-next .nhlc-bubble { border-bottom-left-radius: 6px; }
.nhlc-msg--support.is-cont .nhlc-bubble { border-top-left-radius: 6px; }
.nhlc-msg--own .nhlc-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.nhlc-msg--support .nhlc-bubble a { color: var(--lc-primary); text-decoration: underline; text-underline-offset: 2px; }
.nhlc-msg.is-pending .nhlc-bubble { opacity: .55; }
.nhlc-meta { margin: 4px 6px 0; color: var(--lc-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.nhlc-receipt.is-seen { color: var(--lc-primary); font-weight: 600; }

.nhlc-note {
    align-self: stretch;
    margin: 14px 0 4px !important;
    padding: 0 6px;
    color: var(--lc-muted);
    font-size: 12.5px;
    line-height: 1.45;
    text-align: center;
}
.nhlc-note a { color: var(--lc-primary); }
.nhlc-system { align-self: center; max-width: 92%; margin: 10px 0 0 !important; color: var(--lc-muted); font-size: 12px; text-align: center; white-space: pre-wrap; }

/* „schreibt …“ als Blase mit drei Punkten */
.nhlc-typing { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.nhlc-dots {
    display: inline-flex;
    gap: 4px;
    padding: 12px 13px;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    background: var(--lc-support);
    box-shadow: inset 0 0 0 1px var(--lc-line);
}
.nhlc-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--lc-muted); opacity: .35; animation: nhlcDot 1.2s infinite ease-in-out; }
.nhlc-dots i:nth-child(2) { animation-delay: .15s; }
.nhlc-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes nhlcDot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .nhlc-dots i { animation: none; opacity: .6; } }

/* Eingabe */
.nhlc-foot { padding: 10px 12px 10px; border-top: 1px solid var(--lc-line); background: var(--lc-surface); }
.nhlc-compose {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 5px 5px 5px 14px;
    border: 1px solid var(--lc-field);
    border-radius: 22px;
    background: var(--lc-surface);
}
.nhlc-compose:focus-within { border-color: var(--lc-primary); box-shadow: var(--lc-focus); }
.nhlc-input {
    flex: 1;
    min-width: 0;
    max-height: 140px;
    padding: 7px 0;
    border: 0;
    background: transparent;
    color: var(--lc-ink);
    font: inherit;
    font-size: 15px;
    line-height: 1.4;
    resize: none;
}
.nhlc-input:focus { outline: none; }
.nhlc-input::placeholder { color: var(--lc-muted); }
.nhlc-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--lc-primary);
    color: var(--lc-primary-ink);
    cursor: pointer;
}
.nhlc-send svg { width: 18px; height: 18px; }
.nhlc-send:hover { background: var(--lc-primary-hover); }
.nhlc-send:focus-visible { outline: none; box-shadow: var(--lc-focus); }
.nhlc-send[disabled] { opacity: .5; cursor: default; }
.nhlc-foot-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 0 4px; font-size: 12px; color: var(--lc-muted); }
.nhlc-foot-row a { color: var(--lc-muted); text-decoration: none; }
.nhlc-foot-row a:hover { color: var(--lc-ink); text-decoration: underline; }
.nhlc-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--lc-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.nhlc-link:hover { color: var(--lc-ink); text-decoration: underline; }

/* Startformular */
.nhlc-form { display: flex; flex-direction: column; gap: 12px; padding: 14px 4px 4px; }
.nhlc-greeting { margin: 4px 0 -6px; color: var(--lc-ink); font-size: 21px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.nhlc-intro { margin: 0; color: var(--lc-text); font-size: 14.5px; }
.nhlc-intro a { color: var(--lc-primary); }
.nhlc-field { display: flex; flex-direction: column; gap: 5px; }
.nhlc-field label { color: var(--lc-ink); font-size: 13px; font-weight: 600; }
.nhlc-field input, .nhlc-field select, .nhlc-field textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--lc-field);
    border-radius: 12px;
    background: var(--lc-surface);
    color: var(--lc-ink);
    font: inherit;
    font-size: 15px;
    line-height: 1.4;
}
.nhlc-field textarea { min-height: 104px; resize: vertical; }
.nhlc-field input:focus, .nhlc-field select:focus, .nhlc-field textarea:focus { outline: none; border-color: var(--lc-primary); box-shadow: var(--lc-focus); }
.nhlc-field textarea::placeholder { color: var(--lc-muted); }
.nhlc-primary {
    width: 100%;
    height: 46px;
    margin-top: 2px;
    border: 0;
    border-radius: 12px;
    background: var(--lc-primary);
    color: var(--lc-primary-ink);
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    cursor: pointer;
}
.nhlc-primary:hover { background: var(--lc-primary-hover); }
.nhlc-primary:focus-visible { outline: none; box-shadow: var(--lc-focus); }
.nhlc-primary[disabled] { opacity: .55; cursor: default; }
.nhlc-button { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.nhlc-button.nhlc-primary:hover { color: var(--lc-primary-ink); }
.nhlc-secondary {
    height: 46px;
    border: 1px solid var(--lc-field);
    border-radius: 12px;
    background: var(--lc-surface);
    color: var(--lc-ink);
    font-size: 15px;
    font-weight: 600;
}
.nhlc-secondary:hover { border-color: var(--lc-primary); color: var(--lc-ink); }
.nhlc-secondary:focus-visible { outline: none; box-shadow: var(--lc-focus); }
.nhlc-small { margin: 0; color: var(--lc-muted); font-size: 12.5px; }
.nhlc-small a { color: var(--lc-muted); }
.nhlc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.nhlc-error { margin: 0; color: var(--lc-danger); font-size: 13.5px; font-weight: 600; }
.nhlc-captcha:empty { display: none; }
.nhlc-offline { padding: 6px 16px; background: var(--lc-page); color: var(--lc-muted); font-size: 12.5px; border-top: 1px solid var(--lc-line); }

@media (max-width: 520px) {
    .nhlc { right: 12px; bottom: 12px; }
    .nhlc.is-open { left: 8px; right: 8px; bottom: 8px; }
    .nhlc-panel { width: 100%; height: min(660px, calc(100dvh - 16px)); }
    .nhlc-launch { height: 48px; padding: 0 14px 0 9px; }
    .nhlc-launch-sub { display: none; }
}

/* Ticketseite im Kundenkonto: „Support schreibt …“ über dem Verlauf (live-chat.js) */
.nh-live-typing { display: flex; align-items: center; gap: 8px; min-height: 22px; margin: 0 0 8px; color: var(--nh-muted, #5b6b82); font-size: .86rem; }
.nh-live-typing:empty { display: none; }
.nh-live-typing .nhlc-dots { padding: 9px 11px; }
.nh-msg.nh-live-new { animation: nhlcIn .2s ease-out both; }
.nh-live-typing .nhlc-dots { background: var(--nh-surface, #fff); box-shadow: inset 0 0 0 1px var(--nh-line, #e2e6ee); }
.nh-live-typing .nhlc-dots i { background: var(--nh-muted, #64748b); }
