* { box-sizing: border-box; }
body { background: #0d1120; overflow: hidden; font-family: 'Inter', sans-serif; }

.backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 10;
}

/* ── SUPPORT DRAWER ── */
.support-drawer {
  position: fixed;
  inset: 0;
  background: #0d1120;
  z-index: 20;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s cubic-bezier(.25,.46,.45,.94);
  overflow-y: auto;
  padding-bottom: 90px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* DRAWER HEADER */
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 18px;
  background: #0a0d1a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.drawer-brand { display: flex; align-items: center; gap: 14px; }

.drawer-logo {
  position: relative;
  width: 50px; height: 50px;
  background: radial-gradient(circle at 35% 35%, #1e1a3a, #080616);
  border: 2px solid #c9a227;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(201,162,39,0.25);
}
.drawer-logo .crown { font-size: 10px; color: #c9a227; line-height: 1; }
.drawer-logo .fp    { font-size: 12px; font-weight: 900; color: #c9a227; line-height: 1; }

.drawer-title {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  line-height: 1.15;
  letter-spacing: 0.3px;
}
.drawer-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 3px;
}

.close-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  color: #9ca3af;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.close-btn:hover { background: rgba(255,255,255,0.13); color: #fff; }

/* AGENTS SECTION */
.agents-section { padding: 20px 20px 10px; }
.agents-label {
  font-size: 10px;
  font-weight: 700;
  color: #4b5563;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.agents-sub { font-size: 13px; color: #6b7280; }

/* AGENT CARDS */
.agent-list { padding: 4px 16px; }

.agent-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #111827;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.18s;
  touch-action: manipulation;
}
.agent-card:active { background: #1a2236; transform: scale(0.98); }

.agent-avatar {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}

.fp-avatar {
  background: radial-gradient(circle at 35% 35%, #1e1a3a, #080616);
  border: 2px solid #c9a227;
  box-shadow: 0 0 14px rgba(201,162,39,0.2);
}
.fp-avatar .crown { font-size: 9px; color: #c9a227; line-height: 1; }
.fp-avatar .fp    { font-size: 10px; font-weight: 900; color: #c9a227; line-height: 1; }

.nicky-avatar { background: linear-gradient(135deg, #7c3aed, #4f46e5); }
.brody-avatar { background: linear-gradient(135deg, #0d4040, #065f46); }

.avatar-emoji { font-size: 26px; line-height: 1; }

/* Online pulse */
.online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 13px; height: 13px;
  background: #22c55e;
  border-radius: 50%;
  border: 2.5px solid #0d1120;
  animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

.agent-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  min-width: 0;
}
.agent-name { font-size: 15px; font-weight: 700; color: #f9fafb; }
.agent-msg  {
  font-size: 13px; color: #6b7280;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.unread-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 22px; height: 22px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  padding: 0 4px;
}

.agent-arrow { color: #374151; font-size: 22px; flex-shrink: 0; }

/* ═══════════════════════════════
   CHAT PANEL
═══════════════════════════════ */
.chat-panel {
  position: fixed;
  inset: 0;
  background: #0d1120;
  z-index: 30;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.28s cubic-bezier(.25,.46,.45,.94);
}
.chat-panel.hidden { display: none; }

/* CHAT HEADER */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 14px;
  background: #0a0d1a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.back-chat {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  touch-action: manipulation;
}

.chat-header-av-wrap {
  position: relative;
  flex-shrink: 0;
}
.chat-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
}
.chat-avatar.fp-chat-av {
  background: radial-gradient(circle at 35% 35%, #1e1a3a, #080616);
  border: 2px solid #c9a227;
}
.chat-avatar.nicky-av { background: linear-gradient(135deg, #7c3aed, #4f46e5); font-size: 22px; }
.chat-avatar.brody-av { background: linear-gradient(135deg, #0d4040, #065f46); font-size: 22px; }
.chat-avatar .crown { font-size: 8px; color: #c9a227; line-height: 1; }
.chat-avatar .fp-lbl { font-size: 10px; font-weight: 900; color: #c9a227; line-height: 1; }

.chat-header-av-wrap .online-dot {
  width: 12px; height: 12px;
  bottom: 0; right: 0;
  border-color: #0a0d1a;
}

.chat-agent-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.chat-name   { font-size: 15px; font-weight: 700; color: #fff; }
.chat-status { font-size: 11px; color: #22c55e; font-weight: 500; }

/* CHAT BACKGROUND */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(99,102,241,0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 90%, rgba(124,58,237,0.04) 0%, transparent 55%),
    #0d1120;
  scroll-behavior: smooth;
}

/* DATE SEPARATOR */
.date-sep {
  text-align: center;
  font-size: 11px;
  color: #4b5563;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 10px 0 8px;
}

/* MESSAGE ROWS */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 4px;
}
.msg-row.user-row { justify-content: flex-end; }
.msg-row.agent-row { justify-content: flex-start; }

/* Mini avatar next to agent messages */
.msg-mini-av {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-bottom: 2px;
}
.msg-mini-av.fp-mini { background: radial-gradient(circle, #1e1a3a, #080616); border: 1.5px solid #c9a227; font-size: 8px; color: #c9a227; font-weight: 900; }
.msg-mini-av.nicky-mini { background: linear-gradient(135deg, #7c3aed, #4f46e5); }
.msg-mini-av.brody-mini { background: linear-gradient(135deg, #0d4040, #065f46); }

/* BUBBLE */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 72%;
  animation: msgIn 0.22s cubic-bezier(.34,1.56,.64,1);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.agent-msg-bubble {
  align-self: flex-start;
  background: #1a2236;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px 18px 18px 18px;
  padding: 10px 14px 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.agent-msg-bubble .msg-text { font-size: 14px; color: #e5e7eb; line-height: 1.45; display: block; margin-bottom: 4px; }

.user-msg-bubble {
  align-self: flex-end;
  background: linear-gradient(135deg, #5b50f0, #7c3aed);
  border-radius: 18px 4px 18px 18px;
  padding: 10px 14px 8px;
  box-shadow: 0 3px 12px rgba(99,102,241,0.35);
}
.user-msg-bubble .msg-text { font-size: 14px; color: #fff; line-height: 1.45; display: block; margin-bottom: 4px; }

.msg-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
}
.msg-time { font-size: 10px; color: rgba(255,255,255,0.35); line-height: 1; }
.agent-msg-bubble .msg-time { color: #4b5563; }
.read-check { font-size: 11px; color: #818cf8; line-height: 1; }

/* CONSECUTIVE: hide avatar if same sender as next */
.msg-row.agent-row.consecutive .msg-mini-av { visibility: hidden; }
.agent-msg-bubble.consecutive { border-top-left-radius: 18px; }
.user-msg-bubble.consecutive   { border-top-right-radius: 18px; }

/* TYPING INDICATOR */
.typing-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 0 8px;
}
.typing-bubble {
  background: #1a2236;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px 18px 18px 18px;
  padding: 12px 16px;
  display: flex; gap: 5px; align-items: center;
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #6b7280;
  animation: typingBounce 1.4s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); background: #4b5563; }
  30%          { transform: translateY(-7px); background: #9ca3af; }
}

/* INPUT BAR */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 82px) 14px;
  background: #0a0d1a;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.chat-input-row input {
  flex: 1;
  background: #111827;
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 13px 18px;
  color: #f3f4f6;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.chat-input-row input:focus { border-color: #5b50f0; }
.chat-input-row input::placeholder { color: #374151; }

.send-btn {
  width: 46px; height: 46px;
  background: #1e2440;
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 50%;
  color: #4b5563;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.send-btn.active {
  background: linear-gradient(135deg, #5b50f0, #7c3aed);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(91,80,240,0.45);
  transform: scale(1.05);
}
.send-btn.active:active { transform: scale(0.95); }

.hidden { display: none !important; }
.bnav-item.active { color: #f0c040 !important; }
