/* ===================== RESET ===================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  height: 100%;
}

/* ===================== THEME TOKENS ===================== */

:root {
  --bg-main-dark: #05080b;
  --bg-chat-dark: #05080b;
  --bg-bubble-bot-dark: #111827;
  --bg-input-dark: #111827;
  --border-dark: #1f2933;
  --text-main-dark: #e5e7eb;

  --bg-main-light: #f3f4f6;
  --bg-chat-light: #ffffff;
  --bg-bubble-bot-light: #e8edf5;
  --bg-input-light: #ffffff;
  --border-light: #e5e7eb;
  --text-main-light: #111827;

  /* ── Spacing — 4px grid ── */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  /* ── Typography scale (1.250 ratio, base 16) ── */
  --fs-xs:  12px;
  --fs-sm:  14px;
  --fs-md:  16px;
  --fs-lg:  20px;
  --fs-xl:  25px;
  --fs-2xl: 31px;

  /* ── Radius scale ── */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   20px;
  --r-full: 9999px;

  /* ── Shadow — two elevations only ── */
  --shadow-1: 0 2px 8px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-2: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.12);

  /* ── Motion tokens ── */
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:      cubic-bezier(0.7, 0, 0.84, 0);
  --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast:     120ms;
  --dur-base:     200ms;
  --dur-slow:     300ms;

  /* Legacy motion aliases (keep for backward compat) */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-smooth: cubic-bezier(0.33, 1, 0.68, 1);
  --duration-fast: 0.2s;
  --duration-normal: 0.35s;
  --duration-slow: 0.5s;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.18);
  --shadow-glow-emerald: 0 0 32px rgba(16, 185, 129, 0.15);
}

/* ===================== BASE ===================== */

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body[data-theme="dark"] {
  background: var(--bg-main-dark);
  color: var(--text-main-dark);
  --brand: #10b981;
  --ok:    #10b981;
  --warn:  #f59e0b;
  --err:   #ef4444;
  --info:  #3b82f6;
}

body[data-theme="light"] {
  background: var(--bg-main-light);
  color: var(--text-main-light);
  --brand: #059669;
  --ok:    #059669;
  --warn:  #d97706;
  --err:   #dc2626;
  --info:  #2563eb;
}

.about-body {
  min-height: 100vh;
}

/* Chat background */

body[data-theme="dark"] .free-chat-window,
body[data-theme="light"] .free-chat-window {
  background: transparent;
}

/* Bot bubble colors per theme */

body[data-theme="dark"] .bot .message-bubble {
  background: var(--bg-bubble-bot-dark);
  border-color: var(--border-dark);
  color: var(--text-main-dark);
}

body[data-theme="light"] .bot .message-bubble {
  background: #e8edf5;
  border-color: #d0d9e8;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

body[data-theme="light"] .user .message-bubble {
  background: #2563eb;
  color: #ffffff;
}

/* Input bar per theme */

body[data-theme="dark"] .free-input-bar {
  background: #111827;
  border-color: #4b5563;
}

body[data-theme="light"] .free-input-bar {
  background: #ffffff;
  border-color: #d1d5db;
}

/* ===================== NAVBAR & HAMBURGER ===================== */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #1f2933;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 200;
  overflow: visible;
}

body[data-theme="dark"] .navbar {
  background: #05080b;
  border-bottom-color: #1f2933;
}

body[data-theme="light"] .navbar {
  background: #ffffff;
  border-bottom-color: #e5e7eb;
}

.logo {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 22px;
  width: auto;
  display: none;
}

body[data-theme="dark"]  .logo-dark  { display: block; }
body[data-theme="light"] .logo-light { display: block; }

/* Small title next to logo */

.nav-title {
  font-size: 0.85rem;
  font-weight: 500;
  margin-left: 8px;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.nav-title h2 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

/* Right side of navbar */

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-links a {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

body[data-theme="dark"] .nav-links a {
  color: #d1d5db;
}
body[data-theme="light"] .nav-links a {
  color: #4b5563;
}

.nav-links a:hover {
  color: #60a5fa;
}

/* Hamburger */

.hamburger {
  width: 28px;
  height: 20px;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  padding: 0;
  z-index: 301;
  position: relative;
}

.hamburger span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: #e5e7eb;
  transition: transform 0.25s ease, opacity 0.2s ease, width 0.25s ease;
  transform-origin: center;
}

body[data-theme="light"] .hamburger span {
  background: #111827;
}

/* Animate to X when open */
.hamburger.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* Dropdown */

.menu-dropdown {
  position: fixed;
  top: 56px;
  right: 16px;
  min-width: 200px;
  border-radius: 12px;
  padding: 4px;
  z-index: 300;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

body[data-theme="dark"] .menu-dropdown {
  background: #1c1f26;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 28px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
}

body[data-theme="light"] .menu-dropdown {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.09);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.menu-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Each item */
.menu-dropdown a,
.menu-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}

body[data-theme="dark"] .menu-dropdown a,
body[data-theme="dark"] .menu-dropdown button { color: #e5e7eb; }
body[data-theme="light"] .menu-dropdown a,
body[data-theme="light"] .menu-dropdown button { color: #111827; }

body[data-theme="dark"] .menu-dropdown a:hover,
body[data-theme="dark"] .menu-dropdown button:hover { background: rgba(255,255,255,0.07); }
body[data-theme="light"] .menu-dropdown a:hover,
body[data-theme="light"] .menu-dropdown button:hover { background: rgba(0,0,0,0.05); }

/* Section dividers */
.nd-section-divider,
.menu-dropdown .menu-divider {
  height: 1px;
  margin: 4px 6px;
}
body[data-theme="dark"]  .nd-section-divider,
body[data-theme="dark"]  .menu-dropdown .menu-divider { background: rgba(255,255,255,0.07); }
body[data-theme="light"] .nd-section-divider,
body[data-theme="light"] .menu-dropdown .menu-divider { background: rgba(0,0,0,0.07); }

/* Icon inside each row */
.menu-item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
}

/* Logout item — subtle red tint on hover */
.menu-dropdown .nd-logout:hover,
.menu-dropdown .menu-logout:hover,
.menu-dropdown #logoutLink:hover { background: rgba(239,68,68,0.1) !important; color: #ef4444 !important; }
body[data-theme="light"] .menu-dropdown .nd-logout:hover,
body[data-theme="light"] .menu-dropdown .menu-logout:hover,
body[data-theme="light"] .menu-dropdown #logoutLink:hover { background: rgba(239,68,68,0.08) !important; color: #dc2626 !important; }

/* Locked menu item (e.g., Dashboard when not logged in) */
.menu-dropdown .menu-item-locked {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 500;
  width: 100%;
  text-align: left;
  opacity: 0.5;
  cursor: not-allowed;
}
body[data-theme="dark"] .menu-dropdown .menu-item-locked { color: #9ca3af; }
body[data-theme="light"] .menu-dropdown .menu-item-locked { color: #6b7280; }

/* ===================== ABOUT PAGE (SHARED STYLES) ===================== */

.hero {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}

.hero h1 {
  font-size: 46px;
  font-weight: 700;
  margin-bottom: 10px;
}

/* Typewriter */

.typewriter {
  font-size: 34px;
  font-family: 'Fira Code', 'Courier New', monospace;
}

.cursor {
  display: inline-block;
  margin-left: 4px;
  font-weight: 340;
  font-size: 43px;
  line-height: 1;
  animation: cursor-blink 0.9s steps(2, start) infinite;
}

@keyframes cursor-blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
  opacity: 0;
  }
}

/* About sections */

.section {
  max-width: 900px;
  margin: auto;
  padding: 60px 30px;
}

.section h2 {
  font-size: 28px;
  margin-bottom: 12px;
}

.section p {
  font-size: 18px;
  line-height: 1.6;
}

.section ul {
  margin-top: 12px;
}

.section li {
  margin: 8px 0;
  font-size: 17px;
}

/* About footer — unified site footer (used on every public page) */

.about-footer {
  position: relative;
  margin-top: 72px;
  padding: 46px 24px 38px;
  font-size: 14px;
}
.about-footer .ft-inner { max-width: 920px; margin: 0 auto; }

.about-footer .ft-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px 40px;
  padding-bottom: 26px;
}
.about-footer .ft-brand {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-width: 360px;
}
.about-footer .ft-word {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.about-footer .ft-word i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand, #10b981);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.about-footer .ft-tag { font-size: 0.82rem; line-height: 1.55; }

.about-footer .ft-links {
  display: flex;
  flex-wrap: wrap;
  gap: 11px 24px;
  padding-top: 3px;
}
.about-footer .ft-links a {
  position: relative;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: inherit;
  opacity: 0.68;
  transition: opacity 0.2s ease, color 0.2s ease;
}
.about-footer .ft-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  height: 1.5px;
  width: 0;
  background: var(--brand, #10b981);
  border-radius: 2px;
  transition: width 0.25s ease;
}
.about-footer .ft-links a:hover { opacity: 1; color: var(--brand, #10b981); }
.about-footer .ft-links a:hover::after { width: 100%; }

.about-footer .ft-bot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 22px;
  font-size: 0.74rem;
  letter-spacing: 0.01em;
}
.about-footer .ft-made { display: inline-flex; align-items: center; gap: 6px; }

body[data-theme="dark"]  .about-footer { color: #cdd9d3; }
body[data-theme="dark"]  .about-footer .ft-word { color: #f1f5f9; }
body[data-theme="dark"]  .about-footer .ft-tag,
body[data-theme="dark"]  .about-footer .ft-bot { color: #7d958c; }
body[data-theme="dark"]  .about-footer .ft-bot { border-top: 1px solid rgba(255, 255, 255, 0.07); }

body[data-theme="light"] .about-footer { color: #4b5a53; }
body[data-theme="light"] .about-footer .ft-word { color: #0a1611; }
body[data-theme="light"] .about-footer .ft-tag,
body[data-theme="light"] .about-footer .ft-bot { color: #6b7a72; }
body[data-theme="light"] .about-footer .ft-bot { border-top: 1px solid rgba(0, 0, 0, 0.07); }

@media (max-width: 600px) {
  .about-footer { padding: 38px 20px 32px; text-align: left; }
  .about-footer .ft-top { gap: 22px; }
}

/* ===================== LOGIN LAYOUT & CARD ===================== */

.page-main {
  min-height: calc(100vh - 56px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px 60px;
}

/* Solid bg in the small gap between navbar and ai-controls so chat doesn't peek through */
.page-main::before {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 60px;
  pointer-events: none;
  z-index: 100;       /* above chat (auto), below ai-controls (140) and navbar (200) */
}
body[data-theme="dark"]  .page-main::before { background: var(--bg-main-dark); }
body[data-theme="light"] .page-main::before { background: var(--bg-main-light); }

.login-page {
  align-items: center;
  padding-top: 100px;
}

.light-login-card {
  max-width: 420px;
  width: 100%;
  border-radius: 20px;
  padding: 32px 24px;
  border: 1px solid #1f2933;
  background: #05080b;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
  min-height: 340px;
}

/* Dark theme */
body[data-theme="dark"] .light-login-card {
  background: #1c1f26;
  border-color: #1f2933;
  color: #e5e7eb;
}

/* Light theme */
body[data-theme="light"] .light-login-card {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #111827;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.login-header {
  text-align: center;
  margin-bottom: 22px;
}

.login-header h1 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

body[data-theme="dark"] .login-header h1 {
  color: #f9fafb;
}

body[data-theme="light"] .login-header h1 {
  color: #111827;
}

.login-header p {
  margin-top: 6px;
  font-size: 0.9rem;
}

body[data-theme="dark"] .login-header p {
  color: #9ca3af;
}

body[data-theme="light"] .login-header p {
  color: #6b7280;
}

.login-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #1f2933, transparent);
  margin: 20px 0 22px;
}

.login-form {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 0.82rem;
  font-weight: 600;
}

body[data-theme="dark"] .login-field label {
  color: #cbd5f5;
}

body[data-theme="light"] .login-field label {
  color: #374151;
}

.login-field input {
  height: 46px;
  border-radius: 999px;
  padding: 0 16px;
  font-size: 0.92rem;
  border: 1px solid #374151;
  background: #020617;
  color: #e5e7eb;
  transition: border 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

body[data-theme="light"] .login-field input {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #111827;
}

.login-field input::placeholder {
  color: #6b7280;
}

body[data-theme="light"] .login-field input::placeholder {
  color: #9ca3af;
}

.login-field input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.login-btn {
  margin-top: 6px;
  align-self: center;
  padding: 11px 30px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #f9fafb;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.15s ease;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.5);
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.7);
  filter: brightness(1.03);
}

.login-btn:active {
  transform: scale(0.97);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.55);
}

.subtle-link {
  color: #60a5fa;
  text-decoration: none;
  font-size: 0.85rem;
}

.subtle-link:hover {
  text-decoration: underline;
}

/* ===================== MESSAGE BUBBLES ===================== */

.message-row {
  display: flex;
  width: 100%;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.bot {
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
}

.message-bubble {
  max-width: 78%;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.55;
  border-radius: 14px;
  animation: messageIn 0.2s ease;
}

/* User bubble */

.user .message-bubble {
  background: #2563eb;
  color: #f9fafb;
  border-bottom-right-radius: 4px;
}

/* Bot bubble default */

.bot .message-bubble {
  background: #111827;
  color: #e5e7eb;
  border: 1px solid #1f2933;
  border-bottom-left-radius: 4px;
}

/* Mobile: give the bot bubble more horizontal room so AI replies don't
   wrap into compact narrow columns. User bubbles keep the 78% default
   so the chat still has the asymmetric "you on the right, AI on the
   left" balance. Desktop is unchanged. */
@media (max-width: 768px) {
  .bot .message-bubble {
    max-width: 94%;
  }
}

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

/* Optional small meta text inside bot bubble */
.meta-text {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-bottom: 4px;
}

/* ── Message action bar (copy, thumbs, regenerate) ── */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding-left: 2px;
  opacity: 1;
}
.msg-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, transform 0.1s;
  flex-shrink: 0;
  padding: 0;
}
body[data-theme="dark"]  .msg-action-btn { color: #6b7280; }
body[data-theme="light"] .msg-action-btn { color: #9ca3af; }
body[data-theme="dark"]  .msg-action-btn:hover { background: rgba(255,255,255,0.08); color: #e5e7eb; }
body[data-theme="light"] .msg-action-btn:hover { background: rgba(0,0,0,0.07);       color: #111827; }
.msg-action-btn:active { transform: scale(0.97); }
.msg-action-btn.active-thumb-up   { color: #10b981 !important; animation: thumbPop 0.35s ease; }
.msg-action-btn.active-thumb-down { color: #ef4444 !important; animation: thumbPop 0.35s ease; }
.msg-action-btn.active-speak      { color: #3b82f6 !important; animation: thumbPop 0.35s ease; }
.msg-action-btn.copied { color: #10b981 !important; }

/* ── "Copied" label under copy button ── */
.copy-label {
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-size: 0.65rem;
  font-weight: 600;
  color: #10b981;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.copy-label.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Plus Jakarta Sans for chat + input ── */
.free-chat-window,
.message-bubble,
.free-input-bar,
.input-textarea-row textarea,
.model-chip-btn {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* ── Copy toast ── */
.copy-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: #1f2937;
  color: #e5e7eb;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 99999;
  white-space: nowrap;
}
body[data-theme="light"] .copy-toast {
  background: #111827;
  color: #f9fafb;
}
.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===================== AI CONTROLS (FIXED TOP UNDER NAVBAR) ===================== */

.ai-shell {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

/* Controls fixed under navbar, centered within max-width */
.ai-controls {
  position: fixed;
  left: 0;
  right: 0;
  top: 57px;               /* navbar height + small gap so full border is visible */
  z-index: 140;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px;     /* fully rounded on all corners */
  border: 1px solid #1f2933;
  background: #111827;
}

body[data-theme="light"] .ai-controls {
  background: #e5e7eb;
  border-color: rgba(0, 0, 0, 0.12);
}

/* Base controls */

.ai-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
  flex: 1 1 0;
}

.ai-control label {
  font-size: 0.75rem;
  font-weight: 500;
}

body[data-theme="dark"] .ai-control label {
  color: #e5e7eb;
}

body[data-theme="light"] .ai-control label {
  color: #374151;
}

.ai-control select,
.ai-control input {
  height: 40px;
  border-radius: 999px;
  border: 1px solid #374151;
  padding: 0 14px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

body[data-theme="dark"] .ai-control select,
body[data-theme="dark"] .ai-control input {
  color: #e5e7eb;
  background: #111827;
  border-color: #374151;
}

body[data-theme="light"] .ai-control select,
body[data-theme="light"] .ai-control input {
  color: #111827;
  background: #ffffff;
  border-color: #d1d5db;
}

/* Hover/focus – dark */
body[data-theme="dark"] .ai-control select:hover,
body[data-theme="dark"] .ai-control input:hover {
  border-color: #4b5563;
}

body[data-theme="dark"] .ai-control select:focus,
body[data-theme="dark"] .ai-control input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

/* Hover/focus – light */
body[data-theme="light"] .ai-control select:hover,
body[data-theme="light"] .ai-control input:hover {
  border-color: #9ca3af;
}

body[data-theme="light"] .ai-control select:focus,
body[data-theme="light"] .ai-control input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* ===================== CUSTOM DROPDOWN ===================== */

/* Hide native select when custom dropdown is active */
.ai-control .custom-dropdown-wrapper select {
  display: none;
}

/* Dropdown wrapper */
.custom-dropdown {
  position: relative;
  width: 100%;
}

/* Dropdown trigger button */
.custom-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  text-align: left;
}

body[data-theme="dark"] .custom-dropdown-trigger {
  color: #e5e7eb;
  background: #111827;
  border-color: #374151;
}

body[data-theme="light"] .custom-dropdown-trigger {
  color: #111827;
  background: #ffffff;
  border-color: #d1d5db;
}

body[data-theme="dark"] .custom-dropdown-trigger:hover {
  border-color: #4b5563;
}

body[data-theme="light"] .custom-dropdown-trigger:hover {
  border-color: #9ca3af;
}

.custom-dropdown.open .custom-dropdown-trigger {
  border-color: #10b981;
}

body[data-theme="dark"] .custom-dropdown.open .custom-dropdown-trigger {
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

body[data-theme="light"] .custom-dropdown.open .custom-dropdown-trigger {
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Chevron icon */
.custom-dropdown-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

body[data-theme="dark"] .custom-dropdown-chevron {
  stroke: #9ca3af;
}

body[data-theme="light"] .custom-dropdown-chevron {
  stroke: #6b7280;
}

.custom-dropdown.open .custom-dropdown-chevron {
  transform: rotate(180deg);
}

/* Dropdown menu */
.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid;
  padding: 6px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}

.custom-dropdown.open .custom-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

body[data-theme="dark"] .custom-dropdown-menu {
  background: #111827;
  border-color: #374151;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

body[data-theme="light"] .custom-dropdown-menu {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* Dropdown options */
.custom-dropdown-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

body[data-theme="dark"] .custom-dropdown-option {
  color: #d1d5db;
}

body[data-theme="light"] .custom-dropdown-option {
  color: #374151;
}

body[data-theme="dark"] .custom-dropdown-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

body[data-theme="light"] .custom-dropdown-option:hover {
  background: #f3f4f6;
  color: #111827;
}

.custom-dropdown-option.selected {
  font-weight: 500;
}

body[data-theme="dark"] .custom-dropdown-option.selected {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

body[data-theme="light"] .custom-dropdown-option.selected {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

/* Checkmark */
.custom-dropdown-check {
  width: 16px;
  height: 16px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.custom-dropdown-option.selected .custom-dropdown-check {
  opacity: 1;
}

body[data-theme="dark"] .custom-dropdown-check {
  stroke: #10b981;
}

body[data-theme="light"] .custom-dropdown-check {
  stroke: #059669;
}

/* Scrollbar styling for dropdown */
.custom-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

body[data-theme="dark"] .custom-dropdown-menu::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 3px;
}

body[data-theme="light"] .custom-dropdown-menu::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

/* ===================== FREE STYLE CHAT LAYOUT ===================== */

.free-chat-shell {
  position: relative;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Chat area: top padding = navbar + controls, so answers never go behind */

.free-chat-window {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 170px 12px 200px;   /* 136px top ensures chat starts below controls (58px navbar + ~78px controls) */
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.free-chat-window::-webkit-scrollbar {
  width: 6px;
}

.free-chat-window::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 999px;
}

/* Floating input centered at bottom */

.free-input-wrapper {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Solid backdrop so chat messages don't peek through the gap below the input bar */
.free-input-wrapper::before {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 160px;
  pointer-events: none;
  z-index: -1;
}
body[data-theme="dark"]  .free-input-wrapper::before {
  background: linear-gradient(to top, var(--bg-main-dark) 70%, transparent);
}
body[data-theme="light"] .free-input-wrapper::before {
  background: linear-gradient(to top, var(--bg-main-light) 70%, transparent);
}

/* Scroll to bottom button */
.scroll-to-bottom {
  pointer-events: auto;
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.scroll-to-bottom.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

.scroll-to-bottom:active {
  transform: translateX(-50%) scale(0.92);
}

body[data-theme="dark"] .scroll-to-bottom {
  background: rgba(17, 24, 39, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
  color: #9ca3af;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4),
              0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

body[data-theme="light"] .scroll-to-bottom {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.08);
  color: #6b7280;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1),
              0 1px 3px rgba(0, 0, 0, 0.06);
}

body[data-theme="dark"] .scroll-to-bottom:hover {
  background: rgba(31, 41, 55, 0.95);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15),
              0 0 0 1px rgba(16, 185, 129, 0.1) inset;
}

body[data-theme="light"] .scroll-to-bottom:hover {
  background: #ffffff;
  border-color: rgba(16, 185, 129, 0.5);
  color: #059669;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.12),
              0 1px 3px rgba(0, 0, 0, 0.06);
}

.scroll-to-bottom svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.scroll-to-bottom:hover svg {
  transform: translateY(2px);
}

.free-input-bar {
  pointer-events: auto;
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18),
              0 6px 18px rgba(0,0,0,0.32),
              0 18px 48px rgba(0,0,0,0.22);
  border: 1px solid transparent;
}

/* Textarea inside bar */

.free-input-bar textarea {
  flex: 1;
  border: none;
  resize: none;
  min-height: 40px;
  max-height: 160px;
  padding: 6px 8px;
  font-size: 0.95rem;
  background: transparent;
  outline: none;
  overflow-y: auto;
}

body[data-theme="dark"] .free-input-bar textarea {
  color: #e5e7eb;
}

body[data-theme="light"] .free-input-bar textarea {
  color: #111827;
}

.free-input-bar textarea::placeholder {
  color: #9ca3af;
}

/* Send button — see .tb-send rule below */

/* Loading spinner */

.send-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(249, 250, 251, 0.4);
  border-top-color: #f9fafb;
  animation: send-spin 0.6s linear infinite;
}

@keyframes send-spin {
  to {
    transform: rotate(360deg);
  }
}

/* AI Disclaimer */

.ai-disclaimer {
  display: block;
  pointer-events: auto;
  text-align: center;
  font-size: 0.73rem;
  padding: 8px 20px 0;
  margin-top: 6px;
  max-width: 900px;
  width: 100%;
}

body[data-theme="dark"] .ai-disclaimer {
  opacity: 0.4;
  color: #e5e7eb;
}

body[data-theme="light"] .ai-disclaimer {
  opacity: 0.65;
  color: #374151;
}

/* Hide AI disclaimer on mobile (covered in Privacy Policy & Terms of Use) */
@media (max-width: 768px) {
  .ai-disclaimer { display: none !important; }
}

/* === NEW ABOUT & FOUNDER STYLES === */

.hero-subtitle {
  font-size: 20px;
  opacity: 0.85;
  margin-bottom: 12px;
  text-align: center;
}

.hero-cta {
  display: inline-block;
  margin-top: 22px;
  padding: 12px 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  text-align: center;
  transition: 0.25s ease;
}

.hero-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.5);
}

.section h2 {
  font-size: 28px;
  margin-bottom: 14px;
}

.section p,
.section li {
  font-size: 17px;
  color: #d1d5db;
  margin-bottom: 8px;
}

.founder-section {
  text-align: center;
  max-width: 850px;
  margin: auto;
  padding-top: 40px;
}

strong {
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
}

body[data-theme="light"] strong {
  background: rgba(0, 0, 0, 0.1);
}

/* ===================== RESPONSIVE (MOBILE) ===================== */

@media (max-width: 768px) {
  .navbar {
    padding: 10px 12px;
  }

  .page-main {
    padding-top: 49px;   /* Mobile navbar height including border */
  }

  .ai-controls {
    top: 51px;              /* mobile navbar + small gap for border visibility */
    padding: 8px;
    gap: 6px;
    border-radius: 14px;
    margin: 0 8px;
    left: 0;
    right: 0;
    width: auto;
  }

  .ai-control {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    gap: 2px;
  }

  .ai-control label {
    line-height: 1.1;    /* font-size fixed at 0.65rem !important by pages.css regardless of width */
  }

  .ai-control select,
  .ai-control input {
    height: 33px;
    font-size: 0.78rem;
    padding: 0 11px;
  }

  /* Custom dropdown mobile adjustments */
  .custom-dropdown-trigger {
    height: 33px;
    font-size: 0.78rem;
    padding: 0 11px;
  }

  /* Smaller top padding but still clears navbar + controls */
  .free-chat-window {
    padding: 112px 8px 200px;
  }

  .free-input-wrapper {
    bottom: 12px;
    padding: 0 8px;
  }

  .free-input-bar {
    margin: 0;
    padding: 8px 12px;
    border-radius: 24px;
  }

  .free-input-bar textarea {
    font-size: 0.9rem;
    min-height: 36px;
  }
}

/* ===================== REDUCED MOTION — mandatory ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:        0.01ms !important;
    animation-iteration-count: 1      !important;
    transition-duration:       0.01ms !important;
  }
}
