/* ===================================================
   NEXUS AUTH — Premium Design System
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ── Design Tokens ── */
:root {
  --accent-1: #0ea5e9;
  --accent-2: #22d3ee;
  --accent-3: #06b6d4;
  --accent-grad: linear-gradient(90deg, #0ea5e9 0%, #22d3ee 100%);
  --accent-grad-hover: linear-gradient(90deg, #0284c7 0%, #06b6d4 100%);

  --bg: #060714;
  --bg-2: #0d0f23;
  --card-bg: rgba(13, 15, 35, 0.65);
  --card-border: rgba(99, 102, 241, 0.18);
  --card-border-hover: rgba(99, 102, 241, 0.4);

  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;

  --input-bg: rgba(255, 255, 255, 0.04);
  --input-border: rgba(255, 255, 255, 0.1);
  --input-border-focus: rgba(99, 102, 241, 0.6);
  --input-shadow-focus: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 0 20px rgba(99, 102, 241, 0.1);

  --error: #f87171;
  --error-bg: rgba(248, 113, 113, 0.08);
  --error-border: rgba(248, 113, 113, 0.25);
  --success: #34d399;

  --radius-sm: 0.625rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;

  --shadow-card: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--card-border);
  --shadow-btn: 0 8px 32px rgba(99, 102, 241, 0.35);
  --shadow-btn-hover: 0 12px 40px rgba(99, 102, 241, 0.5);

  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: #1a0a3c;
  color: var(--text-1);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* ── Animated Background ── */
.background-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(6, 7, 20, 0.28) 0%, rgba(6, 7, 20, 0.18) 100%),
    /* url('../multi-agent-rag/assets/13167.jpg') center center / cover no-repeat; */
    url('../multi-agent-rag/assets/imgs.jpg') center center / cover no-repeat;
  /* url('../multi-agent-rag/assets/imgs.jpg') center center / cover no-repeat; */
}


/* Aurora orbs */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  animation: drift 18s infinite ease-in-out alternate;
  pointer-events: none;
}

.blob-1 {
  width: 700px;
  height: 700px;
  top: -20%;
  left: -15%;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.22) 0%, rgba(139, 92, 246, 0.08) 50%, transparent 70%);
  animation-duration: 20s;
}

.blob-2 {
  width: 800px;
  height: 800px;
  bottom: -25%;
  right: -20%;
  background: radial-gradient(circle at center, rgba(6, 182, 212, 0.18) 0%, rgba(139, 92, 246, 0.07) 50%, transparent 70%);
  animation-duration: 25s;
  animation-delay: -8s;
}

/* Optional third blob */
.background-container::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(80px);
  animation: drift 30s infinite ease-in-out alternate;
  animation-delay: -15s;
}

/* Grid overlay subtle */
.background-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 60px 60px;
}

@keyframes drift {
  0% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(40px, -30px) scale(1.08);
  }

  66% {
    transform: translate(-20px, 50px) scale(0.95);
  }

  100% {
    transform: translate(60px, 20px) scale(1.12);
  }
}

/* ── Logo / Brand Mark ── */
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-grad);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
  flex-shrink: 0;
  animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
  }

  50% {
    box-shadow: 0 0 35px rgba(56, 189, 248, 0.7), 0 0 60px rgba(139, 92, 246, 0.3);
  }
}

.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

/* ── Card Layout ── */
.auth-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 1.5rem;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-card {
  background: rgb(13 15 35 / 40%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.5rem;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

/* Sheen effect */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
  transition: left 0.8s ease;
}

.auth-card:hover::before {
  left: 0;
}

.auth-card:hover {
  border-color: var(--card-border-hover);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--card-border-hover), 0 0 60px rgba(99, 102, 241, 0.08);
}

/* ── Auth Header ── */
.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #fff 0%, rgba(148, 163, 184, 0.85) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.auth-header p {
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
}

/* ── Forms ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.45;
  transition: opacity var(--transition);
}

.input-group input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-1);
  padding: 0.8rem 1rem 0.8rem 2.6rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  -webkit-appearance: none;
}

/* Inputs without icon (fallback) */
.input-group input:not([data-icon]) {
  padding-left: 1rem;
}

.input-group input:focus {
  border-color: var(--input-border-focus);
  box-shadow: var(--input-shadow-focus);
  background: rgba(255, 255, 255, 0.06);
}

.input-group input:focus+.input-icon,
.input-group input:focus~.input-icon {
  opacity: 1;
}

.input-group input::placeholder {
  color: var(--text-3);
  font-weight: 400;
}

/* Floating label style for inputs with icons */
.input-group:focus-within .input-icon {
  opacity: 0.8;
}

/* ── Form Row ── */
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-top: 0.125rem;
}

/* Custom checkbox */
.remember-me {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.remember-me input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition);
}

.remember-me input[type="checkbox"]:checked {
  background: var(--accent-1);
  border-color: var(--accent-1);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.remember-me input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

.forgot-password {
  color: var(--accent-1);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  transition: color var(--transition);
  position: relative;
}

.forgot-password::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-1);
  transform: scaleX(0);
  transition: transform var(--transition);
  transform-origin: left;
}

.forgot-password:hover {
  color: var(--accent-2);
}

.forgot-password:hover::after {
  transform: scaleX(1);
}

/* ── Buttons ── */
.btn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.02em;
}

/* Ripple */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.3s ease;
}

.btn:active::after {
  background: rgba(255, 255, 255, 0.08);
}

.btn-primary {
  background: var(--accent-grad);
  color: white;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
  background: var(--accent-grad-hover);
  box-shadow: var(--shadow-btn-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

/* Shimmer on primary button */
.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transition: left 0.5s ease;
}

.btn-primary:hover::before {
  left: 150%;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--input-border);
  color: var(--text-1);
  backdrop-filter: blur(8px);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-outline:active {
  transform: scale(0.98);
}

.google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Divider ── */
.divider {
  position: relative;
  margin: 1.75rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--input-border), transparent);
}

.divider span {
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Footer ── */
.auth-footer {
  text-align: center;
  margin-top: 1.75rem;
  font-size: 0.875rem;
  color: var(--text-2);
}

.auth-footer a {
  color: var(--accent-1);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.auth-footer a:hover {
  color: var(--accent-2);
}

/* ── Error Banner ── */
.error-banner {
  display: none;
  background: var(--error-bg);
  color: var(--error);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--error-border);
  text-align: center;
  font-weight: 500;
}

.error-banner.show {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  animation: bannerIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.error-banner.show::before {
  content: '⚠';
  font-size: 0.95rem;
}

@keyframes bannerIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Loader Spinner ── */
.loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Social Login ── */
.social-login {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Custom Multi-Select ── */
.custom-select {
  position: relative;
  width: 100%;
}

.select-box {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-2);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Inter', sans-serif;
  user-select: none;
}

.select-box::after {
  content: '▼';
  font-size: 0.65rem;
  color: var(--text-3);
  transition: transform var(--transition);
}

.select-box:hover {
  border-color: var(--input-border-focus);
  color: var(--text-1);
}

.custom-select.open .select-box::after {
  transform: rotate(180deg);
}

.custom-select.open .select-box {
  border-color: var(--input-border-focus);
  box-shadow: var(--input-shadow-focus);
}

.options-container {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: #0f1229;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  padding: 0.4rem;
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(99, 102, 241, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  animation: dropIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.options-container.hidden {
  display: none;
}

.options-container label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
  font-weight: 400;
  border-radius: 0.5rem;
}

.options-container label:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-1);
}

.options-container input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition);
}

.options-container input[type="checkbox"]:checked {
  background: var(--accent-1);
  border-color: var(--accent-1);
}

.options-container input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Scrollbar */
.options-container::-webkit-scrollbar {
  width: 4px;
}

.options-container::-webkit-scrollbar-track {
  background: transparent;
}

.options-container::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 2px;
}

/* ── FAQ Accordion ── */
.faq-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.faq-item {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.faq-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(99, 102, 241, 0.25);
}

.faq-item.active {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.12);
}

.faq-question {
  width: 100%;
  padding: 1.1rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-size: 0.92rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: color var(--transition);
  gap: 1rem;
}

.faq-question:hover {
  color: #fff;
}

.faq-item.active .faq-question {
  color: #fff;
}

.chevron {
  font-style: normal;
  font-size: 0.7rem;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--accent-1);
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.faq-item.active .chevron {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  padding: 0 1.25rem;
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.65;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease,
    padding 0.35s ease;
}

.faq-item.active .faq-answer {
  max-height: 300px;
  padding-bottom: 1.25rem;
  opacity: 1;
}

/* ── Progress Step Indicator (questions page) ── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--input-border);
  transition: all 0.3s ease;
}

.step-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--accent-grad);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}

/* ── Section Badge (FAQ) ── */
.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  margin-bottom: 0.75rem;
}

/* ── CTA Banner (FAQ bottom) ── */
.cta-wrapper {
  margin-top: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(6, 182, 212, 0.06) 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.cta-wrapper p {
  color: var(--text-2);
  font-size: 0.875rem;
  line-height: 1.5;
}

.cta-wrapper .btn-primary {
  max-width: 240px;
  font-size: 0.9rem;
}

/* ── Utility ── */
.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.w-full {
  width: 100%;
}

/* ── Chat Layout (RAG UI) ── */
.chat-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1050px;
  height: 90vh;
  margin: auto;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  display: flex;
  gap: 1.5rem;
}

.history-sidebar {
  width: 260px;
  background: rgb(13 15 35 / 40%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--input-border);
  margin-bottom: 0.8rem;
}

.history-options {
  position: relative;
  display: flex;
  align-items: center;
}

.options-btn {
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  opacity: 0.6 !important;
}

.options-btn:hover {
  opacity: 1 !important;
  background: rgba(255, 255, 255, 0.08) !important;
  transform: none !important;
}

.history-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #0d0f23;
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.4rem;
  min-width: 140px;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: none;
  animation: dropIn 0.2s ease-out;
}

.history-dropdown.active {
  display: block;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-1);
}

.dropdown-item.delete-all {
  color: #f87171;
}

.dropdown-item.delete-all:hover {
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
}

.history-header h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-right: 0.3rem;
}

.history-list::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 2px;
}

.history-item {
  padding: 0.75rem 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: #f1f5f9;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.delete-history-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  padding: 0.3rem;
  color: #ef4444;
  margin-left: 0.5rem;
  opacity: 0.7;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-history-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(99, 102, 241, 0.25);
  color: var(--text-1);
}

.chat-card {
  flex: 1;
  background: rgb(13 15 35 / 40%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--input-border);
  margin-bottom: 1rem;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.language-selector {
  position: relative;
}

.language-selector select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 0.45rem 2rem 0.45rem 0.7rem;
  color: var(--text-2);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all var(--transition);
  min-width: 130px;
}

.language-selector select:hover {
  border-color: var(--accent-1);
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.08);
}

.language-selector select:focus {
  border-color: var(--input-border-focus);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.language-selector select option {
  background: #0d0f23;
  color: var(--text-1);
  padding: 0.5rem;
}

.language-selector::after {
  content: '▾';
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--text-3);
  pointer-events: none;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.8;
  transition: all var(--transition);
  color: var(--text-2);
}

.icon-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-1);
  color: var(--text-1);
  transform: translateY(-2px);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ── Nav Pill Buttons (OCR / Gladia) ── */
/* ── Top-right floating buttons (OCR / Gladia) ── */
.top-right-actions {
  position: fixed;
  top: 1.1rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  height: 38px;
  padding: 0 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-2);
  opacity: 0.85;
  transition: all var(--transition);
  white-space: nowrap;
  margin-right: 15px;
  margin-top: 20px;
}

.nav-btn:hover {
  opacity: 1;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18) 0%, rgba(34, 211, 238, 0.12) 100%);
  border-color: var(--accent-1);
  color: var(--accent-2);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.2);
}

.nav-btn:active {
  transform: translateY(0) scale(0.97);
}

.chat-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}

.chat-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.messages-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  gap: 1rem;
  animation: bannerIn 0.3s ease-out;
}

.message-user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.message-user .message-avatar {
  background: var(--accent-grad);
}

.message-body {
  max-width: 75%;
}

.message-content {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  border-top-left-radius: 0;
  color: var(--text-1);
  font-size: 0.95rem;
  line-height: 1.5;
}

.message-user .message-content {
  background: var(--accent-1);
  border-radius: 12px;
  border-top-right-radius: 0;
}

.message-meta {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-3);
}

.meta-tag {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
}

.tag-route {
  color: var(--accent-2);
}

.welcome-section {
  text-align: center;
  padding: 2rem 0;
}

.welcome-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.welcome-section h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.welcome-section p {
  color: var(--text-2);
  margin-bottom: 2rem;
}

.sample-questions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}

.sample-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--input-border);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  color: var(--text-1);
  cursor: pointer;
  transition: all 0.2s;
}

.sample-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-1);
  transform: translateY(-2px);
}

.question-form {
  margin-top: auto;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  transition: border-color var(--transition);
}

.chat-input-wrapper:focus-within {
  border-color: var(--input-border-focus);
  box-shadow: var(--input-shadow-focus);
}

#question-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-1);
  padding: 0.5rem;
  resize: none;
  outline: none;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  height: 40px;
  box-sizing: border-box;
}

.send-btn {
  background: var(--accent-grad);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: transform 0.2s;
}

.send-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  cursor: not-allowed;
  color: rgba(255, 255, 255, 0.3);
}

.send-btn:not(:disabled):hover {
  transform: scale(1.05);
}

/* Modal styles for RAG */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 90%;
  max-width: 500px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-1);
  font-size: 1.5rem;
  cursor: pointer;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--input-border);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  background: rgba(52, 211, 153, 0.1);
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
  color: var(--success);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.status-indicator.offline {
  background: var(--error-bg);
  color: var(--error);
}

.status-indicator.offline .status-dot {
  background: var(--error);
}

.typing-indicator {
  display: flex;
  gap: 1rem;
}

.typing-dots {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  border-top-left-radius: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-2);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 0.9rem;
  box-shadow: var(--shadow-btn);
  animation: slideInRight 0.3s ease-out;
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--error);
}

.toast-info {
  border-left: 4px solid var(--accent-1);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ── Page-Specific Wrapper Widths ── */
.faq-wrapper {
  max-width: 600px;
}

.questions-wrapper {
  max-width: 500px;
}

/* ── Mobile Overlay & Menu Btn ── */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-overlay.show {
  opacity: 1;
}

.menu-btn {
  display: none;
  margin-right: 0.5rem;
  margin-bottom: 0;
}

/* ==========================================================
   RESPONSIVE DESIGN — Media Queries
   ========================================================== */

/* ── Tablet & small laptops (≤ 768px) ── */
@media (max-width: 768px) {

  .mobile-overlay {
    display: block;
    pointer-events: none;
  }

  .mobile-overlay.show {
    pointer-events: all;
  }

  .menu-btn {
    display: flex !important;
  }

  /* Allow vertical scroll for tall pages */
  body {
    overflow-y: auto;
    overflow-x: hidden;
    align-items: flex-start;
    padding: 1rem 0;
  }

  /* Reduce background blob sizes */
  .blob-1 {
    width: 400px;
    height: 400px;
  }

  .blob-2 {
    width: 450px;
    height: 450px;
  }

  .background-container::after {
    width: 300px;
    height: 300px;
  }

  /* Auth card adjustments */
  .auth-wrapper {
    max-width: 95%;
    padding: 1rem;
  }

  .auth-card {
    padding: 2rem 1.75rem;
  }

  .auth-header h2 {
    font-size: 1.65rem;
  }

  /* ── Chat Layout: stack sidebar on top ── */
  .chat-wrapper {
    flex-direction: column;
    height: calc(100dvh - 2rem);
    max-width: 98%;
    gap: 0.75rem;
    padding: 0.5rem;
    position: static !important;
    z-index: auto !important;
    transform: none !important;
    animation: none !important;
  }

  .history-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: -320px !important;
    width: 280px !important;
    height: 100dvh !important;
    max-height: none !important;
    z-index: 200 !important;
    border-radius: 0 !important;
    padding: 1.25rem 1rem !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    flex-direction: column !important;
    background: rgb(13 15 35 / 0%) !important;
    backdrop-filter: blur(25px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(200%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
  }

  .history-sidebar.show {
    left: 0 !important;
  }

  .history-list {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 0.6rem;
  }

  .history-item {
    min-width: 0;
    font-size: 0.85rem;
    padding: 0.75rem 0.8rem;
  }

  .chat-card {
    flex: 1;
    border-radius: var(--radius-lg);
    padding: 1rem;
    min-height: 0;
    /* Let flex shrink */
  }

  /* Chat header: allow wrapping */
  .chat-header {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .chat-header .brand-mark {
    flex: 1 1 auto;
    min-width: 0;
  }

  .chat-header-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .language-selector select {
    min-width: 110px;
    font-size: 0.72rem;
    padding: 0.35rem 1.6rem 0.35rem 0.55rem;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .icon-btn svg {
    width: 17px;
    height: 17px;
  }

  /* Welcome section */
  .welcome-icon {
    font-size: 2.4rem;
  }

  .welcome-section h3 {
    font-size: 1.25rem;
  }

  .welcome-section p {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }

  .sample-btn {
    font-size: 0.85rem;
    padding: 0.45rem 0.85rem;
  }

  /* Messages */
  .message-body {
    max-width: 85%;
  }

  .message-content {
    font-size: 0.9rem;
    padding: 0.7rem 1rem;
  }

  /* Modal */
  .modal-card {
    width: 95%;
    padding: 1.25rem;
  }

  /* FAQ adjustments */
  .faq-question {
    padding: 0.9rem 1rem;
    font-size: 0.88rem;
  }

  .faq-answer {
    font-size: 0.85rem;
  }

  /* Toast */
  .toast-container {
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
  }

  .toast {
    font-size: 0.85rem;
  }
}

/* ── Mobile (≤ 640px) ── */
@media (max-width: 640px) {

  body {
    padding: 0.5rem 0;
  }

  /* Blobs even smaller */
  .blob-1 {
    width: 280px;
    height: 280px;
    filter: blur(70px);
  }

  .blob-2 {
    width: 320px;
    height: 320px;
    filter: blur(70px);
  }

  .background-container::after {
    width: 200px;
    height: 200px;
    filter: blur(60px);
  }

  /* Grid overlay — larger cells for performance */
  .background-container::before {
    background-size: 40px 40px;
  }

  /* Auth card */
  .auth-wrapper {
    max-width: 100%;
    padding: 0.5rem;
  }

  .auth-card {
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius-lg);
  }

  .brand-mark {
    margin-bottom: 1.5rem;
    gap: 0.5rem;
  }

  .brand-icon {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .brand-name {
    font-size: 1rem;
  }

  .auth-header {
    margin-bottom: 1.5rem;
  }

  .auth-header h2 {
    font-size: 1.4rem;
  }

  .auth-header p {
    font-size: 0.82rem;
  }

  /* Forms */
  .auth-form {
    gap: 0.9rem;
  }

  .input-group label {
    font-size: 0.72rem;
  }

  .input-group input {
    padding: 0.7rem 0.85rem 0.7rem 2.3rem;
    font-size: 0.88rem;
  }

  .input-group input:not([data-icon]) {
    padding-left: 0.85rem;
  }

  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.88rem;
  }

  /* Form actions — stack if too tight */
  .form-actions {
    font-size: 0.78rem;
    gap: 0.5rem;
  }

  .forgot-password {
    font-size: 0.78rem;
  }

  /* Divider */
  .divider {
    margin: 1.25rem 0;
  }

  .divider span {
    font-size: 0.7rem;
  }

  /* Footer */
  .auth-footer {
    margin-top: 1.25rem;
    font-size: 0.8rem;
  }

  /* ── Chat page mobile ── */
  .chat-wrapper {
    height: calc(100dvh - 1rem);
    max-width: 100%;
    padding: 0.25rem;
    gap: 0.5rem;
  }

  .history-sidebar {
    width: 260px;
    padding: 1rem 0.6rem;
  }

  .history-item {
    font-size: 0.8rem;
    padding: 0.6rem 0.7rem;
  }

  .chat-card {
    padding: 0.75rem;
    border-radius: var(--radius-md);
  }

  .chat-header {
    gap: 0.6rem;
  }

  .chat-header .brand-mark {
    gap: 0.35rem;
  }

  .chat-header .brand-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.75rem !important;
  }

  .chat-header .brand-name {
    font-size: 0.88rem;
  }

  .chat-header-actions {
    gap: 0.3rem;
    width: 100%;
    justify-content: flex-end;
  }

  .status-indicator {
    font-size: 0.7rem;
    padding: 0.2rem 0.45rem;
  }

  .status-dot {
    width: 6px;
    height: 6px;
  }

  .language-selector select {
    min-width: 95px;
    font-size: 0.68rem;
    padding: 0.3rem 1.4rem 0.3rem 0.45rem;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .icon-btn svg {
    width: 15px;
    height: 15px;
  }

  /* Welcome */
  .welcome-section {
    padding: 1.25rem 0;
  }

  .welcome-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }

  .welcome-section h3 {
    font-size: 1.1rem;
  }

  .welcome-section p {
    font-size: 0.82rem;
    margin-bottom: 1.25rem;
    padding: 0 0.25rem;
  }

  .sample-questions {
    gap: 0.5rem;
  }

  .sample-btn {
    font-size: 0.78rem;
    padding: 0.4rem 0.75rem;
  }

  /* Chat input */
  .chat-input-wrapper {
    border-radius: var(--radius-md);
    padding: 0.35rem;
  }

  #question-input {
    font-size: 0.88rem;
    padding: 0.4rem;
  }

  .send-btn {
    width: 36px;
    height: 36px;
  }

  /* Messages */
  .message {
    gap: 0.6rem;
  }

  .message-avatar {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }

  .message-body {
    max-width: 88%;
  }

  .message-content {
    font-size: 0.85rem;
    padding: 0.6rem 0.9rem;
  }

  .message-meta {
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.68rem;
  }

  .meta-tag {
    padding: 0.15rem 0.45rem;
  }

  /* FAQ */
  .faq-question {
    padding: 0.85rem 0.9rem;
    font-size: 0.84rem;
    gap: 0.6rem;
  }

  .faq-answer {
    font-size: 0.82rem;
    line-height: 1.55;
  }

  .faq-item.active .faq-answer {
    padding-bottom: 1rem;
  }

  .chevron {
    width: 18px;
    height: 18px;
    font-size: 0.6rem;
  }

  /* Custom select */
  .select-box {
    font-size: 0.82rem;
    padding: 0.7rem 0.85rem;
  }

  .options-container label {
    font-size: 0.82rem;
    padding: 0.5rem 0.65rem;
  }

  /* CTA wrapper in FAQ */
  .cta-wrapper {
    padding: 1.15rem;
  }

  .cta-wrapper p {
    font-size: 0.8rem;
  }
}

/* ── Small mobile (≤ 480px) ── */
@media (max-width: 480px) {

  .auth-card {
    padding: 1.5rem 1rem;
  }

  .auth-header h2 {
    font-size: 1.25rem;
  }

  .auth-header p {
    font-size: 0.78rem;
  }

  .brand-name {
    font-size: 0.9rem;
  }

  .brand-icon {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
    border-radius: 8px;
  }

  .brand-mark {
    margin-bottom: 1.25rem;
  }

  /* Form actions — stack vertically */
  .form-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .remember-me span {
    font-size: 0.78rem;
  }

  .btn {
    padding: 0.7rem 1rem;
    font-size: 0.82rem;
  }

  .google-icon {
    width: 16px;
    height: 16px;
  }

  /* Chat mobile fine-tuning */
  .history-sidebar {
    width: 240px;
  }

  .chat-header .brand-name {
    font-size: 0.8rem;
  }

  .chat-header-actions {
    gap: 0.25rem;
  }

  .language-selector select {
    min-width: 80px;
    font-size: 0.65rem;
  }

  .icon-btn {
    width: 28px;
    height: 28px;
  }

  .icon-btn svg {
    width: 14px;
    height: 14px;
  }

  .welcome-section h3 {
    font-size: 1rem;
  }

  .sample-questions {
    flex-direction: column;
    align-items: stretch;
  }

  .sample-btn {
    text-align: center;
  }

  /* Error banner */
  .error-banner {
    font-size: 0.78rem;
    padding: 0.6rem 0.8rem;
  }
}

/* ── Very small screens (≤ 360px) ── */
@media (max-width: 360px) {

  .auth-card {
    padding: 1.25rem 0.85rem;
    border-radius: var(--radius-md);
  }

  .auth-header h2 {
    font-size: 1.15rem;
  }

  .input-group input {
    font-size: 0.82rem;
    padding: 0.65rem 0.75rem 0.65rem 2rem;
  }

  .input-icon {
    left: 0.65rem;
    font-size: 0.88rem;
  }

  .divider span {
    font-size: 0.65rem;
  }

  .chat-header .brand-name {
    font-size: 0.72rem;
  }

  .language-selector {
    display: none;
  }

  .status-indicator .status-text {
    display: none;
  }
}

/* ── Height-constrained devices (landscape mobile) ── */
@media (max-height: 600px) and (max-width: 768px) {

  body {
    align-items: flex-start;
    overflow-y: auto;
  }

  .auth-card {
    padding: 1.25rem 1rem;
  }

  .brand-mark {
    margin-bottom: 1rem;
  }

  .auth-header {
    margin-bottom: 1rem;
  }

  .auth-header h2 {
    font-size: 1.25rem;
  }

  .divider {
    margin: 0.75rem 0;
  }

  .auth-footer {
    margin-top: 0.75rem;
  }

  .history-sidebar {
    /* Mobile landscape defaults */
  }
}

font-size: 0.8rem;
color: var(--text-muted);
line-height: 1.5;
}

/* Sample Questions */
.sample-questions {
  max-width: 560px;
  margin: 0 auto;
}

.sample-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.sample-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.sample-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}

.sample-btn:hover {
  background: var(--bg-elevated);
  color: var(--primary-400);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

/* ── Message Bubbles ──────────────────────────────
────────────── */
.message {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeInUp 0.35s ease-out;
  max-width: 100%;
}

.message-user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.message-user .message-avatar {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: white;
}

.message-agent .message-avatar {
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-card));
  border: 1px solid var(--border-subtle);
}

.message-body {
  max-width: 75%;
  min-width: 0;
}

.message-user .message-body {
  text-align: right;
}

.message-content {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.92rem;
  line-height: 1.7;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-user .message-content {
  background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
  color: var(--primary-50);
  border-bottom-right-radius: 4px;
}

.message-agent .message-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  backdrop-filter: blur(12px);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.message-user .message-meta {
  justify-content: flex-end;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
}

.tag-route {
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary-400);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.tag-route.route-general {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.2);
}

.tag-confidence {
  background: rgba(251, 191, 36, 0.1);
  color: var(--gold-400);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.tag-time {
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* ── Typing Indicator ──────────────────────────────
────────────── */
.typing-indicator {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeInUp 0.3s ease-out;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
  backdrop-filter: blur(12px);
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* ── Input Area ────────────────────────────────
────────────────── */
.input-container {
  padding: 16px 24px 20px;
  backdrop-filter: blur(20px);
  background: var(--bg-glass);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.input-form {
  max-width: 100%;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 6px 6px 6px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  transition: var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.input-wrapper textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  padding: 8px 0;
}

.input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

.send-button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  opacity: 0.5;
}

.send-button:not(:disabled) {
  opacity: 1;
}

.send-button:not(:disabled):hover {
  background: linear-gradient(135deg, var(--primary-400), var(--primary-500));
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.send-button:disabled {
  cursor: not-allowed;
}

.input-hint {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
  opacity: 0.7;
}

/* ── Modal ─────────────────────────────────
───────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.95);
  transition: var(--transition);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.modal-body {
  padding: 22px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-400);
}

/* ── Inline Loader ───────────────────────────────
──────────────── */
.loader-inline {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--primary-400);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Toast Notifications ─────────────────────────────
──────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-primary);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease-out;
  max-width: 360px;
}

.toast-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.toast-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast-info {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ── Content Formatting (Agent Response) 
───────────────────────── */
.message-content h1,
.message-content h2,
.message-content h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 600;
}

.message-content h2 {
  font-size: 1.05rem;
}

.message-content h3 {
  font-size: 0.95rem;
  color: var(--primary-300);
}

.message-content p {
  margin-bottom: 10px;
}

.message-content ul,
.message-content ol {
  padding-left: 20px;
  margin-bottom: 10px;
}

.message-content li {
  margin-bottom: 4px;
}

.message-content strong {
  color: var(--primary-300);
  font-weight: 600;
}

.message-content em {
  color: var(--gold-400);
  font-style: italic;
}

.message-content blockquote {
  border-left: 3px solid var(--primary-500);
  padding: 8px 14px;
  margin: 10px 0;
  background: rgba(16, 185, 129, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.message-content code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.message-content img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.message-content img:hover {
  filter: brightness(1.1);
}

position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(17, 17, 27, 0.95);
z-index: 99999;
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
}

opacity: 1;
pointer-events: all;
}

.zoom-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 20px;
  border-radius: 30px;
  backdrop-filter: blur(5px);
  z-index: 100000;
}

.zoom-btn {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.2s ease;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.zoom-img-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

max-width: 90vw;
max-height: 90vh;
object-fit: contain;
border-radius: 8px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
transform: scale(0.9);
transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

transform: scale(1);
}

/* ── Animations ────────────────────────────────
────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ────────────────────────────────
────────────────── */
@media (max-width: 640px) {
  .app-header {
    padding: 12px 16px;
  }

  .header-actions .btn-ghost span {
    display: none;
  }

  .chat-container {
    padding: 16px;
  }

  .welcome-title {
    font-size: 1.5rem;
  }

  .arabic-text {
    font-size: 1.2rem;
  }

  .agent-cards {
    grid-template-columns: 1fr;
  }

  .message-body {
    max-width: 85%;
  }

  .input-container {
    padding: 12px 16px 16px;
  }

  .sample-btn {
    font-size: 0.78rem;
    padding: 6px 12px;
  }
}





/* Added Lightbox */
.image-zoom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(17, 17, 27, 0.95);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.image-zoom-modal.active {
  opacity: 1;
  pointer-events: all;
}

.zoom-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 20px;
  border-radius: 30px;
  backdrop-filter: blur(5px);
  z-index: 100000;
}

.zoom-btn {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.2s ease;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.zoom-img-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.image-zoom-modal img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.image-zoom-modal.active img {
  transform: scale(1);
}

/* ── Animations ────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .app-header {
    padding: 12px 16px;
  }

  .header-actions .btn-ghost span {
    display: none;
  }

  .chat-container {
    padding: 16px;
  }

  .welcome-title {
    font-size: 1.5rem;
  }

  .arabic-text {
    font-size: 1.2rem;
  }

  .agent-cards {
    grid-template-columns: 1fr;
  }

  .message-body {
    max-width: 85%;
  }

  .input-container {
    padding: 12px 16px 16px;
  }

  .sample-btn {
    font-size: 0.78rem;
    padding: 6px 12px;
  }
}