/* ── Nuri chat view ────────────────────────────────────────────────────────── */

#nuri-view.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
}

.nuri-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-shrink: 0;
}

.nuri-back-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-mid);
  cursor: pointer;
  padding: 4px 8px;
}

.nuri-header-title {
  font-family: 'Lora', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  flex: 1;
}

.nuri-header-avatar {
  width: 34px;
  height: 34px;
  background: var(--teal-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nuri-header-avatar .nuri-avatar-icon {
  filter: drop-shadow(0 0 4px rgba(58, 158, 143, 0.6));
}

/* ── Messages container ────────────────────────────────────────────────────── */

.nuri-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* ── Bubbles ───────────────────────────────────────────────────────────────── */

.nuri-bubble-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.nuri-bubble-wrap.nuri { justify-content: flex-start; }
.nuri-bubble-wrap.user { justify-content: flex-end; }

.nuri-bubble-avatar {
  width: 28px;
  height: 28px;
  background: var(--teal-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-bottom: 20px;
}

.nuri-bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 0.82rem;
  line-height: 1.65;
  word-break: break-word;
}

/* Nuri bubble — left, white */
.nuri-bubble-wrap.nuri .nuri-bubble {
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text-dark);
}

/* User bubble — right, teal */
.nuri-bubble-wrap.user .nuri-bubble {
  background: var(--teal-dark);
  border-bottom-right-radius: 4px;
  color: #fff;
}

/* Arabic text inside Nuri bubble */
.nuri-verse-arabic {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  text-align: right;
  direction: rtl;
  line-height: 2;
  display: block;
  margin: 8px 0 4px;
  color: var(--text-dark);
}

.nuri-verse-translation {
  font-style: italic;
  font-size: 0.78rem;
  color: var(--text-mid);
  display: block;
  margin-bottom: 4px;
}

.nuri-verse-ref {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--teal-dark);
  display: block;
}

/* ── Feedback row ──────────────────────────────────────────────────────────── */

.nuri-feedback-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  padding-left: 36px;
}

.nuri-feedback-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.nuri-feedback-btn:hover,
.nuri-feedback-btn.selected {
  border-color: var(--teal-dark);
  color: var(--teal-dark);
  background: var(--teal-light);
}

/* ── Typing indicator ──────────────────────────────────────────────────────── */

.nuri-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 36px;
}

.nuri-typing-dots {
  display: flex;
  gap: 4px;
}

.nuri-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: nuriTypingBounce 1.2s ease-in-out infinite;
}

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

@keyframes nuriTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── Session limit message ─────────────────────────────────────────────────── */

.nuri-session-end {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}

/* Retry button on error */
.nuri-retry-row {
  display: flex;
  padding-left: 36px;
  margin-top: 4px;
}

.nuri-retry-btn {
  background: none;
  border: 1.5px solid var(--teal-dark);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.72rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  color: var(--teal-dark);
  cursor: pointer;
  transition: all 0.15s;
}

.nuri-retry-btn:hover {
  background: var(--teal-light);
}

/* ── Input bar ─────────────────────────────────────────────────────────────── */

.nuri-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px 16px;
  background: #fff;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nuri-textarea {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  resize: none;
  outline: none;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
  color: var(--text-dark);
  transition: border-color 0.15s;
}

.nuri-textarea:focus {
  border-color: var(--teal-dark);
}

.nuri-send-btn {
  background: var(--teal-dark);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}

.nuri-send-btn:disabled {
  background: var(--border);
  cursor: not-allowed;
}

/* ── Nuri Quick-Reply Buttons ── */
.nuri-quick-replies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-width: min(340px, calc(100% - 44px));
  margin: 10px 0 10px 44px;
}

.nuri-quick-replies.single-col {
  grid-template-columns: 1fr;
}

.nuri-qr-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1.5px solid var(--teal-dark);
  border-radius: var(--radius-sm, 14px);
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--teal-dark);
  background: white;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.3;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.nuri-qr-chip:hover {
  background: var(--teal-light, #EDF7F6);
  border-color: var(--teal-dark);
  box-shadow: 0 2px 6px rgba(13,122,122,0.12);
  transform: translateY(-1px);
}

.nuri-qr-chip:active {
  background: var(--teal-dark);
  color: white;
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.nuri-qr-chip:focus-visible {
  outline: 2px solid var(--teal-dark);
  outline-offset: 2px;
}

.nuri-quick-replies.used .nuri-qr-chip {
  opacity: 0.35;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.nuri-quick-replies.used .nuri-qr-chip.selected {
  background: var(--teal-dark);
  color: white;
  opacity: 0.65;
  border-color: var(--teal-dark);
}

.nuri-quick-replies.hidden { display: none; }

