/* ============================================================
   SOS-Knopf (Empfang) – FAB, Modal, Vorgesetzten-Alarm-Toast
   ============================================================ */

/* ── FAB ─────────────────────────────────────────────────── */
/* Stapel rechts: Chat-FAB bottom:28, Notiz-FAB bottom:92 → SOS-FAB bottom:156 */
.lp-sos-fab {
    position: fixed;
    right: 28px;
    bottom: 156px;
    width: 52px;
    height: 52px;
    border-radius: 14px;             /* leicht eckig wie im Entwurf */
    background: linear-gradient(135deg, #9b1c1c 0%, #6f1414 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(127,20,20,.45), 0 1px 4px rgba(0,0,0,.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    z-index: 9100;
    transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s;
}
.lp-sos-fab:hover  { transform: scale(1.08); box-shadow: 0 6px 22px rgba(127,20,20,.6); }
.lp-sos-fab:active { transform: scale(.95); }

/* Hinweis: Der SOS-Auslöser sitzt jetzt im Tool-Dock unten links (#lp-sos-fab als
   .lp-dock-btn). Die frühere „rechts-stapeln + bei offenem Chat ausblenden"-Logik
   entfällt dadurch. Diese .lp-sos-fab-Regeln bleiben nur als Fallback bestehen. */

/* ── Modal ───────────────────────────────────────────────── */
.lp-sos-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9300;
    animation: lp-sos-fade .15s ease;
}
.lp-sos-overlay[hidden] { display: none; }

@keyframes lp-sos-fade { from { opacity: 0; } to { opacity: 1; } }

.lp-sos-modal {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,.32);
    animation: lp-sos-pop .18s cubic-bezier(.34,1.4,.64,1);
}
@keyframes lp-sos-pop { from { transform: scale(.94); opacity: .4; } to { transform: scale(1); opacity: 1; } }

.lp-sos-modal-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 22px;
    background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%);
    color: #fff;
}
.lp-sos-modal-head-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: rgba(255,255,255,.16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.lp-sos-modal-title { font-size: 18px; font-weight: 700; line-height: 1.2; }
.lp-sos-modal-sub   { font-size: 13px; opacity: .9; margin-top: 3px; }

.lp-sos-modal-body { padding: 22px; }

.lp-sos-field { margin-bottom: 18px; }
.lp-sos-label { display: block; font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 7px; }
.lp-sos-req   { color: #dc2626; }

.lp-sos-select,
.lp-sos-textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 11px 13px;
    font-size: 15px;
    color: #1e293b;
    background: #fff;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.lp-sos-select:focus,
.lp-sos-textarea:focus {
    outline: none;
    border-color: #b91c1c;
    box-shadow: 0 0 0 3px rgba(185,28,28,.15);
}
.lp-sos-textarea { resize: vertical; min-height: 72px; }

.lp-sos-warn {
    display: flex;
    gap: 10px;
    background: #fef9c3;
    border: 1px solid #fde68a;
    color: #854d0e;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.45;
}
.lp-sos-warn i { color: #ca8a04; font-size: 16px; margin-top: 1px; }

.lp-sos-err {
    margin-top: 14px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 13px;
}

.lp-sos-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid #eef2f6;
    background: #fafbfc;
}
.lp-sos-btn {
    border: none;
    border-radius: 10px;
    padding: 11px 18px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: filter .15s, transform .1s, background .15s;
}
.lp-sos-btn:active { transform: scale(.97); }
.lp-sos-btn-cancel { background: #fff; border: 1px solid #cbd5e1; color: #334155; }
.lp-sos-btn-cancel:hover { background: #f1f5f9; }
.lp-sos-btn-send { background: linear-gradient(135deg, #b91c1c, #991b1b); color: #fff; }
.lp-sos-btn-send:hover:not(:disabled) { filter: brightness(1.07); }
.lp-sos-btn-send:disabled { opacity: .55; cursor: not-allowed; }

/* ── Vorgesetzten-Alarm-Toast (oben mittig) ──────────────── */
.lp-sos-toast-host {
    position: fixed;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9400;
    width: min(560px, calc(100vw - 32px));
    pointer-events: none;
}
.lp-sos-toast {
    pointer-events: auto;
    background: #fdeaea;
    border: 1px solid #f7caca;
    border-left: 5px solid #dc2626;
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(127,20,20,.22), 0 2px 8px rgba(0,0,0,.08);
    padding: 14px 16px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .22s ease, transform .22s cubic-bezier(.34,1.3,.64,1);
}
/* Sichtbar + blinkender Aufmerksamkeits-Puls (nur Glow/Rahmen, nicht Position) */
.lp-sos-toast.is-visible { opacity: 1; transform: translateY(0); animation: lp-sos-blink 1.05s ease-in-out infinite; }
.lp-sos-toast.is-escalated { border-left-color: #ea580c; background: #fff1e6; border-color: #fcd3b0; }
.lp-sos-toast.is-escalated.is-visible { animation-name: lp-sos-blink-esc; }

/* Nach Reaktion: Blinken stoppen, Akzent grün */
.lp-sos-toast.is-handled { animation: none !important; border-left-color: #16a34a; box-shadow: 0 14px 40px rgba(22,163,74,.18), 0 2px 8px rgba(0,0,0,.08); }

/* Absender-Karte (eigene Anfrage) – ruhig, kein Blinken */
.lp-sos-toast.is-owner { background: #fff; border-color: #e2e8f0; border-left-color: #475569; }
.lp-sos-toast.is-owner.is-visible { animation: none !important; }
.lp-sos-toast.is-owner .lp-sos-toast-ic { background: #e2e8f0; color: #475569; }
.lp-sos-toast.is-owner .lp-sos-toast-name { color: #334155; }
.lp-sos-owner-status {
    display: flex; align-items: center; gap: 7px;
    margin-top: 10px; font-size: 13.5px; font-weight: 600; color: #0656b0;
}
.lp-sos-owner-status i { color: #0656b0; }
.lp-sos-act-del { background: #64748b; }

@keyframes lp-sos-blink {
    0%, 100% { box-shadow: 0 14px 40px rgba(127,20,20,.22), 0 2px 8px rgba(0,0,0,.08); border-left-color: #dc2626; }
    50%      { box-shadow: 0 0 0 4px rgba(220,38,38,.55), 0 18px 48px rgba(220,38,38,.55); border-left-color: #f87171; }
}
@keyframes lp-sos-blink-esc {
    0%, 100% { box-shadow: 0 14px 40px rgba(127,20,20,.22), 0 2px 8px rgba(0,0,0,.08); border-left-color: #ea580c; }
    50%      { box-shadow: 0 0 0 4px rgba(234,88,12,.55), 0 18px 48px rgba(234,88,12,.55); border-left-color: #fb923c; }
}
@media (prefers-reduced-motion: reduce) {
    .lp-sos-toast.is-visible { animation: none !important; }
}

.lp-sos-toast-top { display: flex; align-items: center; gap: 10px; }
.lp-sos-toast-ic {
    flex: 0 0 auto;
    width: 34px; height: 34px;
    border-radius: 9px;
    background: #f9d2d2;
    color: #b91c1c;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
}
.lp-sos-toast.is-escalated .lp-sos-toast-ic { background: #fcd9bd; color: #c2410c; }
.lp-sos-toast-head { flex: 1 1 auto; min-width: 0; }
.lp-sos-toast-name {
    font-size: 15px; font-weight: 700; color: #991b1b;
    display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.lp-sos-badge {
    font-size: 11px; font-weight: 700; letter-spacing: .03em;
    background: #e2e8f0; color: #475569;
    border-radius: 5px; padding: 1px 6px;
}
.lp-sos-badge-esc { background: #ffedd5; color: #c2410c; }
.lp-sos-toast-time { font-size: 12.5px; color: #64748b; display: inline-flex; align-items: center; gap: 4px; }
.lp-sos-toast-reason { font-size: 13.5px; color: #b91c1c; margin-top: 6px; font-weight: 600; }
.lp-sos-toast-reason span { font-weight: 400; }
.lp-sos-toast-desc { font-size: 13px; color: #7f1d1d; font-style: italic; margin-top: 3px; }

.lp-sos-toast-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.lp-sos-act {
    border: none; border-radius: 9px;
    padding: 8px 13px; font-size: 13.5px; font-weight: 600;
    cursor: pointer; color: #fff;
    display: inline-flex; align-items: center; gap: 6px;
    transition: filter .15s, transform .1s;
}
.lp-sos-act:active { transform: scale(.96); }
.lp-sos-act:hover { filter: brightness(1.07); }
.lp-sos-act-accept   { background: #16a34a; }
.lp-sos-act-onway    { background: #0783ff; }
.lp-sos-act-escalate { background: #ea580c; }
.lp-sos-act-close {
    margin-left: auto;
    background: transparent; color: #9ca3af; border: none;
    width: 30px; height: 30px; border-radius: 8px;
    font-size: 15px; cursor: pointer; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
}
.lp-sos-act-close:hover { background: rgba(0,0,0,.06); color: #475569; }
.lp-sos-act:disabled { opacity: .5; cursor: default; filter: none; }

.lp-sos-toast-result {
    margin-top: 10px; font-size: 13px; font-weight: 600; color: #15803d;
    display: flex; align-items: center; gap: 6px;
}

/* ── Rückmeldungs-Toast für den Anfordernden (oben mittig, groß) ── */
.lp-sos-feedback-host {
    position: fixed;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 12px;
    z-index: 9500; pointer-events: none;
    width: min(560px, calc(100vw - 32px));
}
.lp-sos-feedback {
    pointer-events: auto;
    display: flex; align-items: center; gap: 14px;
    background: #fff; border-radius: 14px;
    border: 1px solid #e2e8f0; border-left: 6px solid #16a34a;
    box-shadow: 0 16px 46px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.08);
    padding: 18px 22px; font-size: 16.5px; font-weight: 600; color: #1e293b;
    opacity: 0; transform: translateY(-12px);
    transition: opacity .22s ease, transform .22s cubic-bezier(.34,1.3,.64,1);
}
.lp-sos-feedback.is-visible { opacity: 1; transform: translateY(0); animation: lp-sos-fb-pulse .9s ease-in-out 2; }
.lp-sos-feedback i { font-size: 26px; }

@keyframes lp-sos-fb-pulse {
    0%, 100% { box-shadow: 0 16px 46px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.08); }
    50%      { box-shadow: 0 0 0 5px var(--fb-glow, rgba(22,163,74,.35)), 0 18px 50px rgba(0,0,0,.28); }
}
@media (prefers-reduced-motion: reduce) {
    .lp-sos-feedback.is-visible { animation: none !important; }
}
.lp-sos-feedback.kind-accept  { border-left-color: #16a34a; --fb-glow: rgba(22,163,74,.38); }
.lp-sos-feedback.kind-accept i  { color: #16a34a; }
.lp-sos-feedback.kind-onway   { border-left-color: #0783ff; --fb-glow: rgba(37,99,235,.38); }
.lp-sos-feedback.kind-onway i   { color: #0783ff; }
.lp-sos-feedback.kind-escalated { border-left-color: #ea580c; --fb-glow: rgba(234,88,12,.4); }
.lp-sos-feedback.kind-escalated i { color: #ea580c; }
.lp-sos-feedback.kind-sent    { border-left-color: #b91c1c; --fb-glow: rgba(185,28,28,.4); }
.lp-sos-feedback.kind-sent i    { color: #b91c1c; }
.lp-sos-feedback-close {
    margin-left: auto; background: transparent; border: none;
    color: #94a3b8; cursor: pointer; font-size: 14px;
    width: 26px; height: 26px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
}
.lp-sos-feedback-close:hover { background: rgba(0,0,0,.05); color: #475569; }

/* ── Dark Mode ───────────────────────────────────────────── */
[data-theme="dark"] .lp-sos-modal { background: #1e293b; }
[data-theme="dark"] .lp-sos-modal-body .lp-sos-label { color: #e2e8f0; }
[data-theme="dark"] .lp-sos-select,
[data-theme="dark"] .lp-sos-textarea { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .lp-sos-modal-foot { background: #172033; border-top-color: #334155; }
[data-theme="dark"] .lp-sos-btn-cancel { background: #0f172a; border-color: #334155; color: #cbd5e1; }
[data-theme="dark"] .lp-sos-btn-cancel:hover { background: #1e293b; }
[data-theme="dark"] .lp-sos-feedback { background: #1e293b; border-color: #334155; color: #e2e8f0; }
