/* Asisten SIEP - kotak chat. Semua kelas berawalan siep-chat- agar tidak bentrok. */
#siepChat {
    --sc-navy: #12345a;
    --sc-navy-2: #0c2744;
    --sc-gold: #e0b252;
    --sc-cream: #fbf7ee;
    --sc-ink: #1b2433;
    --sc-muted: #64748b;
    --sc-line: #e6dfcf;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--sc-ink);
}

#siepChat *, #siepChat *::before, #siepChat *::after { box-sizing: border-box; }

#siepChat [hidden] { display: none !important; }

/* ---------- tombol melayang ---------- */
.siep-chat-launcher {
    position: fixed; right: 20px; bottom: 20px; z-index: 9990;
    width: 68px; height: 68px; padding: 0; border-radius: 50%;
    border: 3px solid var(--sc-gold); background: #fff; cursor: pointer;
    box-shadow: 0 10px 28px rgba(12, 39, 68, .35), 0 2px 6px rgba(12, 39, 68, .2);
    display: grid; place-items: center; overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}
.siep-chat-launcher img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; display: block; pointer-events: none; }
.siep-chat-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 32px rgba(12, 39, 68, .4); }
.siep-chat-launcher:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px var(--sc-navy); }
.siep-chat-launcher.is-open { transform: scale(.92); }

/* Label "Tanya Asisten SIEP" di sebelah ikon */
.siep-chat-pillwrap {
    position: fixed; right: 98px; bottom: 33px; z-index: 9989;
    display: flex; align-items: center; gap: 4px;
    animation: siepPillIn .6s .5s cubic-bezier(.2, 1.3, .4, 1) both;
}
.siep-chat-pill {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
    border: 2px solid var(--sc-gold); background: #fff; color: var(--sc-navy); cursor: pointer;
    font: inherit; font-weight: 800; font-size: 14px; white-space: nowrap;
    box-shadow: 0 8px 22px rgba(12, 39, 68, .25);
    transition: transform .15s, box-shadow .15s, background .15s;
}
.siep-chat-pill:hover { transform: translateY(-1px); background: #fffaf0; box-shadow: 0 12px 26px rgba(12, 39, 68, .3); }
.siep-chat-pill:focus-visible { outline: 3px solid var(--sc-navy); outline-offset: 2px; }
.siep-chat-pill-dot { width: 9px; height: 9px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 0 rgba(34, 160, 107, .6); animation: siepPulse 2s infinite; }
.siep-chat-pill-x {
    width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
    background: rgba(12, 39, 68, .75); color: #fff; display: grid; place-items: center; order: -1;
    opacity: 0; transition: opacity .15s; margin-right: -2px;
}
.siep-chat-pillwrap:hover .siep-chat-pill-x, .siep-chat-pill-x:focus-visible { opacity: 1; }
@keyframes siepPillIn { from { opacity: 0; transform: translateX(16px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes siepPulse { 0% { box-shadow: 0 0 0 0 rgba(34, 160, 107, .55); } 70% { box-shadow: 0 0 0 8px rgba(34, 160, 107, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 160, 107, 0); } }

/* ---------- panel ---------- */
.siep-chat-panel {
    position: fixed; right: 20px; bottom: 100px; z-index: 9991;
    width: 380px; max-width: calc(100vw - 24px);
    height: 580px; max-height: calc(100vh - 124px);
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border-radius: 18px; border: 1px solid var(--sc-line);
    box-shadow: 0 24px 60px rgba(12, 39, 68, .35);
    animation: siepChatIn .22s ease;
}
@keyframes siepChatIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.siep-chat-head {
    display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px;
    background: linear-gradient(135deg, var(--sc-navy) 0%, var(--sc-navy-2) 100%);
    color: #fff; border-bottom: 3px solid var(--sc-gold);
}
.siep-chat-head-img { width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 2px solid var(--sc-gold); object-fit: cover; object-position: 50% 8%; flex: none; }
.siep-chat-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.siep-chat-head-text strong { font-size: 15px; line-height: 1.2; }
.siep-chat-head-text span { font-size: 12px; opacity: .8; }
.siep-chat-iconbtn {
    width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .1); color: #fff;
    display: grid; place-items: center; cursor: pointer; flex: none;
}
.siep-chat-iconbtn:hover { background: rgba(255, 255, 255, .22); }
.siep-chat-iconbtn:focus-visible { outline: 2px solid var(--sc-gold); outline-offset: 1px; }

.siep-chat-body {
    flex: 1; overflow-y: auto; padding: 14px; background: var(--sc-cream);
    display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth;
}

.siep-chat-welcome { text-align: center; padding: 4px 6px 2px; }
.siep-chat-hero { display: block; margin: 0 auto 6px; width: 96px; height: auto; }
.siep-chat-welcome p { margin: 0; color: #3b475a; font-size: 13.5px; }

.siep-chat-chips { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.siep-chat-chip {
    text-align: left; padding: 9px 12px; border-radius: 12px; border: 1.5px solid var(--sc-line);
    background: #fff; color: var(--sc-navy); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.siep-chat-chip:hover { border-color: var(--sc-gold); background: #fffaf0; }

.siep-chat-row { display: flex; align-items: flex-end; gap: 8px; }
.siep-chat-row.is-user { justify-content: flex-end; }
.siep-chat-mini { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 1.5px solid var(--sc-gold); object-fit: cover; object-position: 50% 8%; flex: none; }

.siep-chat-bubble { max-width: 82%; padding: 9px 12px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; }
.siep-chat-row.is-model .siep-chat-bubble { background: #fff; border: 1px solid var(--sc-line); border-bottom-left-radius: 4px; }
.siep-chat-row.is-user .siep-chat-bubble { background: var(--sc-navy); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.siep-chat-bubble.is-error { background: #fef2f2 !important; border-color: #fecaca !important; color: #991b1b; }
.siep-chat-bubble p { margin: 0 0 6px; }
.siep-chat-bubble p:last-child, .siep-chat-bubble ul:last-child, .siep-chat-bubble ol:last-child { margin-bottom: 0; }
.siep-chat-bubble ul, .siep-chat-bubble ol { margin: 0 0 6px; padding-left: 20px; }
.siep-chat-bubble li { margin: 2px 0; }
.siep-chat-bubble code { background: #f1f5f9; border-radius: 5px; padding: 1px 5px; font-size: 12.5px; }

.siep-chat-typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; }
.siep-chat-typing i { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: siepChatDot 1.1s infinite ease-in-out; }
.siep-chat-typing i:nth-child(2) { animation-delay: .15s; }
.siep-chat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes siepChatDot { 0%, 80%, 100% { transform: scale(.7); opacity: .5; } 40% { transform: scale(1.1); opacity: 1; } }

.siep-chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--sc-line); }
.siep-chat-input {
    flex: 1; resize: none; max-height: 110px; border: 1.5px solid #d6dce6; border-radius: 12px;
    padding: 9px 12px; font: inherit; color: var(--sc-ink); background: #fff; line-height: 1.4;
}
.siep-chat-input:focus { outline: none; border-color: var(--sc-navy); box-shadow: 0 0 0 3px rgba(18, 52, 90, .15); }
.siep-chat-send {
    width: 40px; height: 40px; flex: none; border: 0; border-radius: 12px; cursor: pointer;
    background: var(--sc-gold); color: var(--sc-navy-2); display: grid; place-items: center;
}
.siep-chat-send:hover:not(:disabled) { filter: brightness(1.06); }
.siep-chat-send:disabled { opacity: .5; cursor: not-allowed; }
.siep-chat-send:focus-visible { outline: 2px solid var(--sc-navy); outline-offset: 2px; }

.siep-chat-note a { color: var(--sc-navy); font-weight: 700; overflow-wrap: anywhere; }
.siep-chat-note { margin: 0; padding: 0 14px 10px; background: #fff; color: var(--sc-muted); font-size: 11.5px; text-align: center; }

/* ---------- ponsel ---------- */
@media (max-width: 520px) {
    .siep-chat-launcher { right: 14px; bottom: 14px; width: 60px; height: 60px; }
    .siep-chat-pillwrap { right: 82px; bottom: 27px; }
    .siep-chat-pill { padding: 8px 13px; font-size: 13px; }
    .siep-chat-pill-x { opacity: 1; }
    .siep-chat-panel {
        right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%;
        height: min(88vh, 640px); max-height: 88vh; border-radius: 18px 18px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .siep-chat-panel, .siep-chat-typing i, .siep-chat-pillwrap, .siep-chat-pill-dot { animation: none; }
    .siep-chat-launcher, .siep-chat-pill { transition: none; }
    .siep-chat-body { scroll-behavior: auto; }
}

@media print { #siepChat { display: none !important; } }

.siep-chat-bubble a { color: var(--sc-navy); font-weight: 700; text-decoration: underline; overflow-wrap: anywhere; }

/* ---- kartu konfirmasi aksi admin ---- */
.siep-chat-mini-gap { flex: 0 0 28px; }
.siep-chat-action { max-width: 82%; background: #fff; border: 1.5px solid #cbd5e1; border-radius: 14px; padding: 11px 12px; }
.siep-chat-action.is-danger { border-color: #fca5a5; background: #fff7f7; }
.siep-chat-action-title { display: block; font-size: 13.5px; color: #0f172a; margin-bottom: 4px; overflow-wrap: anywhere; }
.siep-chat-action-detail { margin: 0 0 10px; font-size: 12.5px; line-height: 1.5; color: #475569; overflow-wrap: anywhere; }
.siep-chat-action-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.siep-chat-action-btns button { border: 0; border-radius: 9px; padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.siep-chat-action-ok { background: var(--sc-navy); color: #fff; }
.siep-chat-action.is-danger .siep-chat-action-ok { background: #dc2626; }
.siep-chat-action-no { background: #e2e8f0; color: #334155; }
.siep-chat-action-btns button:disabled { opacity: .6; cursor: default; }

.siep-chat-dl-btn { display: inline-block; border-radius: 9px; padding: 8px 12px; background: var(--sc-navy); color: #fff !important; font-size: 13px; font-weight: 700; text-decoration: none !important; }
.siep-chat-dl-btn:hover { filter: brightness(1.12); }
.siep-chat-download { border-color: #93c5fd; background: #f5f9ff; }
