/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
}

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --saffron:   #F4820C;
  --saffron-d: #D46A00;
  --saffron-l: #FFF3E0;
  --navy:      #1A2744;
  --navy-m:    #2C3E6B;
  --navy-l:    #E8EDF8;
  --gold:      #D4AF37;
  --white:     #FFFFFF;
  --gray-100:  #F7F8FC;
  --gray-200:  #EEF0F5;
  --gray-400:  #9BA3BA;
  --gray-600:  #5A6480;
  --shadow-sm: 0 2px 8px rgba(26,39,68,0.10);
  --shadow-md: 0 8px 32px rgba(26,39,68,0.18);
  --shadow-lg: 0 20px 60px rgba(26,39,68,0.25);
  --radius:    16px;
  --radius-sm: 10px;
}

/* ── Chat Toggle Button ───────────────────────────────────── */
#chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--saffron) 0%, var(--saffron-d) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(244,130,12,0.50);
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
}

#chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 28px rgba(244,130,12,0.65);
}

#chat-toggle:active { transform: scale(0.95); }

#notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  background: #FF3B30;
  border-radius: 50%;
  border: 2px solid white;
  animation: pulse-dot 2s infinite;
}

#notif-dot.hidden { display: none; }

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* ── Chat Window ──────────────────────────────────────────── */
#chat-box {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 10px;
  right: 24px;
  width: 370px;
  height: 580px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 999;
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255,255,255,0.8);
}

#chat-box.open { display: flex; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 420px) {
  #chat-box { width: calc(100vw - 16px); right: 8px; bottom: 90px; height: 75vh; }
  #chat-toggle { bottom: 16px; right: 16px; }
}

/* ── Header ───────────────────────────────────────────────── */
#chat-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-m) 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

#chat-header::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: rgba(244,130,12,0.15);
  border-radius: 50%;
}

#chat-header::after {
  content: '';
  position: absolute;
  bottom: -30px; left: 60px;
  width: 100px; height: 100px;
  background: rgba(212,175,55,0.08);
  border-radius: 50%;
}

#header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

#bot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--saffron), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
  overflow: hidden;
}

#bot-avatar img { width: 100%; height: 100%; object-fit: cover; }

#bot-initials {
  font-family: 'Baloo Bhaijaan 2', cursive;
  font-size: 15px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

#bot-name {
  font-family: 'Baloo Bhaijaan 2', cursive;
  font-weight: 600;
  font-size: 15px;
  color: var(--white);
  line-height: 1.2;
}

#bot-status {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.status-dot {
  width: 7px; height: 7px;
  background: #4CAF50;
  border-radius: 50%;
  flex-shrink: 0;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#minimize-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background 0.2s;
  position: relative;
  z-index: 1;
}

#minimize-btn:hover { background: rgba(255,255,255,0.22); }

/* ── Messages ─────────────────────────────────────────────── */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

#messages::-webkit-scrollbar { width: 4px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }

/* ── Message Bubbles ──────────────────────────────────────── */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  animation: fadeInUp 0.3s ease;
}

.msg-row.user-row { flex-direction: row-reverse; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--saffron), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.msg-bubble {
  max-width: 72%;
  padding: 10px 13px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.bot-bubble {
  background: var(--gray-100);
  color: var(--navy);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--gray-200);
}

.user-bubble {
  background: linear-gradient(135deg, var(--saffron) 0%, var(--saffron-d) 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(244,130,12,0.3);
}

.msg-time {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 2px;
  padding: 0 4px;
}

.user-row .msg-time { text-align: right; }

/* ── Typing Indicator ─────────────────────────────────────── */
.typing-bubble {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dot {
  width: 7px; height: 7px;
  background: var(--gray-400);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); background: var(--gray-400); }
  30% { transform: translateY(-6px); background: var(--saffron); }
}

/* ── Welcome / Info Card ─────────────────────────────────── */
.info-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-m) 100%);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 4px 0 8px;
  color: white;
}

.info-card-title {
  font-family: 'Baloo Bhaijaan 2', cursive;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--gold);
}

.info-card-text {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  line-height: 1.5;
}

/* ── Quick Buttons ────────────────────────────────────────── */
#quick-wrap {
  padding: 6px 14px 10px;
  flex-shrink: 0;
  background: white;
  border-top: 1px solid var(--gray-200);
}

.quick-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  margin-bottom: 6px;
}

#quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.quick-btn {
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.quick-btn:hover {
  background: var(--saffron-l);
  border-color: var(--saffron);
  color: var(--saffron-d);
  transform: translateY(-1px);
}

.quick-btn:active { transform: translateY(0); }

/* ── Input Area ───────────────────────────────────────────── */
#input-area {
  padding: 10px 14px 12px;
  background: white;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}

#input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: 24px;
  padding: 6px 6px 6px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#input-wrap:focus-within {
  border-color: var(--saffron);
  box-shadow: 0 0 0 3px rgba(244,130,12,0.12);
  background: white;
}

#user-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 13.5px;
  color: var(--navy);
}

#user-input::placeholder { color: var(--gray-400); }

#send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--saffron), var(--saffron-d));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(244,130,12,0.4);
}

#send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(244,130,12,0.5);
}

#send-btn:active { transform: scale(0.95); }

#send-btn:disabled { background: var(--gray-200); box-shadow: none; cursor: not-allowed; }
#send-btn:disabled svg path { stroke: var(--gray-400); }

#powered-by {
  font-size: 10px;
  color: var(--gray-400);
  text-align: center;
  margin-top: 6px;
  letter-spacing: 0.2px;
}