/* ============================================================
   SPR TECHSERV — LIVE CHAT WIDGET
   ============================================================ */
#sprchat, #sprchat * { box-sizing: border-box; }
#sprchat { position: fixed; right: 1.6rem; bottom: 1.6rem; z-index: 2147483000; font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif; color: #33415c; }
.sc-launch {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 62px; height: 62px; border: 0; border-radius: 50%; cursor: pointer;
  background: linear-gradient(145deg, #0a2470, #0a3fb0); color: #f7c653; font-size: 1.5rem;
  box-shadow: 0 14px 34px rgba(10,63,176,.42), 0 0 0 4px rgba(255,255,255,.9);
  transition: transform .25s cubic-bezier(.4,0,.2,1), box-shadow .25s;
}
.sc-launch:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 18px 40px rgba(10,63,176,.5), 0 0 0 4px rgba(255,255,255,.9); }
.sc-launch:focus-visible { outline: 3px solid #1b74e4; outline-offset: 4px; }
.sc-launch .sc-ic-close { display: none; font-size: 1.25rem; }
#sprchat.open .sc-launch .sc-ic-chat { display: none; }
#sprchat.open .sc-launch .sc-ic-close { display: block; }
.sc-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: #e5484d; color: #fff; font-size: .72rem; font-weight: 800; display: none; align-items: center; justify-content: center; box-shadow: 0 0 0 3px #fff; }
.sc-badge.show { display: flex; }
.sc-tip {
  position: absolute; right: 76px; bottom: 10px; white-space: nowrap; padding: .7rem 1.1rem; border-radius: 14px 14px 4px 14px;
  background: #fff; color: #0a1a44; font-size: .88rem; font-weight: 600; box-shadow: 0 12px 30px rgba(10,26,68,.18);
  opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .3s, transform .3s;
}
.sc-tip.show { opacity: 1; transform: none; pointer-events: auto; cursor: pointer; }
#sprchat.open .sc-tip { display: none; }

.sc-panel { padding: 0 !important; margin: 0 !important;
  position: absolute; right: 0; bottom: 78px; width: 380px; height: min(620px, calc(100vh - 130px));
  display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: 22px;
  box-shadow: 0 30px 80px rgba(5,15,46,.35), 0 0 0 1px rgba(10,26,68,.06);
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.98); transform-origin: bottom right;
  transition: opacity .25s, transform .25s cubic-bezier(.4,0,.2,1), visibility .25s;
}
#sprchat.open .sc-panel { opacity: 1; visibility: visible; transform: none; }

.sc-head { flex: none; display: flex; align-items: center; gap: .85rem; padding: 1rem 1.1rem; color: #fff; background: linear-gradient(145deg, #07184a, #0a3fb0); position: relative; }
.sc-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, #f0a800, #f7c653); }
.sc-av { flex: none; width: 42px; height: 42px; border-radius: 13px; background: #fff; display: flex; align-items: center; justify-content: center; }
.sc-av img { width: 30px; height: 30px; }
.sc-title { flex: 1; min-width: 0; }
.sc-title strong { display: block; font-size: .98rem; font-weight: 800; letter-spacing: -.01em; }
.sc-title span { display: flex; align-items: center; gap: .45rem; font-size: .78rem; font-weight: 500; color: #c9d6f2; }
.sc-title span i { width: 8px; height: 8px; border-radius: 50%; background: #8aa0d0; }
.sc-title span.on i { background: #3ddc97; box-shadow: 0 0 0 3px rgba(61,220,151,.25); }
.sc-hbtn { flex: none; width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; font-size: .9rem; transition: background .2s; }
.sc-hbtn:hover { background: rgba(255,255,255,.2); }
.sc-menu { position: absolute; right: 1rem; top: 3.9rem; z-index: 5; min-width: 180px; padding: .4rem; background: #fff; border-radius: 12px; box-shadow: 0 16px 40px rgba(5,15,46,.25); display: none; }
.sc-menu.show { display: block; }
.sc-menu button, .sc-menu a { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .65rem .8rem; border: 0; border-radius: 8px; background: none; color: #0a1a44; font: 600 .86rem inherit; font-family: inherit; cursor: pointer; text-align: left; text-decoration: none; }
.sc-menu button:hover, .sc-menu a:hover { background: #eaf0fc; }

.sc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.sc-msgs { flex: 1; overflow-y: auto; padding: 1.1rem 1rem .6rem; display: flex; flex-direction: column; gap: .6rem; scroll-behavior: smooth; }
.sc-msgs::-webkit-scrollbar { width: 6px; } .sc-msgs::-webkit-scrollbar-thumb { background: #cdd8ee; border-radius: 6px; }
.sc-m { max-width: 82%; padding: .65rem .9rem; font-size: .92rem; line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; animation: scIn .25s ease; }
@keyframes scIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sc-m.agent { align-self: flex-start; background: #f1f5fb; color: #0a1a44; border-radius: 16px 16px 16px 4px; }
.sc-m.visitor { align-self: flex-end; background: #0a3fb0; color: #fff; border-radius: 16px 16px 4px 16px; }
.sc-m small { display: block; margin-top: .25rem; font-size: .68rem; font-weight: 600; opacity: .6; }
.sc-m .sc-who { display: block; margin-bottom: .15rem; font-size: .72rem; font-weight: 800; color: #0a3fb0; }
.sc-sys { align-self: center; max-width: 90%; padding: .35rem .8rem; border-radius: 99px; background: #f4f7fc; color: #56657f; font-size: .76rem; font-weight: 600; text-align: center; }
.sc-typing { align-self: flex-start; display: none; gap: 4px; padding: .75rem .9rem; background: #f1f5fb; border-radius: 16px 16px 16px 4px; }
.sc-typing.show { display: flex; }
.sc-typing i { width: 7px; height: 7px; border-radius: 50%; background: #8aa0d0; animation: scDot 1.2s infinite; }
.sc-typing i:nth-child(2) { animation-delay: .15s; } .sc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes scDot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.sc-compose { flex: none; display: flex; align-items: flex-end; gap: .6rem; padding: .8rem; border-top: 1px solid #e3e9f4; background: #fff; }
.sc-compose textarea { flex: 1; resize: none; max-height: 110px; min-height: 44px; padding: .7rem 1rem; border: 1.5px solid #c7d3e8; border-radius: 22px; background: #fbfcfe; color: #0a1a44; font: 500 .94rem/1.4 inherit; font-family: inherit; }
.sc-compose textarea:focus { outline: none; border-color: #0a3fb0; box-shadow: 0 0 0 4px rgba(10,63,176,.13); background: #fff; }
.sc-send { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #f0a800; color: #050f2e; font-size: 1rem; cursor: pointer; transition: transform .2s, background .2s; }
.sc-send:hover { background: #f7c653; transform: scale(1.06); }
.sc-send:disabled { opacity: .5; cursor: default; transform: none; }
.sc-foot { flex: none; padding: 0 1rem .65rem; text-align: center; font-size: .68rem; font-weight: 500; color: #6b7a96; }
.sc-foot a { color: #0a3fb0; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Pre-chat form */
.sc-pre { flex: 1; overflow-y: auto; padding: 1.3rem 1.2rem; }
.sc-pre h3 { font-size: 1.15rem; font-weight: 800; color: #0a1a44; letter-spacing: -.02em; }
.sc-pre p { margin: .35rem 0 1.1rem; font-size: .88rem; line-height: 1.55; color: #56657f; }
.sc-field { margin-bottom: .8rem; }
.sc-field label { display: block; margin-bottom: .3rem; font-size: .78rem; font-weight: 700; color: #0a1a44; }
.sc-field input, .sc-field textarea { width: 100%; padding: .72rem .9rem; border: 1.5px solid #c7d3e8; border-radius: 12px; background: #fbfcfe; color: #0a1a44; font: 500 .92rem/1.4 inherit; font-family: inherit; }
.sc-field textarea { min-height: 78px; resize: vertical; }
.sc-field input:focus, .sc-field textarea:focus { outline: none; border-color: #0a3fb0; box-shadow: 0 0 0 4px rgba(10,63,176,.13); background: #fff; }
.sc-field input::placeholder, .sc-field textarea::placeholder { color: #66748d; }
.sc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.sc-go { width: 100%; margin-top: .3rem; padding: .9rem; border: 0; border-radius: 99px; background: #0a3fb0; color: #fff; font: 700 .95rem inherit; font-family: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .6rem; box-shadow: 0 8px 20px rgba(10,63,176,.28); transition: background .2s, transform .2s; }
.sc-go:hover { background: #082f87; transform: translateY(-1px); }
.sc-go:disabled { opacity: .6; cursor: default; transform: none; }
.sc-err { margin: 0 0 .8rem; padding: .6rem .8rem; border-radius: 10px; background: #fde8e8; color: #b42318; font-size: .82rem; font-weight: 600; display: none; }
.sc-err.show { display: block; }
.sc-note { margin-top: 1rem; padding: .75rem .9rem; border-radius: 12px; background: #fff7de; color: #6b4600; font-size: .82rem; font-weight: 600; line-height: 1.5; }
.sc-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem 1.5rem; gap: .8rem; }
.sc-center i.big { width: 62px; height: 62px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #eaf0fc; color: #0a3fb0; font-size: 1.5rem; }
.sc-center h3 { font-size: 1.1rem; font-weight: 800; color: #0a1a44; }
.sc-center p { font-size: .88rem; line-height: 1.6; color: #56657f; }
.sc-center a { color: #0a3fb0; font-weight: 700; }

@media (max-width: 520px) {
  #sprchat { right: 1rem; bottom: 1rem; }
  #sprchat.open { inset: 0; right: 0; bottom: 0; }
  #sprchat.open .sc-launch { display: none; }
  .sc-panel { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; bottom: 0; }
  .sc-tip { right: 70px; }
}
@media (prefers-reduced-motion: reduce) { .sc-panel, .sc-m, .sc-launch, .sc-tip { transition: none; animation: none; } .sc-typing i { animation: none; } }

/* position: left (Admin → Settings → Chat) */
#sprchat.left { right: auto; left: 1.6rem; }
#sprchat.left .sc-tip { right: auto; left: 76px; border-radius: 14px 14px 14px 4px; }
#sprchat.left .sc-panel { right: auto; left: 0; }
