/* ============================================================
   SASTRA ADMITBOT — PROFESSIONAL REDESIGN
   Font: Plus Jakarta Sans (premium, modern, readable)
   Theme: Deep navy + electric blue + clean whites
   ============================================================ */

:root {
  --navy:       #0a1628;
  --navy-mid:   #0f2040;
  --blue:       #1d6aff;
  --blue-soft:  #3d83ff;
  --blue-glow:  rgba(29,106,255,0.18);
  --teal:       #06b6d4;
  --surface:    #ffffff;
  --surface-2:  #f4f7fb;
  --surface-3:  #edf1f7;
  --border:     #e3e8f0;
  --border-2:   #d0d8e8;
  --text-1:     #0d1b33;
  --text-2:     #4a5878;
  --text-3:     #8896ae;
  --green:      #10d98a;
  --shadow-sm:  0 2px 8px rgba(13,27,51,0.06);
  --shadow-md:  0 8px 32px rgba(13,27,51,0.10);
  --shadow-lg:  0 24px 64px rgba(13,27,51,0.14), 0 4px 16px rgba(29,106,255,0.08);
  --r-sm:       10px;
  --r-md:       16px;
  --r-lg:       22px;
  --r-xl:       28px;
}


/* ── Demo page ── */
.demo-page { text-align: center; padding: 2rem; }
.demo-page h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}
.demo-page .subtitle {
  font-size: 1.05rem;
  color: var(--text-2);
  font-weight: 400;
}
.demo-page .robot-wrap {
  font-size: 72px;
  margin: 20px 0 12px;
  display: block;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(29,106,255,0.25));
}
.demo-page .online-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: white;
  border: 1.5px solid var(--border);
  padding: 7px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.online-dot {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,217,138,0.4); }
  50%      { box-shadow: 0 0 0 5px rgba(16,217,138,0); }
}
.demo-page .hint {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 8px;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* ══════════════════════════════════════
   TOGGLE BUTTON
══════════════════════════════════════ */
#chat-toggle {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 62px; height: 62px;
  background: linear-gradient(145deg, #1d6aff, #0a4fdb);
  border: none; border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 6px 28px rgba(29,106,255,0.45), 0 2px 8px rgba(0,0,0,0.12);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1),
              box-shadow 0.3s ease;
  animation: btn-bounce 3s ease-in-out infinite;
}
@keyframes btn-bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}
#chat-toggle:hover {
  transform: scale(1.12) translateY(-3px);
  box-shadow: 0 12px 40px rgba(29,106,255,0.55);
  animation: none;
}
#chat-toggle.open { animation: none; }
.btn-emoji { font-size: 28px; line-height: 1; transition: all 0.3s ease; }
.btn-close  {
  position: absolute; opacity: 0;
  transform: rotate(-90deg) scale(0);
  transition: all 0.3s ease;
}
#chat-toggle.open .btn-emoji { opacity: 0; transform: rotate(90deg) scale(0); }
#chat-toggle.open .btn-close  { opacity: 1; transform: rotate(0) scale(1); }

.notif-ring {
  position: absolute;
  top: -3px; right: -3px;
  width: 20px; height: 20px;
  background: #ff4757;
  border-radius: 50%;
  border: 2.5px solid white;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white;
  animation: ring-pop 2.5s ease-in-out infinite;
}
@keyframes ring-pop {
  0%,80%,100% { transform: scale(1); }
  90%          { transform: scale(1.2); }
}

/* ══════════════════════════════════════
   CHAT WINDOW
══════════════════════════════════════ */
#chat-window {
  position: fixed;
  bottom: 104px; right: 28px;
  width: 400px; height: 620px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  border: 1px solid rgba(29,106,255,0.08);
  transform: scale(0.88) translateY(24px);
  opacity: 0; pointer-events: none;
  transition: all 0.38s cubic-bezier(0.34,1.56,0.64,1);
  transform-origin: bottom right;
}
#chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1; pointer-events: all;
}

/* ── Header ── */
.chat-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #0d2d5e 100%);
  padding: 18px 20px 16px;
  display: flex; align-items: center; gap: 13px;
  position: relative; overflow: hidden; flex-shrink: 0;
}
.chat-header::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 85% -10%, rgba(29,106,255,0.35) 0%, transparent 55%),
    radial-gradient(circle at 10% 110%, rgba(6,182,212,0.2) 0%, transparent 50%);
  pointer-events: none;
}
.header-avatar {
  width: 46px; height: 46px; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(29,106,255,0.3), rgba(6,182,212,0.25));
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  position: relative; z-index: 1;
  backdrop-filter: blur(8px);
}
.header-text { flex: 1; position: relative; z-index: 1; }
.header-name {
  font-size: 15px; font-weight: 700;
  color: white; letter-spacing: -0.3px;
  line-height: 1.2;
}
.header-sub {
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px;
}
.status-badge {
  display: flex; align-items: center; gap: 5px;
  background: rgba(16,217,138,0.15);
  border: 1px solid rgba(16,217,138,0.3);
  padding: 2px 9px; border-radius: 100px;
}
.status-dot-sm {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s infinite;
}
.status-text { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.75); }
.header-meta { font-size: 11px; color: rgba(255,255,255,0.4); }
.header-close-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; position: relative; z-index: 1;
  color: rgba(255,255,255,0.8);
}
.header-close-btn:hover { background: rgba(255,255,255,0.2); color: white; }

/* ── Chips ── */
.chips-wrap {
  padding: 12px 14px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; display: flex; gap: 7px;
  scrollbar-width: none; flex-shrink: 0;
}
.chips-wrap::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: white;
  border: 1.5px solid var(--border-2);
  color: var(--text-1);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11.5px; font-weight: 600;
  padding: 5px 13px;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.chip:hover {
  background: var(--blue); color: white;
  border-color: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(29,106,255,0.3);
}
.chip:active { transform: translateY(0); }

/* ── Messages ── */
.messages-area {
  flex: 1; overflow-y: auto;
  padding: 18px 16px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface-2);
  scroll-behavior: smooth;
}
.messages-area::-webkit-scrollbar { width: 3px; }
.messages-area::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* Date divider */
.date-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 12px; color: var(--text-3);
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase;
}
.date-divider::before, .date-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Message groups */
.msg-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.msg-group.bot  { align-items: flex-start; }
.msg-group.user { align-items: flex-end; }

.msg-row { display: flex; align-items: flex-end; gap: 9px; }
.msg-row.user { flex-direction: row-reverse; }

.msg-avatar-sm {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.bot  .msg-avatar-sm { background: linear-gradient(135deg, #dbeafe, #eff6ff); border: 1px solid var(--border); }
.user .msg-avatar-sm { background: linear-gradient(135deg, #1d6aff, #3d83ff); font-size: 12px; }

/* Hide avatar on consecutive messages */
.msg-row.hide-avatar .msg-avatar-sm { visibility: hidden; }

.bubble {
  max-width: 76%;
  padding: 11px 15px;
  font-size: 14px; line-height: 1.6;
  font-weight: 400;
  word-wrap: break-word;
  position: relative;
}

/* BOT bubble */
.bot .bubble {
  background: white;
  color: var(--text-1);
  border-radius: var(--r-md) var(--r-md) var(--r-md) 4px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
/* BOT first-in-group */
.msg-group.bot .msg-row:first-child .bubble {
  border-radius: var(--r-md) var(--r-md) var(--r-md) 4px;
}
/* BOT middle */
.msg-group.bot .msg-row:not(:first-child):not(:last-child) .bubble {
  border-radius: 4px var(--r-md) var(--r-md) 4px;
}
/* BOT last */
.msg-group.bot .msg-row:last-child:not(:first-child) .bubble {
  border-radius: 4px var(--r-md) var(--r-md) 14px;
}

/* USER bubble */
.user .bubble {
  background: linear-gradient(145deg, #1d6aff, #1558e0);
  color: white;
  border-radius: var(--r-md) var(--r-md) 4px var(--r-md);
  box-shadow: 0 4px 16px rgba(29,106,255,0.3);
}

/* Sender label */
.sender-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-3); padding: 0 4px;
  margin-bottom: 3px; letter-spacing: 0.3px;
}
.bot  .sender-label { padding-left: 42px; }
.user .sender-label { text-align: right; padding-right: 42px; color: var(--blue); }

/* Timestamp */
.msg-meta {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 4px 0;
  font-size: 10.5px; font-weight: 500; color: var(--text-3);
}
.bot  .msg-meta { padding-left: 42px; }
.user .msg-meta { justify-content: flex-end; padding-right: 42px; }
.read-tick { color: #1d6aff; font-size: 12px; }

/* ── Typing indicator ── */
.typing-row {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 12px;
  animation: msg-in 0.3s ease;
}
.typing-bubble {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-md) var(--r-md) var(--r-md) 4px;
  padding: 13px 18px;
  display: flex; align-items: center; gap: 5px;
  box-shadow: var(--shadow-sm);
}
.t-dot {
  width: 7px; height: 7px;
  background: var(--border-2); border-radius: 50%;
  animation: typing-bounce 1.3s ease-in-out infinite;
}
.t-dot:nth-child(2) { animation-delay: 0.15s; }
.t-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%,60%,100% { transform: translateY(0); background: var(--border-2); }
  30%          { transform: translateY(-7px); background: var(--blue); }
}

/* Message animation */
.msg-group { animation: msg-in 0.28s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Input area ── */
.input-section {
  padding: 14px 14px 12px;
  background: white;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.input-row {
  display: flex; align-items: flex-end; gap: 10px;
}
.input-box {
  flex: 1;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px; font-weight: 400;
  color: var(--text-1); line-height: 1.5;
  resize: none; outline: none;
  max-height: 100px; min-height: 42px;
  transition: border-color 0.2s, background 0.2s;
  overflow-y: auto;
}
.input-box:focus {
  border-color: var(--blue);
  background: white;
  box-shadow: 0 0 0 3px var(--blue-glow);
}
.input-box::placeholder { color: var(--text-3); }

.send-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  background: linear-gradient(145deg, var(--blue), #1558e0);
  border: none; border-radius: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 4px 14px rgba(29,106,255,0.35);
}
.send-btn:hover   { transform: scale(1.07); box-shadow: 0 6px 20px rgba(29,106,255,0.5); }
.send-btn:active  { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.send-btn svg { width: 18px; height: 18px; }

.input-footer {
  display: flex; align-items: center; justify-content: center;
  gap: 5px; padding-top: 9px;
  font-size: 10.5px; font-weight: 500; color: var(--text-3);
}
.input-footer .logo-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--blue); opacity: 0.5;
}
.input-footer strong { color: var(--blue); font-weight: 700; }

/* ── Bubble list formatting ── */
.bubble ul { padding-left: 18px; margin: 4px 0; }
.bubble ul li { margin: 2px 0; font-size: 13.5px; }
.bubble strong { font-weight: 700; }
.bubble em { font-style: italic; color: inherit; opacity: 0.8; }
.bubble .notice {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--text-2);
  background: var(--surface-3);
  padding: 4px 10px; border-radius: 6px;
  margin-top: 8px; border-left: 3px solid var(--blue);
}
.user .notice { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.4); }

/* ── Mobile ── */
@media (max-width: 480px) {
  #chat-window { width: calc(100vw - 18px); right: 9px; bottom: 88px; height: 72vh; border-radius: 20px; }
  #chat-toggle { right: 14px; bottom: 14px; }
}