/* ── SIMAOBE Chat Widget ─────────────────────────────────────────────────── */

/* FAB */
#scw-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9100;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0e7490, #0369a1);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(14,116,144,0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}
#scw-fab:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(14,116,144,0.55); }
#scw-fab.scw-active { background: linear-gradient(135deg, #0369a1, #1e40af); transform: scale(0.94); }

/* ── Dual FAB badges — angka berwarna tanpa background ───────────────────── */
.scw-fab-bl,
.scw-fab-br {
  position: absolute;
  top: -7px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
  /* outline putih agar terbaca di atas FAB teal */
  text-shadow:
    0 0 3px rgba(255,255,255,1),
    0 0 6px rgba(255,255,255,0.8);
  /* color di-set dinamis oleh JS */
}
.scw-fab-bl { left:  -2px; }
.scw-fab-br { right: -2px; }

/* Panel */
#scw-panel {
  position: fixed;
  bottom: 82px;
  right: 24px;
  z-index: 9099;
  width: 300px;
  height: 430px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.14), 0 2px 10px rgba(14,116,144,0.10);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(14,116,144,0.12);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  color: #0f172a;
  animation: scw-up 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes scw-up {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Header */
.scw-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  background: linear-gradient(135deg, #0e7490, #0369a1);
  color: #fff;
  flex-shrink: 0;
  gap: 6px;
}
.scw-hdr-left { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
#scw-title {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scw-btn-icon {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  padding: 4px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.14s;
  outline: none;
}
.scw-btn-icon:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* Body */
#scw-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* ── Contact list ──────────────────────────────────────────────────────────── */
#scw-contacts { flex: 1; overflow-y: auto; }
#scw-contacts::-webkit-scrollbar { width: 4px; }
#scw-contacts::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.scw-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s;
}
.scw-contact:hover  { background: #f8fafc; }
.scw-contact:active { background: #f1f5f9; }
.scw-contact-new { opacity: 0.72; }
.scw-contact-new:hover { opacity: 1; background: #f8fafc; }

.scw-new-section {
  display: flex; align-items: center; padding: 6px 13px 4px; gap: 8px;
}
.scw-new-section::before,.scw-new-section::after { content:''; flex:1; height:1px; background:#e2e8f0; }
.scw-new-section span { font-size:10.5px; font-weight:600; color:#94a3b8; letter-spacing:0.03em; white-space:nowrap; text-transform:uppercase; }

.scw-av {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0; letter-spacing: -0.5px;
}
.scw-av-admin      { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.scw-av-adminprodi { background: linear-gradient(135deg, #0e7490, #0369a1); }
.scw-av-dosen      { background: linear-gradient(135deg, #059669, #047857); }

.scw-ci { flex: 1; min-width: 0; }
.scw-ci-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1px; }
.scw-ci-name { font-weight:600; font-size:13px; color:#0f172a; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:170px; }
.scw-ci-ts   { font-size:11px; color:#94a3b8; flex-shrink:0; }
.scw-ci-bot  { display:flex; align-items:center; justify-content:space-between; gap:5px; margin-bottom:2px; }
.scw-ci-prev { font-size:12px; color:#64748b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; }
.scw-unread  { color:#fff; font-size:10px; font-weight:700; padding:2px 5px; border-radius:8px; min-width:18px; text-align:center; flex-shrink:0; }
.scw-role-chip      { display:inline-block; font-size:10px; font-weight:600; padding:1px 6px; border-radius:4px; }
.scw-role-admin     { background:#ede9fe; color:#6d28d9; }
.scw-role-adminprodi{ background:#cffafe; color:#0e7490; }
.scw-role-dosen     { background:#d1fae5; color:#047857; }

/* ── Chat view ─────────────────────────────────────────────────────────────── */
#scw-chat { flex:1; display:flex; flex-direction:column; overflow:hidden; }

#scw-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px 11px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
  min-height: 0;
}
#scw-msgs::-webkit-scrollbar { width:4px; }
#scw-msgs::-webkit-scrollbar-thumb { background:#cbd5e1; border-radius:2px; }

.scw-date-sep { display:flex; align-items:center; margin:8px 0 4px; gap:8px; }
.scw-date-sep::before,.scw-date-sep::after { content:''; flex:1; height:1px; background:#e2e8f0; }
.scw-date-sep span { font-size:10.5px; color:#94a3b8; white-space:nowrap; padding:0 6px; }

.scw-msg { display:flex; flex-direction:column; max-width:82%; margin-bottom:3px; }
.scw-mine   { align-self:flex-end;   align-items:flex-end; }
.scw-theirs { align-self:flex-start; align-items:flex-start; }

.scw-bubble { padding:7px 11px; border-radius:13px; font-size:13px; line-height:1.47; word-break:break-word; }
.scw-mine   .scw-bubble { background:linear-gradient(135deg,#0e7490,#0369a1); color:#fff; border-bottom-right-radius:4px; }
.scw-theirs .scw-bubble { background:#f1f5f9; color:#0f172a; border-bottom-left-radius:4px; }
.scw-meta { font-size:10px; color:#94a3b8; margin-top:2px; padding:0 3px; }

.scw-empty       { padding:28px 20px; text-align:center; color:#94a3b8; font-size:13px; line-height:1.7; }
.scw-empty-hint  { padding:18px 20px 8px; text-align:center; color:#94a3b8; font-size:12px; line-height:1.6; }
.scw-empty-chat  { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:28px 24px; text-align:center; color:#94a3b8; font-size:13px; line-height:1.7; gap:6px; }
.scw-loading     { padding:24px; text-align:center; color:#94a3b8; font-size:13px; }

/* ── Emoji picker ──────────────────────────────────────────────────────────── */
#scw-ep {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #e8f0fe;
  animation: scw-ep-in 0.18s ease;
}
@keyframes scw-ep-in {
  from { opacity:0; transform:translateY(6px); }
  to   { opacity:1; transform:translateY(0); }
}

.scw-ep-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px 5px;
  background: linear-gradient(to bottom, #f8fafc, #fff);
  border-bottom: 1px solid #f1f5f9;
}

.scw-ep-tab {
  flex: 1;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  border-radius: 8px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, transform 0.1s;
  outline: none;
  line-height: 1;
  opacity: 0.55;
  position: relative;
}
.scw-ep-tab:hover { background: #f1f5f9; opacity: 0.85; transform: scale(1.1); }
.scw-ep-tab.scw-active {
  background: linear-gradient(135deg, rgba(14,116,144,0.12), rgba(3,105,161,0.08));
  opacity: 1;
  box-shadow: 0 1px 4px rgba(14,116,144,0.15);
}
.scw-ep-tab.scw-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: #0e7490;
  border-radius: 2px;
}

.scw-ep-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  padding: 4px 6px 6px;
  height: 100px;
  overflow-y: auto;
  gap: 1px;
}
.scw-ep-grid::-webkit-scrollbar { width: 3px; }
.scw-ep-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.scw-ep-e {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 19px;
  padding: 4px 2px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, transform 0.1s;
  outline: none;
  line-height: 1;
  aspect-ratio: 1;
}
.scw-ep-e:hover  { background: #f1f5f9; transform: scale(1.25); z-index: 1; }
.scw-ep-e:active { transform: scale(0.9); }

/* ── Input row ─────────────────────────────────────────────────────────────── */
.scw-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 7px 9px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

.scw-emoji-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 17px;
  padding: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, transform 0.12s;
  outline: none;
  line-height: 1;
  opacity: 0.6;
}
.scw-emoji-btn:hover { background: #f1f5f9; opacity: 1; transform: scale(1.1); }
.scw-emoji-btn.scw-ep-on {
  background: linear-gradient(135deg, rgba(14,116,144,0.12), rgba(3,105,161,0.08));
  opacity: 1;
  box-shadow: 0 1px 4px rgba(14,116,144,0.2);
}

#scw-input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  color: #0f172a;
  background: #f8fafc;
  line-height: 1.45;
  min-height: 34px;
  max-height: 80px;
  overflow-y: auto;
  transition: border-color 0.15s, background 0.15s;
}
#scw-input:focus { border-color: #0ea5b7; background: #fff; }
#scw-input::placeholder { color: #94a3b8; }

#scw-send {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0e7490, #0369a1);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; outline: none;
  transition: transform 0.14s, opacity 0.14s;
}
#scw-send:hover  { transform: scale(1.08); }
#scw-send:active { transform: scale(0.93); opacity: 0.85; }

.scw-hidden { display: none !important; }

/* Mobile */
@media (max-width: 480px) {
  #scw-panel { width: calc(100vw - 16px); right: 8px; bottom: 78px; height: calc(100svh - 98px); max-height: 450px; }
  #scw-fab   { bottom: 16px; right: 16px; }
}
