/* === HOMEPAGE ADDITIONS ONLY === */

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

/* Lists look clean & readable */
.section ul {
  margin-top: 12px;
  padding-left: 18px;
}

.section li {
  margin-bottom: 8px;
}

/* Emphasis without color change */
strong {
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
}

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

/* === FORCE BLACK TEXT IN LIGHT THEME (HOMEPAGE) === */
body[data-theme="light"] .section p,
body[data-theme="light"] .section li,
body[data-theme="light"] .section h2,
body[data-theme="light"] .hero-subtitle {
  color: #000000;
}

body[data-theme="dark"] .section p,
body[data-theme="dark"] .section li,
body[data-theme="dark"] .section h2,
body[data-theme="dark"] .hero-subtitle {
  color: #ffffff;
}


/* Lists look clean & readable */
.section ul {
  margin-top: 12px;
  padding-left: 18px;
}

.section li {
  margin-bottom: 8px;
}

/* Emphasis without color change */
strong {
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
}

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

/* === FORCE BLACK TEXT IN LIGHT THEME (HOMEPAGE) === */
body[data-theme="light"] .section p,
body[data-theme="light"] .section li,
body[data-theme="light"] .section h2,
body[data-theme="light"] .hero-subtitle {
  color: #000000;
}

body[data-theme="dark"] .section p,
body[data-theme="dark"] .section li,
body[data-theme="dark"] .section h2,
body[data-theme="dark"] .hero-subtitle {
  color: #ffffff;
}


.auth-message {
  margin-top: 10px;
  text-align: center;
  font-size: 0.9rem;
}

.auth-message.error {
  color: #ef4444;
}

.auth-message.success {
  color: #22c55e;
}

.auth-message.info {
  color: #60a5fa;
}
/* ===============================
   AUTH MESSAGE (LOGIN / SIGNUP)
   =============================== */

.auth-message {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
}

/* Success */
.auth-message.success {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

/* Error */
.auth-message.error {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Hidden by default */
.auth-message.hidden {
  display: none;
}


/* ===================== MODEL SELECTOR ===================== */

.model-selector {
  position: relative;
  display: flex;
  align-items: center;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.12s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

body[data-theme="light"] .icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Dropdown */

.model-dropdown {
  position: fixed;
  min-width: 220px;
  border-radius: 12px;
  overflow: hidden;
  display: none;
  z-index: 9999;
  pointer-events: auto;
  border: 1px solid #374151;
  background: #020617;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
}

.model-dropdown div {
  padding: 10px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.model-dropdown div:hover {
  background: #1f2937;
}

/* Light theme */

body[data-theme="light"] .model-dropdown {
  background: #ffffff;
  border-color: #d1d5db;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
}

body[data-theme="light"] .model-dropdown div:hover {
  background: #f3f4f6;
}

.profile-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px 60px;
}

.profile-card {
  max-width: 520px;
  width: 100%;
  border-radius: 20px;
  padding: 28px 22px;
  border: 1px solid #1f2933;
  background: #1c1f26;
  box-shadow: 0 16px 40px rgba(0,0,0,0.8);
}

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

.profile-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: #111827;
}

.profile-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 22px;
}

.profile-stats div {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
}

.profile-stats strong {
  font-size: 1.2rem;
}

.profile-section-title {
  font-size: 1rem;
  margin-bottom: 12px;
}

.gemini-loader {
  display: flex;
  gap: 6px;
  padding: 8px 0;
}

.gemini-loader span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #888;
  animation: bounce 1.4s infinite ease-in-out;
}

.gemini-loader span:nth-child(2) {
  animation-delay: 0.2s;
}
.gemini-loader span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===================================================================
   DASHBOARD — VOICE INPUT & GEMINI-STYLE UPLOAD  (dashboard only)
   =================================================================== */

/* ── Redesigned input bar: pill shape preserved, content stacks ── */
.free-input-bar {
  /* Override the single-row flex to allow vertical stacking */
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0 !important;
  border-radius: 24px !important;  /* rounder for Gemini feel */
  padding: 0 !important;
  overflow: hidden;
}

/* ── Chip strip (file previews) — lives inside the pill ── */
.upload-chips-row {
  display: none;                /* hidden until files attached */
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.upload-chips-row.has-files {
  display: flex;
  border-bottom-color: #1f2933;
}

body[data-theme="light"] .upload-chips-row.has-files {
  border-bottom-color: #e5e7eb;
}

/* ── Individual chip ── */
.upload-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  max-width: 220px;
  cursor: default;
  transition: background 0.15s;
  position: relative;
}

body[data-theme="dark"]  .upload-chip {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e5e7eb;
}

body[data-theme="light"] .upload-chip {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
  color: #111827;
}

body[data-theme="dark"]  .upload-chip:hover { background: rgba(255,255,255,0.11); }
body[data-theme="light"] .upload-chip:hover { background: rgba(0,0,0,0.07); }

/* Image thumbnail inside chip */
.chip-thumb {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

/* File icon for non-images */
.chip-file-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

body[data-theme="dark"]  .chip-file-icon { background: rgba(255,255,255,0.08); }
body[data-theme="light"] .chip-file-icon { background: rgba(0,0,0,0.06); }

/* Chip text */
.chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
  line-height: 1.2;
}

.chip-size {
  font-size: 0.66rem;
  opacity: 0.55;
  white-space: nowrap;
}

.chip-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Remove (×) button */
.chip-remove {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.15s;
  opacity: 0.5;
  background: transparent;
  color: inherit;
  padding: 0;
}

.chip-remove:hover {
  opacity: 1;
  background: rgba(239,68,68,0.18);
  color: #ef4444;
}

/* ── Bottom row: textarea + icon buttons ── */
.input-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 10px 8px 14px;
}

.input-toolbar textarea {
  flex: 1;
  border: none;
  resize: none;
  min-height: 40px;
  max-height: 160px;
  padding: 8px 4px;
  font-size: 0.95rem;
  background: transparent;
  outline: none;
  overflow-y: auto;
  line-height: 1.5;
  align-self: flex-end;
}

body[data-theme="dark"]  .input-toolbar textarea { color: #e5e7eb; }
body[data-theme="light"] .input-toolbar textarea { color: #111827; }
.input-toolbar textarea::placeholder { color: #9ca3af; }

/* ── Toolbar icon buttons ── */
.tb-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.12s;
  color: inherit;
  position: relative;
}

body[data-theme="dark"]  .tb-btn { color: #9ca3af; }
body[data-theme="light"] .tb-btn { color: #6b7280; }

body[data-theme="dark"]  .tb-btn:hover { background: rgba(255,255,255,0.08); color: #e5e7eb; transform: scale(1.08); }
body[data-theme="light"] .tb-btn:hover { background: rgba(0,0,0,0.06);       color: #111827; transform: scale(1.08); }

/* Voice recording active state */
@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0    rgba(239,68,68,0.5); }
  70%  { box-shadow: 0 0 0 8px  rgba(239,68,68,0);   }
  100% { box-shadow: 0 0 0 0    rgba(239,68,68,0);   }
}

.tb-btn#voiceBtn.recording,
.tb-icon-btn#voiceBtn.recording {
  color: #ef4444 !important;
  background: rgba(239,68,68,0.12) !important;
  animation: mic-pulse 1.1s infinite;
}

/* Send button — keep existing green style, just override size for toolbar */
.tb-send {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  background: #10b981 !important;
  color: #020617 !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  transition: transform 0.12s ease, box-shadow 0.18s ease !important;
}

.tb-send:hover   { transform: scale(1.08) !important; box-shadow: 0 6px 18px rgba(16,185,129,0.4) !important; }
.tb-send:active  { transform: scale(0.96) !important; box-shadow: none !important; }
.tb-send:disabled { background: #4b5563 !important; cursor: not-allowed !important; box-shadow: none !important; }

/* ── Image grid inside chat bubbles ── */
.chat-img-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.chat-img-grid img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.08);
}

body[data-theme="light"] .chat-img-grid img {
  border-color: rgba(0,0,0,0.08);
}

/* Mobile */
@media (max-width: 768px) {
  .free-input-bar {
    border-radius: 18px !important;
  }
  .input-toolbar {
    padding: 6px 8px 6px 12px;
  }
}


/* ===================== IMAGE GENERATION LOADER ===================== */

@keyframes imgShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes imgDotPulse {
  from { opacity: 0.3; transform: scale(0.8); }
  to   { opacity: 1;   transform: scale(1.1); }
}

/* ── Image generation denial card ── */
@keyframes imgDenyShake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-7px); }
  30%  { transform: translateX(7px); }
  45%  { transform: translateX(-4px); }
  60%  { transform: translateX(4px); }
  75%  { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}
@keyframes imgDenyFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes imgDenyChipIn {
  from { opacity: 0; transform: translateY(6px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}
.img-deny-card {
  animation: imgDenyFadeUp 0.28s ease, imgDenyShake 0.55s ease 0.1s;
  border-radius: 12px;
  padding: 14px 16px;
  max-width: 100%;
  transform-origin: center;
}
body[data-theme="dark"]  .img-deny-card {
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.22);
}
body[data-theme="light"] .img-deny-card {
  background: rgba(239,68,68,0.05);
  border: 1px solid rgba(239,68,68,0.18);
}
.img-deny-header {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.img-deny-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.img-deny-msg {
  font-size: 0.875rem;
  line-height: 1.5;
}
body[data-theme="dark"]  .img-deny-msg { color: #e5e7eb; }
body[data-theme="light"] .img-deny-msg { color: #1f2937; }
.img-deny-examples {
  margin-top: 12px;
}
.img-deny-examples-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 7px;
}
body[data-theme="dark"]  .img-deny-examples-label { color: #6b7280; }
body[data-theme="light"] .img-deny-examples-label { color: #9ca3af; }
.img-deny-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.img-deny-chip {
  font-size: 0.8rem;
  padding: 7px 11px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  animation: imgDenyChipIn 0.22s ease forwards;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.4;
}
body[data-theme="dark"]  .img-deny-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #9ca3af;
}
body[data-theme="light"] .img-deny-chip {
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.08);
  color: #4b5563;
}
body[data-theme="dark"]  .img-deny-chip:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.14);
  color: #e5e7eb;
}
body[data-theme="light"] .img-deny-chip:hover {
  background: rgba(0,0,0,0.07);
  border-color: rgba(0,0,0,0.13);
  color: #111827;
}
.img-deny-hint {
  font-size: 0.76rem;
  font-style: italic;
  margin-top: 10px;
  opacity: 0.45;
}

/* ===================== LIGHTBOX ===================== */
@keyframes lbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}



/* ═══════════════════════════════════════════════════
   INPUT BAR — GEMINI-STYLE MULTI-ROW
═══════════════════════════════════════════════════ */

/* Override the default single-row flex to column */
.free-input-bar {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0 !important;
  padding: 10px 14px 8px !important;
  border-radius: 24px !important;
}

/* Textarea row — full width, no extra padding */
.input-textarea-row {
  display: flex;
  align-items: flex-end;
  padding: 0 2px;
}

.input-textarea-row textarea {
  flex: 1;
  border: none;
  resize: none;
  min-height: 36px;
  max-height: 160px;
  padding: 4px 0;
  font-size: 0.97rem;
  background: transparent;
  outline: none;
  overflow-y: auto;
  line-height: 1.5;
}

body[data-theme="dark"]  .input-textarea-row textarea { color: #e5e7eb; }
body[data-theme="light"] .input-textarea-row textarea { color: #111827; }
.input-textarea-row textarea::placeholder { color: #9ca3af; }

/* Bottom bar: model chip LEFT, actions RIGHT */
.input-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

/* ── Left slot (upload button) ── */
.input-left-slot {
  display: flex;
  align-items: center;
}

/* Gemini-style FLAT model selector button — no background, no border, just text */
.model-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s;
  line-height: 1;
}
body[data-theme="dark"]  .model-chip-btn { color: #9ca3af; }
body[data-theme="light"] .model-chip-btn { color: #6b7280; }
body[data-theme="dark"]  .model-chip-btn:hover,
body[data-theme="dark"]  .model-chip-btn.open  { background: rgba(255,255,255,0.07); color: #e5e7eb; }
body[data-theme="light"] .model-chip-btn:hover,
body[data-theme="light"] .model-chip-btn.open  { background: rgba(0,0,0,0.06); color: #111827; }

.model-chip-icon { font-size: 0.95rem; line-height: 1; }

.model-chip-chevron {
  opacity: 0.55;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.model-chip-btn.open .model-chip-chevron { transform: rotate(180deg); }

/* ── Dropdown panel — position:fixed, JS places it above the button ── */
.model-dropdown-panel {
  position: fixed;
  min-width: 230px;
  border-radius: 12px;
  padding: 6px;
  z-index: 99999;
  /* hidden by default */
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
body[data-theme="dark"]  .model-dropdown-panel {
  background: #1c2130;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
}
body[data-theme="light"] .model-dropdown-panel {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
}
/* Open state */
.model-dropdown-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header label */
.mdp-header {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px 6px;
}
body[data-theme="dark"]  .mdp-header { color: rgba(229,231,235,0.35); }
body[data-theme="light"] .mdp-header { color: rgba(17,24,39,0.35); }

/* Option row */
.mdp-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
body[data-theme="dark"]  .mdp-option:hover { background: rgba(255,255,255,0.07); }
body[data-theme="light"] .mdp-option:hover { background: rgba(0,0,0,0.05); }
.mdp-option.active {
  background: rgba(16,185,129,0.1);
}

.mdp-icon { font-size: 1.1rem; width: 26px; text-align: center; flex-shrink: 0; }

.mdp-info { flex: 1; min-width: 0; }

.mdp-name {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
}
body[data-theme="dark"]  .mdp-name { color: #f3f4f6; }
body[data-theme="light"] .mdp-name { color: #111827; }

.mdp-desc {
  font-size: 0.71rem;
  margin-top: 2px;
  opacity: 0.45;
  line-height: 1.3;
}
body[data-theme="dark"]  .mdp-desc { color: #d1d5db; }
body[data-theme="light"] .mdp-desc { color: #374151; }

.mdp-check {
  font-size: 0.85rem;
  color: #10b981;
  font-weight: 700;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Actions slot (right) ── */
.input-actions-slot {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Icon buttons (upload, voice) */
.tb-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.12s;
  flex-shrink: 0;
}
body[data-theme="dark"]  .tb-icon-btn { background: rgba(255,255,255,0.07); color: #9ca3af; }
body[data-theme="light"] .tb-icon-btn { background: rgba(0,0,0,0.05);       color: #6b7280; }
body[data-theme="dark"]  .tb-icon-btn:hover { background: rgba(255,255,255,0.14); color: #e5e7eb; transform: scale(1.08); }
body[data-theme="light"] .tb-icon-btn:hover { background: rgba(0,0,0,0.1);        color: #111827; transform: scale(1.08); }
.tb-icon-btn.recording { background: rgba(239,68,68,0.2) !important; color: #ef4444 !important; }

/* ── SSE word fade-in animation ── */
@keyframes wordFadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stream-word {
  display: inline;
  animation: wordFadeIn 0.22s ease forwards;
}

/* ── AI answer highlights  (*text* in responses) ── */
mark.ai-highlight {
  background: none;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
body[data-theme="dark"]  mark.ai-highlight {
  color: #86efac;                        /* green-300 — softer than the old #34d399 */
  background: rgba(16,185,129,0.08);
  box-shadow: inset 0 0 0 1px rgba(16,185,129,0.14);
}
body[data-theme="light"] mark.ai-highlight {
  color: #2563eb;                        /* blue-600 — a touch lighter than the old blue-700 */
  background: rgba(59,130,246,0.06);     /* fainter blue wash */
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.14);
}

/* ═══════════════════════════════════════════════════════════════
   KATEX MATH RENDERING
═══════════════════════════════════════════════════════════════ */
.katex { font-size: 1.05em; color: inherit; }
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 8px;
  margin: 0.6em 0;
}
.katex-fallback {
  font-family: inherit;
  opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE PANEL — works on every page
═══════════════════════════════════════════════════════════════ */

/* ── Overlay ── */
.profile-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0);
  transition: background 0.28s ease;
  display: block;
  pointer-events: none;
}
.profile-overlay.open {
  background: rgba(0,0,0,0.35);
  pointer-events: auto;
}

/* ── Panel ── */
.profile-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 320px; max-width: 92vw;
  z-index: 9001;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s ease;
  overflow-y: auto;
  will-change: transform;
}
body[data-theme="dark"]  .profile-panel { background: #0d1219; border-left: 1px solid rgba(255,255,255,0.08); }
body[data-theme="light"] .profile-panel { background: #f4f6f9; border-left: 1px solid rgba(15,23,42,0.09); }
.profile-panel.open {
  transform: translateX(0);
  box-shadow: -8px 0 40px rgba(0,0,0,0.28);
}

/* ── Header ── */
.pp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid;
  flex-shrink: 0;
}
body[data-theme="dark"]  .pp-header { border-color: rgba(255,255,255,0.08); }
body[data-theme="light"] .pp-header { border-color: rgba(15,23,42,0.08); background: #ffffff; }
.pp-header h2 { font-size: 0.95rem; font-weight: 800; letter-spacing: -0.01em; }
.pp-close {
  width: 30px; height: 30px; border: none; border-radius: 8px;
  background: transparent; cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: 1.1rem;
  opacity: 0.45; transition: opacity 0.15s, background 0.15s;
}
.pp-close:hover { opacity: 1; background: rgba(128,128,128,0.1); }
body[data-theme="dark"]  .pp-close { color: #e5e7eb; }
body[data-theme="light"] .pp-close { color: #111827; }

/* ── Logged-out state ── */
.pp-loggedout {
  display: flex; flex-direction: column; align-items: center;
  padding: 52px 24px 36px; text-align: center; gap: 10px; flex: 1;
}
.pp-lo-icon { font-size: 3rem; opacity: 0.25; }
.pp-lo-title { font-size: 1rem; font-weight: 700; margin-top: 4px; }
.pp-lo-sub { font-size: 0.83rem; opacity: 0.45; line-height: 1.55; max-width: 220px; }
.pp-lo-btn {
  display: block; width: 100%; max-width: 220px;
  padding: 11px; border-radius: 999px; text-align: center;
  font-size: 0.9rem; font-weight: 600; text-decoration: none;
  margin-top: 6px; transition: opacity 0.15s, transform 0.12s;
  background: #10b981; color: #020617; border: none;
}
.pp-lo-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.pp-lo-btn-ghost {
  background: transparent !important;
  border: 1px solid rgba(128,128,128,0.3) !important;
  margin-top: 0 !important;
}
body[data-theme="dark"]  .pp-lo-btn-ghost { color: #e5e7eb; }
body[data-theme="light"] .pp-lo-btn-ghost { color: #111827; }

/* ── Identity block ── */
.pp-identity {
  display: flex; flex-direction: column; align-items: center;
  padding: 26px 20px 18px; text-align: center; gap: 6px;
}

/* Avatar wrapper with edit button */
.pp-avatar-wrap {
  position: relative;
  width: 72px; height: 72px;
  flex-shrink: 0;
}
.pp-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; font-weight: 800;
  background: linear-gradient(140deg, #34d399, #047857);
  color: #fff;
  box-shadow: 0 6px 22px -8px rgba(16,185,129,0.7);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.pp-avatar-wrap:hover .pp-avatar {
  box-shadow: 0 8px 26px -8px rgba(16,185,129,0.85);
}
.pp-avatar-edit {
  position: absolute; bottom: 0; right: 0;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: 2px solid;
  transition: transform 0.15s;
}
body[data-theme="dark"]  .pp-avatar-edit { background: #1f2937; border-color: #374151; color: #e5e7eb; }
body[data-theme="light"] .pp-avatar-edit { background: #ffffff; border-color: #d1d5db; color: #374151; }
.pp-avatar-edit:hover { transform: scale(1.15); }

/* Remove photo button — top-left corner, only visible when photo exists */
.pp-avatar-remove {
  position: absolute; top: 0; left: 0;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 2px solid;
  transition: transform 0.15s, background 0.15s;
  z-index: 2;
}
body[data-theme="dark"]  .pp-avatar-remove { background: #dc2626; border-color: #991b1b; color: #fff; }
body[data-theme="light"] .pp-avatar-remove { background: #ef4444; border-color: #dc2626; color: #fff; }
.pp-avatar-remove:hover { transform: scale(1.18); }

.pp-name  { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.pp-email { font-size: 0.78rem; opacity: 0.45; margin-top: -2px; }
.pp-badge {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 4px;
  padding: 5px 11px; border-radius: 999px; font-size: 0.73rem; font-weight: 700;
  background: rgba(16,185,129,0.13); color: #10b981;
}
body[data-theme="light"] .pp-badge { color: #047857; }

/* ── Stats grid ── */
.pp-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; padding: 0 14px 16px;
}
.pp-stat-card {
  border-radius: 14px; padding: 13px 12px 11px;
  display: flex; flex-direction: column; gap: 3px;
  transition: transform 0.15s, box-shadow 0.2s;
}
.pp-stat-card:hover { transform: translateY(-2px); }
body[data-theme="dark"]  .pp-stat-card { background: #11161e; border: 1px solid rgba(255,255,255,0.07); box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px -12px rgba(0,0,0,.8); }
body[data-theme="light"] .pp-stat-card { background: #ffffff; border: 1px solid rgba(15,23,42,0.07); box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px -10px rgba(15,23,42,.2); }
.pp-stat-icon {
  font-size: 1rem; line-height: 1;
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}
/* streak = orange, time = blue, questions = violet, joined = pink */
.pp-stat-card:nth-child(1) .pp-stat-icon { color:#f59e0b; background:rgba(245,158,11,.15); }
.pp-stat-card:nth-child(2) .pp-stat-icon { color:#3b82f6; background:rgba(59,130,246,.13); }
.pp-stat-card:nth-child(3) .pp-stat-icon { color:#8b5cf6; background:rgba(139,92,246,.14); }
.pp-stat-card:nth-child(4) .pp-stat-icon { color:#ec4899; background:rgba(236,72,153,.13); }
.pp-token-card .pp-stat-icon { color:#10b981; background:rgba(16,185,129,.13); }
.pp-stat-value { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.pp-stat-label { font-size: 0.68rem; opacity: 0.5; font-weight: 600; letter-spacing: 0.02em; }
.streak-active .pp-stat-value { color: #f59e0b; }
.pp-freeze-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 9px;
  border-radius: 20px;
  background: #1cb0f6;
  color: #fff;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ── Token usage bar card ── */
.pp-token-card {
  grid-column: 1 / -1; /* spans full width */
  gap: 6px !important;
}
.pp-token-header {
  display: flex; justify-content: space-between; align-items: center;
}
.pp-token-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; opacity: 0.5;
}
.pp-token-label {
  font-size: 0.78rem; font-weight: 700;
}
.pp-token-track {
  height: 7px; border-radius: 99px; overflow: hidden;
  background: rgba(0,0,0,0.08);
}
body[data-theme="dark"] .pp-token-track { background: rgba(255,255,255,0.1); }
.pp-token-bar {
  height: 100%; width: 0%; border-radius: 99px;
  background: #10b981;
  transition: width 0.6s ease, background 0.3s;
}
.pp-token-sub {
  font-size: 0.72rem; opacity: 0.45;
}

@keyframes flamePulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.18)} }
.streak-flame { display:inline-block; animation: flamePulse 1.5s ease-in-out infinite; }
.pp-stat-card.freeze-on .streak-flame { filter: hue-rotate(170deg) saturate(1.8) brightness(1.15); animation: flamePulse 2s ease-in-out infinite; }

/* ── Bio section ── */
.pp-bio-section { padding: 0 14px 14px; }
.pp-bio-text {
  font-size: 0.83rem; line-height: 1.6; opacity: 0.7;
  padding: 11px 14px; border-radius: 12px; font-style: italic;
}
body[data-theme="dark"]  .pp-bio-text { background: #11161e; border: 1px solid rgba(255,255,255,.07); }
body[data-theme="light"] .pp-bio-text { background: #ffffff;  border: 1px solid rgba(15,23,42,.07); }

/* ── Info rows ── */
.pp-info-section {
  padding: 0 14px 14px; display: flex; flex-direction: column; gap: 0;
  border-radius: 16px; overflow: visible;
}
/* Use a pseudo-wrapper via the section itself acting as the card container.
   We apply the card look to the whole section with overflow:hidden + border. */
.pp-info-section::before {
  content: none;
}
/* Style the info section as a card */
.pp-info-section > .pp-info-row:first-child { border-radius: 14px 14px 0 0; }
.pp-info-section > .pp-info-row:last-child  { border-radius: 0 0 14px 14px; }
.pp-info-section > .pp-info-row:only-child  { border-radius: 14px; }
body[data-theme="dark"]  .pp-info-row { background: #11161e; border: 1px solid rgba(255,255,255,.07); border-bottom: none; }
body[data-theme="light"] .pp-info-row { background: #ffffff;  border: 1px solid rgba(15,23,42,.07); border-bottom: none; box-shadow: none; }
body[data-theme="dark"]  .pp-info-row:last-child { border-bottom: 1px solid rgba(255,255,255,.07); }
body[data-theme="light"] .pp-info-row:last-child { border-bottom: 1px solid rgba(15,23,42,.07); }
.pp-info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; gap: 10px; transition: background 0.15s;
}
body[data-theme="dark"]  .pp-info-row:hover { background: rgba(16,185,129,.07); }
body[data-theme="light"] .pp-info-row:hover { background: rgba(16,185,129,.06); }
.pp-info-left { display: flex; align-items: center; gap: 10px; }
.pp-info-icon {
  font-size: 0.9rem; width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
body[data-theme="dark"]  .pp-info-icon { background: rgba(255,255,255,.07); }
body[data-theme="light"] .pp-info-icon { background: rgba(15,23,42,.06); }
.pp-info-label { font-size: 0.81rem; font-weight: 600; opacity: 0.55; }
.pp-info-value { font-size: 0.85rem; font-weight: 700; }

/* ── Divider ── */
.pp-divider { height: 1px; margin: 2px 14px 14px; }
body[data-theme="dark"]  .pp-divider { background: rgba(255,255,255,0.06); }
body[data-theme="light"] .pp-divider { background: rgba(0,0,0,0.06); }

/* ── Edit form ── */
.pp-edit-section { padding: 0 14px 14px; }
.pp-edit-title { font-size: 0.69rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.28; margin-bottom: 10px; }
.pp-edit-form { display: flex; flex-direction: column; gap: 10px; }
.pp-edit-field { display: flex; flex-direction: column; gap: 4px; }
.pp-edit-field label { font-size: 0.71rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.38; }
.pp-edit-field input,
.pp-edit-field select,
.pp-edit-field textarea {
  padding: 8px 11px; border-radius: 9px; font-size: 0.86rem;
  font-family: inherit; outline: none; transition: border-color 0.15s; width: 100%;
  resize: none;
}
body[data-theme="dark"]  .pp-edit-field input,
body[data-theme="dark"]  .pp-edit-field select,
body[data-theme="dark"]  .pp-edit-field textarea { background: #05080b; border: 1px solid rgba(255,255,255,0.1); color: #e5e7eb; }
body[data-theme="light"] .pp-edit-field input,
body[data-theme="light"] .pp-edit-field select,
body[data-theme="light"] .pp-edit-field textarea { background: #ffffff; border: 1px solid rgba(0,0,0,0.1); color: #111827; }
body[data-theme="dark"]  .pp-edit-field input:focus,
body[data-theme="dark"]  .pp-edit-field select:focus,
body[data-theme="dark"]  .pp-edit-field textarea:focus { border-color: rgba(255,255,255,0.25); }
body[data-theme="light"] .pp-edit-field input:focus,
body[data-theme="light"] .pp-edit-field select:focus,
body[data-theme="light"] .pp-edit-field textarea:focus { border-color: rgba(0,0,0,0.25); }
.pp-edit-hint { font-size: 0.68rem; opacity: 0.3; margin-top: 1px; }
.pp-edit-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pp-save-btn {
  padding: 11px; border-radius: 12px; border: none;
  font-size: 0.87rem; font-weight: 700; font-family: inherit;
  cursor: pointer; color: #fff;
  background: linear-gradient(140deg, #10b981, #047857);
  transition: filter 0.15s, transform 0.12s, box-shadow 0.2s; margin-top: 4px;
}
.pp-save-btn:hover  { filter: brightness(1.06); box-shadow: 0 8px 20px -10px rgba(16,185,129,.7); transform: translateY(-1px); }
.pp-save-btn:active { transform: translateY(0); box-shadow: none; }
.pp-save-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }
.pp-save-msg { font-size: 0.76rem; text-align: center; min-height: 16px; margin-top: 2px; }

/* ── Inline Edit Buttons for Info Rows ── */
.pp-info-row {
  position: relative;
}
.pp-inline-edit-btn {
  width: 26px; height: 26px; border-radius: 6px;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.4; transition: opacity 0.15s, background 0.15s, transform 0.1s;
  flex-shrink: 0; margin-left: 8px;
}
body[data-theme="dark"] .pp-inline-edit-btn {
  background: rgba(255,255,255,0.08); color: #e5e7eb;
}
body[data-theme="light"] .pp-inline-edit-btn {
  background: rgba(0,0,0,0.06); color: #374151;
}
.pp-inline-edit-btn:hover, .pp-inline-edit-btn:active {
  opacity: 1;
  transform: scale(1.08);
}
body[data-theme="dark"] .pp-inline-edit-btn:hover,
body[data-theme="dark"] .pp-inline-edit-btn:active {
  background: rgba(16,185,129,0.2); color: #10b981;
}
body[data-theme="light"] .pp-inline-edit-btn:hover,
body[data-theme="light"] .pp-inline-edit-btn:active {
  background: rgba(29,78,216,0.12); color: #1d4ed8;
}

/* Inline edit input inside info row */
.pp-inline-input {
  flex: 1; padding: 6px 10px; border-radius: 6px;
  font-size: 0.85rem; font-family: inherit; outline: none;
  min-width: 0; max-width: 140px;
}
body[data-theme="dark"] .pp-inline-input {
  background: #05080b; border: 1px solid rgba(255,255,255,0.15); color: #e5e7eb;
}
body[data-theme="light"] .pp-inline-input {
  background: #ffffff; border: 1px solid rgba(0,0,0,0.15); color: #111827;
}
body[data-theme="dark"] .pp-inline-input:focus {
  border-color: rgba(16,185,129,0.5);
}
body[data-theme="light"] .pp-inline-input:focus {
  border-color: rgba(29,78,216,0.5);
}

.pp-inline-select {
  padding: 6px 10px; border-radius: 6px;
  font-size: 0.85rem; font-family: inherit; outline: none;
  cursor: pointer;
}
body[data-theme="dark"] .pp-inline-select {
  background: #05080b; border: 1px solid rgba(255,255,255,0.15); color: #e5e7eb;
}
body[data-theme="light"] .pp-inline-select {
  background: #ffffff; border: 1px solid rgba(0,0,0,0.15); color: #111827;
}

.pp-inline-save-btn, .pp-inline-cancel-btn {
  width: 26px; height: 26px; border-radius: 6px;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.pp-inline-save-btn {
  background: rgba(16,185,129,0.15); color: #10b981;
}
.pp-inline-save-btn:hover, .pp-inline-save-btn:active {
  background: rgba(16,185,129,0.25); transform: scale(1.05);
}
.pp-inline-cancel-btn {
  background: rgba(239,68,68,0.12); color: #f87171;
}
.pp-inline-cancel-btn:hover, .pp-inline-cancel-btn:active {
  background: rgba(239,68,68,0.2); transform: scale(1.05);
}

.pp-info-actions {
  display: flex; align-items: center; gap: 4px; margin-left: 8px;
}

/* Bio inline edit */
.pp-bio-section {
  position: relative;
}
.pp-bio-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.pp-bio-label {
  font-size: 0.69rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; opacity: 0.28;
}
.pp-bio-edit-btn {
  width: 24px; height: 24px; border-radius: 6px;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.5; transition: opacity 0.15s, background 0.15s;
}
body[data-theme="dark"] .pp-bio-edit-btn {
  background: rgba(255,255,255,0.06); color: #e5e7eb;
}
body[data-theme="light"] .pp-bio-edit-btn {
  background: rgba(0,0,0,0.04); color: #374151;
}
.pp-bio-edit-btn:hover, .pp-bio-edit-btn:active {
  opacity: 1;
  background: rgba(16,185,129,0.15); color: #10b981;
}

.pp-bio-edit-area {
  display: none; flex-direction: column; gap: 8px;
}
.pp-bio-edit-area.active {
  display: flex;
}
.pp-bio-textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  font-size: 0.83rem; font-family: inherit; outline: none;
  resize: none; line-height: 1.5;
}
body[data-theme="dark"] .pp-bio-textarea {
  background: #05080b; border: 1px solid rgba(255,255,255,0.12); color: #e5e7eb;
}
body[data-theme="light"] .pp-bio-textarea {
  background: #ffffff; border: 1px solid rgba(0,0,0,0.12); color: #111827;
}
.pp-bio-edit-actions {
  display: flex; gap: 6px; justify-content: flex-end;
}
.pp-bio-save-btn, .pp-bio-cancel-btn {
  padding: 6px 14px; border-radius: 6px; border: none;
  font-size: 0.78rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background 0.15s;
}
.pp-bio-save-btn {
  background: #10b981; color: #020617;
}
.pp-bio-save-btn:hover, .pp-bio-save-btn:active { opacity: 0.9; }
.pp-bio-cancel-btn {
  background: rgba(128,128,128,0.15); color: inherit;
}
.pp-bio-cancel-btn:hover, .pp-bio-cancel-btn:active { background: rgba(128,128,128,0.25); }

/* Identity inline edit (name) */
.pp-name-wrap {
  display: flex; align-items: center; gap: 6px;
  justify-content: center;
}
.pp-name-edit-btn {
  width: 22px; height: 22px; border-radius: 5px;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.4; transition: opacity 0.15s, background 0.15s;
}
body[data-theme="dark"] .pp-name-edit-btn {
  background: rgba(255,255,255,0.08); color: #e5e7eb;
}
body[data-theme="light"] .pp-name-edit-btn {
  background: rgba(0,0,0,0.06); color: #374151;
}
.pp-name-edit-btn:hover, .pp-name-edit-btn:active {
  opacity: 1;
  background: rgba(16,185,129,0.2); color: #10b981;
}

.pp-name-edit-input {
  padding: 6px 12px; border-radius: 8px;
  font-size: 1rem; font-weight: 700; font-family: inherit;
  text-align: center; outline: none; max-width: 200px;
}
body[data-theme="dark"] .pp-name-edit-input {
  background: #05080b; border: 1px solid rgba(255,255,255,0.15); color: #e5e7eb;
}
body[data-theme="light"] .pp-name-edit-input {
  background: #ffffff; border: 1px solid rgba(0,0,0,0.15); color: #111827;
}

/* ── Bottom actions ── */
.pp-actions { padding: 4px 14px 28px; margin-top: auto; }
.pp-action-btn {
  width: 100%; padding: 11px; border-radius: 12px; border: 1px solid;
  font-size: 0.87rem; font-weight: 700; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, box-shadow 0.2s, transform 0.12s;
}
.pp-action-btn.logout {
  background: rgba(239,68,68,.09); border-color: rgba(239,68,68,.25); color: #ef4444;
}
.pp-action-btn.logout:hover {
  background: rgba(239,68,68,.16); border-color: rgba(239,68,68,.4);
  box-shadow: 0 8px 20px -10px rgba(239,68,68,.5);
}

/* ── Profile nav trigger button ── */
.profile-trigger {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700; cursor: pointer; flex-shrink: 0;
  border: 2px solid rgba(16,185,129,0.4);
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  color: #fff; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.profile-trigger:hover { transform: scale(1.08); border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }

/* ── Password field with eye inside — global utility ── */
.pw-field {
  display: flex; align-items: center;
  border-radius: 10px; border: 1px solid;
  transition: border-color 0.15s; overflow: hidden;
}
body[data-theme="dark"]  .pw-field { background: #05080b; border-color: rgba(255,255,255,0.1); }
body[data-theme="light"] .pw-field { background: #f9fafb; border-color: rgba(0,0,0,0.1); }
body[data-theme="dark"]  .pw-field:focus-within { border-color: rgba(255,255,255,0.28); }
body[data-theme="light"] .pw-field:focus-within { border-color: rgba(0,0,0,0.28); }
.pw-field input {
  flex: 1; border: none !important; background: transparent !important;
  padding: 11px 4px 11px 14px; outline: none;
  font-size: 0.9rem; font-family: inherit; min-width: 0;
}
body[data-theme="dark"]  .pw-field input { color: #e5e7eb; }
body[data-theme="light"] .pw-field input { color: #111827; }
.pw-field input::placeholder { opacity: 0.32; }
.pw-eye-btn {
  flex-shrink: 0; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: 0.38; transition: opacity 0.15s; padding: 0;
}
.pw-eye-btn:hover { opacity: 0.75; }

/* ══════════════════════════════════════════════════════════
   UPLOAD DROPDOWN
══════════════════════════════════════════════════════════ */
.upload-dropdown-panel {
  position: fixed;
  min-width: 260px;
  border-radius: 14px;
  padding: 6px;
  z-index: 99999;
  opacity: 0;
  transform: translateY(12px) scale(0.93);
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.34,1.4,0.64,1),
              transform 0.24s cubic-bezier(0.34,1.4,0.64,1);
}
body[data-theme="dark"]  .upload-dropdown-panel {
  background: #1c2130;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
}
body[data-theme="light"] .upload-dropdown-panel {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
}
.upload-dropdown-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.upload-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.18s cubic-bezier(0.22,1,0.36,1);
}
body[data-theme="dark"]  .upload-option:hover { background: rgba(255,255,255,0.07); transform: translateX(3px); }
body[data-theme="light"] .upload-option:hover { background: rgba(0,0,0,0.04); transform: translateX(3px); }

.upload-option-icon {
  flex-shrink: 0;
  opacity: 0.7;
}

.upload-option-text {
  flex: 1;
  min-width: 0;
}

.upload-option-title {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
}
body[data-theme="dark"]  .upload-option-title { color: #f3f4f6; }
body[data-theme="light"] .upload-option-title { color: #111827; }

.upload-option-desc {
  font-size: 0.72rem;
  margin-top: 2px;
  opacity: 0.45;
  line-height: 1.3;
}
body[data-theme="dark"]  .upload-option-desc { color: #d1d5db; }
body[data-theme="light"] .upload-option-desc { color: #374151; }

/* ══════════════════════════════════════════════════════════
   FORGOT PASSWORD MODAL
══════════════════════════════════════════════════════════ */
.forgot-pw-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.forgot-pw-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.forgot-pw-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  padding: 32px 28px;
}
body[data-theme="dark"]  .forgot-pw-card {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
body[data-theme="light"] .forgot-pw-card {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.forgot-pw-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.forgot-pw-desc {
  font-size: 0.88rem;
  opacity: 0.55;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ===================== STORYTELLING ANIMATIONS ===================== */

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

@keyframes storyFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes storyGlowPulse {
  0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;   transform: translateX(-50%) scale(1.08); }
}

@keyframes storyNavSlide {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hero entrance: staggered children */
.hero-animate > * {
  opacity: 0;
  animation: storyFadeInUp 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-animate .hero-eyebrow       { animation-delay: 0.05s; }
.hero-animate h1                  { animation-delay: 0.12s; }
.hero-animate .typewriter         { animation-delay: 0.22s; }
.hero-animate .hero-desc          { animation-delay: 0.3s; }
.hero-animate .hero-cta           { animation-delay: 0.4s; }
.hero-animate .hero-scroll-hint   { animation-delay: 0.5s; }
.hero-animate .subtext            { animation-delay: 0.26s; }
.hero-animate p:not(.hero-desc)   { animation-delay: 0.22s; }

/* Ambient glow breathing (add class to hero that has ::before) */
.hero-glow-breathe::before {
  animation: storyGlowPulse 6s ease-in-out infinite;
}

/* Navbar entrance */
.navbar.navbar-animate {
  animation: storyNavSlide 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Scroll-triggered reveal */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger value-cards when inside a scroll-reveal section */
.animate-on-scroll .value-card {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.animate-on-scroll.visible .value-card {
  opacity: 1;
  transform: translateY(0);
}
.animate-on-scroll.visible .value-card:nth-child(1) { transition-delay: 0s; }
.animate-on-scroll.visible .value-card:nth-child(2) { transition-delay: 0.05s; }
.animate-on-scroll.visible .value-card:nth-child(3) { transition-delay: 0.1s; }
.animate-on-scroll.visible .value-card:nth-child(4) { transition-delay: 0.15s; }
.animate-on-scroll.visible .value-card:nth-child(5) { transition-delay: 0.2s; }
.animate-on-scroll.visible .value-card:nth-child(6) { transition-delay: 0.25s; }

/* Card / panel entrance (login, signup, dashboard) */
.animate-card-in {
  opacity: 0;
  animation: storyFadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

/* Footer subtle fade */
.about-footer.animate-footer-in {
  opacity: 0;
  animation: storyFadeIn 0.8s ease 0.4s forwards;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .hero-animate > *,
  .navbar.navbar-animate,
  .animate-card-in,
  .about-footer.animate-footer-in {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
  .hero-glow-breathe::before {
    animation: none;
  }
  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }
  .animate-on-scroll .value-card {
    opacity: 1;
    transform: none;
  }
  .hero-orb {
    animation: none;
    opacity: 0.3;
  }
  .hero-cta::after,
  .cta-button::after {
    animation: none;
    opacity: 0;
  }
  .navbar-scrolled {
    box-shadow: none;
  }
  .chat-empty-state,
  .chat-empty-icon,
  .chat-empty-greeting,
  .chat-empty-title,
  .chat-empty-hint,
  .profile-panel.open .pp-stat-card,
  .session-indicator::before {
    animation: none;
  }
  .chat-empty-state.ready .chat-empty-greeting,
  .chat-empty-state.ready .chat-empty-icon,
  .chat-empty-state.ready .chat-empty-title,
  .chat-empty-state.ready .chat-empty-hint,
  .profile-panel.open .pp-stat-card,
  .session-indicator::before {
    animation: none;
  }
  .chat-empty-state.ready .chat-empty-greeting,
  .chat-empty-state.ready .chat-empty-title,
  .chat-empty-state.ready .chat-empty-icon { opacity: 1; transform: none; }
  .chat-empty-state.ready .chat-empty-hint { opacity: 0.45; transform: none; }
  .profile-panel .pp-stat-card { opacity: 1; }
  .message-bubble { animation: none; }
}

/* ════════════════════════════════════════════════════
   IMAGE MODE — model dropdown option + chip + loading
   ════════════════════════════════════════════════════ */

.mdp-divider {
  height: 1px;
  margin: 5px 8px;
}
body[data-theme="dark"]  .mdp-divider { background: rgba(255,255,255,0.08); }
body[data-theme="light"] .mdp-divider { background: rgba(0,0,0,0.08); }

.mdp-image-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  background: linear-gradient(to right, rgba(167,139,250,0.05), transparent);
}
body[data-theme="dark"]  .mdp-image-option:hover { background: linear-gradient(to right, rgba(167,139,250,0.14), rgba(167,139,250,0.04)); }
body[data-theme="light"] .mdp-image-option:hover { background: linear-gradient(to right, rgba(167,139,250,0.10), rgba(167,139,250,0.02)); }
.mdp-image-option.active { background: linear-gradient(to right, rgba(167,139,250,0.20), rgba(167,139,250,0.06)); }

/* Chip when image mode is active */
.model-chip-btn.image-mode { color: #a78bfa; }
body[data-theme="dark"]  .model-chip-btn.image-mode:hover,
body[data-theme="dark"]  .model-chip-btn.image-mode.open  { background: rgba(167,139,250,0.1); color: #c4b5fd; }
body[data-theme="light"] .model-chip-btn.image-mode:hover,
body[data-theme="light"] .model-chip-btn.image-mode.open  { background: rgba(167,139,250,0.08); color: #7c3aed; }

/* Loading state */
.img-gen-loading {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
  width: 100%;
}

.img-gen-canvas-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
}
body[data-theme="dark"]  .img-gen-canvas-preview { background: rgba(255,255,255,0.05); }
body[data-theme="light"] .img-gen-canvas-preview { background: rgba(0,0,0,0.05); }

.img-gen-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(167,139,250,0.18) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: imgGenShimmer 1.7s ease-in-out infinite;
}
@keyframes imgGenShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.img-gen-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
}
.img-gen-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a78bfa;
  animation: imgGenDotBounce 1.2s ease-in-out infinite;
}
.img-gen-dots span:nth-child(2) { animation-delay: 0.15s; }
.img-gen-dots span:nth-child(3) { animation-delay: 0.30s; }
@keyframes imgGenDotBounce {
  0%, 80%, 100% { transform: translateY(0);    opacity: 0.35; }
  40%            { transform: translateY(-6px); opacity: 1;    }
}

.img-gen-status-text {
  font-size: 0.77rem;
  font-weight: 500;
  text-align: center;
  opacity: 0.45;
}

/* Result */
.img-gen-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.img-gen-output {
  display: block;
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 14px;
  cursor: zoom-in;
  transition: opacity 0.2s;
}
body[data-theme="dark"]  .img-gen-output { border: 1px solid rgba(255,255,255,0.08); }
body[data-theme="light"] .img-gen-output { border: 1px solid rgba(0,0,0,0.08); }
.img-gen-output:hover { opacity: 0.92; }

.img-gen-caption {
  font-size: 0.73rem;
  line-height: 1.4;
  opacity: 0.4;
}

/* ════════════════════════════════════════════════════
   STUDENT DASHBOARD — EMPTY STATE POLISH
   ════════════════════════════════════════════════════ */

/* Empty state logo */
.chat-empty-icon {
  font-size: 0;
  line-height: 0;
}
.es-logo {
  height: 168px;
  width: auto;
  display: block;
  margin: -42px 0;
}
body[data-theme="dark"]  .es-logo--light { display: none; }
body[data-theme="light"] .es-logo--dark  { display: none; }

/* Suggestion chips */
.es-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 320px;
  margin: 20px auto 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s cubic-bezier(0.22,1,0.36,1) 0.6s,
              transform 0.5s cubic-bezier(0.22,1,0.36,1) 0.6s;
}
.chat-empty-state.ready .es-chips {
  opacity: 1;
  transform: translateY(0);
}
.es-chip {
  padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s, box-shadow 0.15s, color 0.15s;
  white-space: nowrap;
}
body[data-theme="dark"] .es-chip {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: #9ca3af;
}
body[data-theme="light"] .es-chip {
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(0,0,0,0.09);
  color: #6b7280;
}
body[data-theme="dark"] .es-chip:hover {
  border-color: rgba(16,185,129,0.5);
  background: rgba(16,185,129,0.1);
  color: #34d399;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px -6px rgba(16,185,129,0.45);
}
body[data-theme="light"] .es-chip:hover {
  border-color: rgba(16,185,129,0.45);
  background: rgba(16,185,129,0.07);
  color: #047857;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px -6px rgba(16,185,129,0.3);
}
.es-chip:active { transform: translateY(0); }

/* Controls bar — polished labels */
.ai-control label {
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
body[data-theme="dark"]  .ai-control label { color: #4b5563 !important; }
body[data-theme="light"] .ai-control label { color: #9ca3af !important; }

/* Controls bar — depth */
body[data-theme="dark"] .ai-controls {
  box-shadow: 0 4px 20px -6px rgba(0,0,0,0.6);
}
body[data-theme="light"] .ai-controls {
  box-shadow: 0 4px 20px -6px rgba(0,0,0,0.08);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .es-chips { transition: none; }
  .chat-empty-state.ready .es-chips { opacity: 1; transform: none; }
}

/* ════════════════════════════════════════════════════
   MODEL DROPDOWN — soft-tint icon containers
   Flat colour icon inside a lightly tinted square.
   No gradients, no shadows — just enough to distinguish.
   ════════════════════════════════════════════════════ */

.mdp-model-ic {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mdp-model-ic--t1  { background: rgba(16,185,129,0.13); color: #10b981; }
.mdp-model-ic--t2  { background: rgba(99,102,241,0.13); color: #818cf8; }
.mdp-model-ic--img { background: rgba(167,139,250,0.13); color: #a78bfa; }
body[data-theme="light"] .mdp-model-ic--t1  { background: rgba(16,185,129,0.1); color: #059669; }
body[data-theme="light"] .mdp-model-ic--t2  { background: rgba(99,102,241,0.1); color: #4f46e5; }
body[data-theme="light"] .mdp-model-ic--img { background: rgba(167,139,250,0.1); color: #7c3aed; }

/* ════════════════════════════════════════════════════
   UPLOAD DROPDOWN — soft-tint icon containers
   ════════════════════════════════════════════════════ */

.upl-ic {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upl-ic--file   { background: rgba(100,116,139,0.13); color: #94a3b8; }
.upl-ic--photo  { background: rgba(245,158,11,0.13);  color: #f59e0b; }
.upl-ic--camera { background: rgba(59,130,246,0.13);  color: #60a5fa; }
body[data-theme="light"] .upl-ic--file   { background: rgba(100,116,139,0.1); color: #475569; }
body[data-theme="light"] .upl-ic--photo  { background: rgba(245,158,11,0.1);  color: #b45309; }
body[data-theme="light"] .upl-ic--camera { background: rgba(59,130,246,0.1);  color: #2563eb; }

