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

:root {
  --bg:         #FFFFFF;
  --bg-chat:    #FFEDFE;
  --bg-card:    #FFFFFF;
  --bg-input:   #FFFFFF;
  --accent:     #F261FF;
  --accent-2:   #FF9CF0;
  --accent-light: #FFEDFE;
  --text-1:     #1a1a2e;
  --text-2:     #555577;
  --text-3:     #9999bb;
  --border:     rgba(242,97,255,0.15);
  --border-2:   rgba(242,97,255,0.3);
  --shadow:     0 2px 16px rgba(242,97,255,0.08);
  --bubble-user: #F261FF;
  --bubble-user-text: #FFFFFF;
  --bubble-bot: #FFFFFF;
  --bubble-bot-text: #1a1a2e;
  --radius:     14px;
  --radius-sm:  8px;
  --font:       'Inter', sans-serif;
  --font-bn:    'Noto Sans Bengali', sans-serif;
}

[data-theme="dark"] {
  --bg:         #0f0f1a;
  --bg-chat:    #14102a;
  --bg-card:    #1e1a30;
  --bg-input:   #1e1a30;
  --text-1:     #f0ecff;
  --text-2:     #a89ec8;
  --text-3:     #6b5f8a;
  --border:     rgba(242,97,255,0.12);
  --border-2:   rgba(242,97,255,0.25);
  --shadow:     0 2px 20px rgba(0,0,0,0.4);
  --bubble-bot: #1e1a30;
  --bubble-bot-text: #f0ecff;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  transition: background 0.2s, color 0.2s;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { flex-shrink: 0; }
.logo-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.2px;
}
.logo-sub {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}

.header-right { display: flex; align-items: center; gap: 10px; }

.mode-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  padding: 3px 10px;
  transition: all 0.2s;
}

.theme-toggle {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: background 0.2s, border-color 0.2s;
}
.theme-toggle:hover { background: var(--accent-light); border-color: var(--border-2); }

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* ── Chat area ── */
.chat-wrapper {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-chat);
  scroll-behavior: smooth;
}

.chat-area {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100%;
}

/* ── Welcome ── */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 16px 24px;
  gap: 12px;
  flex: 1;
}
.welcome h2 { font-size: 22px; font-weight: 600; color: var(--text-1); }
.welcome p  { font-size: 14px; color: var(--text-2); max-width: 380px; line-height: 1.6; }

.welcome-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.chip {
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-2);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font-bn), var(--font);
  transition: all 0.15s;
}
.chip:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* ── Message bubbles ── */
.msg-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-row.user { align-items: flex-end; }
.msg-row.bot  { align-items: flex-start; }

.bubble {
  max-width: 72%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  font-family: var(--font-bn), var(--font);
}
.msg-row.user .bubble {
  background: var(--bubble-user);
  color: var(--bubble-user-text);
  border-bottom-right-radius: 4px;
}
.msg-row.bot .bubble {
  background: var(--bubble-bot);
  color: var(--bubble-bot-text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}

.msg-label {
  font-size: 11px;
  color: var(--text-3);
  padding: 0 4px;
}

/* ── Result card ── */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 72%;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sentiment-emoji {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.sentiment-label {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-1);
  text-transform: capitalize;
}
.sentiment-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

/* Confidence bar */
.conf-row { display: flex; flex-direction: column; gap: 6px; }
.conf-top  { display: flex; justify-content: space-between; align-items: center; }
.conf-label { font-size: 12px; color: var(--text-2); }
.conf-pct   { font-size: 12px; font-weight: 500; color: var(--accent); }
.conf-track {
  height: 6px;
  background: var(--accent-light);
  border-radius: 4px;
  overflow: hidden;
}
.conf-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

/* Detail rows */
.result-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.detail-key   { color: var(--text-3); }
.detail-value { color: var(--text-2); font-weight: 500; }

/* Typing indicator */
.typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: var(--bubble-bot);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
  max-width: 80px;
  box-shadow: var(--shadow);
}
.typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* Error bubble */
.error-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #fff0f0;
  border: 1px solid #ffd0d0;
  color: #c0392b;
  font-size: 13px;
  max-width: 72%;
}
[data-theme="dark"] .error-bubble {
  background: #2a1010;
  border-color: #5a2020;
  color: #ff8080;
}

/* ── Input footer ── */
.input-footer {
  flex-shrink: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 14px 16px 18px;
}

.input-container {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-box {
  background: var(--bg-input);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242,97,255,0.1);
}
.input-box.error {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231,76,60,0.1);
}

textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-family: var(--font-bn), var(--font);
  font-size: 14px;
  color: var(--text-1);
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}
textarea::placeholder { color: var(--text-3); }

.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.char-count { font-size: 11px; color: var(--text-3); }

.send-btn {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white;
  transition: opacity 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.send-btn:hover { opacity: 0.85; }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.input-hint {
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
}
.input-hint.error-hint { color: #e74c3c; }

/* ── Scrollbar ── */
.chat-wrapper::-webkit-scrollbar { width: 4px; }
.chat-wrapper::-webkit-scrollbar-track { background: transparent; }
.chat-wrapper::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .bubble, .result-card, .error-bubble { max-width: 90%; }
  .logo-sub { display: none; }
  .welcome  { padding: 32px 12px 16px; }
  .welcome h2 { font-size: 18px; }
}


/* ── ADD THESE TO THE BOTTOM OF style.css ── */

/* Label row that holds "You" + copy button side by side */
.msg-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end; /* user row is right-aligned */
}

/* Copy button */
.copy-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: 2px 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.copy-btn:hover {
  color: var(--accent);
  background: var(--accent-light);
}

/* Cold start hint below typing indicator */
.cold-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
  padding: 0 4px;
  max-width: 280px;
  line-height: 1.5;
}

/* Multi-line label (Sentiment + Emotion on separate lines) */
.result-label-multiline {
  white-space: pre-line;
  font-size: 14px;
  line-height: 1.6;
}
