/* ============================================================
   VICIDIAL Instant Messaging  -  Floating chat widget
   ============================================================ */

#vc-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  color: #1d2433;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Floating launcher button ---------- */
#vc-launcher {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg,#3b82f6 0%,#1d4ed8 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(29,78,216,.35),
              0 2px 4px rgba(0,0,0,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
#vc-launcher:hover { transform: scale(1.06); box-shadow: 0 10px 28px rgba(29,78,216,.45); }
#vc-launcher:active { transform: scale(.97); }
#vc-launcher svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 2.2; }

#vc-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(239,68,68,.5);
  border: 2px solid #fff;
}
#vc-badge.vc-hidden { display: none; }

/* ---------- Chat panel ---------- */
#vc-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 360px;
  height: 520px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15,23,42,.25),
              0 4px 12px rgba(15,23,42,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: vc-pop .18s ease;
}
#vc-panel.vc-hidden { display: none; }
@keyframes vc-pop {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ---------- Header ---------- */
.vc-header {
  background: linear-gradient(135deg,#1d4ed8 0%,#3b82f6 100%);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.vc-header-title {
  font-weight: 700;
  font-size: 14px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.vc-header-title .vc-back {
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  width: 26px; height: 26px;
  border-radius: 6px;
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.vc-header-title .vc-back.vc-show { display: flex; }
.vc-header-title .vc-back:hover { background: rgba(255,255,255,.28); }
.vc-header-title .vc-peer {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vc-header-actions {
  display: flex; gap: 4px;
}
.vc-header-actions button {
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.vc-header-actions button:hover { background: rgba(255,255,255,.22); }
.vc-header-actions svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; }

.vc-presence-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16,185,129,.25);
  flex-shrink: 0;
}
.vc-presence-dot.vc-off { background: #94a3b8; box-shadow: none; }

/* ---------- Body ---------- */
.vc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #f8fafc;
}

/* User list wrapper (admin) - must fill .vc-body so the inner list can scroll */
.vc-userlist-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* User list (admin) */
.vc-userlist {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.vc-userlist::-webkit-scrollbar       { width: 8px; }
.vc-userlist::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.vc-userlist::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.vc-userlist .vc-empty {
  padding: 28px 16px;
  text-align: center;
  color: #64748b;
  font-size: 12px;
}
.vc-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #eef1f5;
  transition: background .12s ease;
}
.vc-user:hover { background: #eff6ff; }
.vc-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg,#a5b4fc,#6366f1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  position: relative;
  flex-shrink: 0;
}
.vc-user-avatar .vc-status-dot {
  position: absolute;
  right: -1px; bottom: -1px;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid #f8fafc;
  background: #94a3b8;
}
.vc-user-avatar .vc-status-dot.vc-on  { background: #10b981; }
.vc-user-avatar .vc-status-dot.vc-call { background: #f59e0b; }
.vc-user-info {
  flex: 1;
  min-width: 0;
}
.vc-user-name {
  font-weight: 600;
  font-size: 13px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vc-user-meta {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vc-user-badge {
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.vc-search {
  padding: 8px 10px;
  background: #fff;
  border-bottom: 1px solid #eef1f5;
  flex-shrink: 0;
}
.vc-search input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  transition: border-color .12s ease;
  box-sizing: border-box;
}
.vc-search input:focus { border-color: #3b82f6; }

/* Conversation pane */
.vc-conv {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vc-msg {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.vc-msg.vc-mine {
  align-self: flex-end;
  background: linear-gradient(135deg,#3b82f6 0%,#1d4ed8 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.vc-msg.vc-theirs {
  align-self: flex-start;
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}
.vc-msg-meta {
  font-size: 10px;
  opacity: .6;
  margin-top: 3px;
  text-align: right;
}
.vc-msg.vc-theirs .vc-msg-meta { text-align: left; color: #64748b; opacity: 1; }

.vc-day-divider {
  align-self: center;
  font-size: 11px;
  color: #94a3b8;
  margin: 8px 0 4px;
  padding: 2px 10px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.vc-typing {
  align-self: flex-start;
  font-size: 11px;
  color: #64748b;
  font-style: italic;
  padding: 4px 10px;
}
.vc-typing.vc-hidden { display: none; }

.vc-conv-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #94a3b8;
  text-align: center;
  font-size: 12px;
  padding: 20px;
  gap: 8px;
}
.vc-conv-empty svg { width: 44px; height: 44px; stroke: currentColor; fill: none; stroke-width: 1.5; opacity: .5; }

/* ---------- Composer ---------- */
.vc-composer {
  border-top: 1px solid #e2e8f0;
  background: #fff;
  padding: 8px 10px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.vc-composer textarea {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 36px;
  line-height: 1.35;
  box-sizing: border-box;
}
.vc-composer textarea:focus { border-color: #3b82f6; }
.vc-composer textarea[disabled] { background: #f1f5f9; }
.vc-composer .vc-send {
  background: linear-gradient(135deg,#3b82f6 0%,#1d4ed8 100%);
  color: #fff;
  border: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s ease;
  flex-shrink: 0;
}
.vc-composer .vc-send:hover  { transform: scale(1.05); }
.vc-composer .vc-send:active { transform: scale(.94); }
.vc-composer .vc-send[disabled] { opacity: .4; cursor: not-allowed; }
.vc-composer .vc-send svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; }

/* ---------- Toast for new message ---------- */
.vc-toast {
  position: fixed;
  right: 18px;
  bottom: 90px;
  z-index: 999998;
  background: #1e293b;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  font-size: 13px;
  max-width: 280px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  animation: vc-toast-in .25s ease;
}
@keyframes vc-toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.vc-toast strong { color: #93c5fd; }
.vc-toast .vc-toast-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ---------- Mobile / narrow ---------- */
@media (max-width: 480px) {
  #vc-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
    right: -6px;
  }
}

/* Hide everything when collapsed */
.vc-hidden { display: none !important; }
