/* ═══════════════════════════════════════════════════════════════
   KeneAI Design System v4
   Light lavender + white cards + purple/pink/orange — kenetalkenglish.com palette
   Self-hosted, zero CDN dependencies
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  /* Purple palette — dominant brand colour */
  --purple-950: #1a0a3b;
  --purple-900: #2d1b69;
  --purple-800: #3b2080;
  --purple-700: #5b21b6;
  --purple-600: #7c3aed;
  --purple-500: #8b5cf6;
  --purple-400: #a78bfa;
  --purple-300: #c4b5fd;
  --purple-200: #ddd6fe;
  --purple-100: #ede9fe;
  --purple-50:  #f5f3ff;

  /* Pink palette */
  --pink-700: #be185d;
  --pink-600: #db2777;
  --pink-500: #ec4899;
  --pink-400: #f472b6;
  --pink-300: #f9a8d4;
  --pink-200: #fbcfe8;
  --pink-100: #fce7f3;
  --pink-50:  #fdf2f8;

  /* Orange/coral — CTA accent (matching kenetalkenglish.com button) */
  --orange-700: #c2410c;
  --orange-600: #ea580c;
  --orange-500: #f97316;
  --orange-400: #fb923c;
  --orange-300: #fdba74;

  /* Blue — cool balance */
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-300: #93c5fd;
  --blue-200: #bfdbfe;

  /* Nav dark — matching kenetalkenglish.com nav/CTA sections */
  --nav-dark: #2d2b55;
  --nav-mid:  #3d3a72;

  /* Gradients */
  --gradient:        linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #ec4899 100%);
  --gradient-soft:   linear-gradient(135deg, rgba(139,92,246,.07) 0%, rgba(236,72,153,.07) 100%);
  --gradient-orange: linear-gradient(135deg, #f97316 0%, #ec4899 100%);

  /* Semantic backgrounds — LIGHT theme */
  --bg-base:   #f5f0ff;   /* light lavender — dominant page bg */
  --bg-card:   #ffffff;   /* white cards */
  --bg-card-2: #fdf4ff;   /* soft pink-white secondary */
  --bg-input:  #f9f5ff;   /* very light lavender for inputs */
  --bg-nav:    #2d2b55;   /* dark nav — matches website */

  /* Borders */
  --border:        rgba(139,92,246,.18);
  --border-strong: rgba(139,92,246,.40);

  /* Text — on light backgrounds */
  --text-primary:    #2d1b69;   /* deep purple — headings & primary text */
  --text-secondary:  #6d4a9c;   /* medium purple */
  --text-muted:      #9278bc;   /* light purple */
  --text-dim:        #7a6b9a;
  --text-dark:       #2d1b69;   /* alias — used in cards/modals */
  --text-dark-sub:   #5b3d8f;
  --text-dark-muted: #8b6bb5;
  --text-on-dark:    #ffffff;   /* white text on dark nav */

  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;

  --radius-sm:   8px;
  --radius:     12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  --shadow:       0 4px 24px rgba(139,92,246,.15);
  --shadow-glow:  0 0 24px rgba(139,92,246,.30);
  --shadow-pink:  0 0 24px rgba(236,72,153,.35);
  --shadow-card:  0 4px 24px rgba(45,27,105,.08);
  --shadow-orange:0 0 24px rgba(249,115,22,.30);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --transition: 200ms ease;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--purple-600); text-decoration: none; }
a:hover { color: var(--purple-500); }
button { cursor: pointer; border: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
img { max-width: 100%; display: block; }

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,.30); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,.55); }

/* ── Typography ────────────────────────────────────────────────── */
h1 { font-size: 2rem;    font-weight: 700; line-height: 1.2; color: var(--text-dark); }
h2 { font-size: 1.5rem;  font-weight: 600; line-height: 1.3; color: var(--text-dark); }
h3 { font-size: 1.125rem;font-weight: 600; color: var(--text-dark); }
h4 { font-size: 1rem;    font-weight: 600; color: var(--text-dark); }
p  { color: var(--text-dim); }
.text-gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Layout helpers ────────────────────────────────────────────── */
.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1  { gap: .5rem; }
.gap-2  { gap: 1rem;  }
.gap-3  { gap: 1.5rem;}
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.overflow-hidden  { overflow: hidden; }
.overflow-y-auto  { overflow-y: auto; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.flex-1   { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }

/* ── Spacing ───────────────────────────────────────────────────── */
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }  .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }.mb-2 { margin-bottom: 1rem; }.mb-3 { margin-bottom: 1.5rem; }
.p-1  { padding: .5rem; }      .p-2  { padding: 1rem; }      .p-3  { padding: 1.5rem; }

/* ── Text utilities ────────────────────────────────────────────── */
.text-sm     { font-size: .875rem; }
.text-xs     { font-size: .75rem; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }
.text-warning   { color: var(--warning); }
.rounded-full   { border-radius: var(--radius-full); }
.truncate       { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden         { display: none !important; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: var(--text-dark);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-strong); }
.card-glass {
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(139,92,246,.20);
  border-radius: var(--radius-lg);
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .625rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 0 32px rgba(139,92,246,.5); }
.btn-orange {
  background: var(--gradient-orange);
  color: #fff;
  box-shadow: var(--shadow-orange);
}
.btn-orange:hover { opacity: .9; transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dark);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--purple-50); }
.btn-ghost  { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--purple-50); color: var(--text-dark); }
.btn-danger { background: rgba(239,68,68,.10); border: 1px solid rgba(239,68,68,.28); color: #dc2626; }
.btn-danger:hover { background: rgba(239,68,68,.20); }
.btn-sm   { padding: .375rem .875rem; font-size: .8125rem; }
.btn-lg   { padding: .875rem 2rem;    font-size: 1rem; }
.btn-icon { padding: .5rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .625rem;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .025em;
}
.badge-purple { background: rgba(139,92,246,.12); color: var(--purple-700);  border: 1px solid rgba(139,92,246,.25); }
.badge-pink   { background: rgba(236,72,153,.12); color: var(--pink-700);    border: 1px solid rgba(236,72,153,.25); }
.badge-orange { background: rgba(249,115,22,.12); color: var(--orange-700);  border: 1px solid rgba(249,115,22,.25); }
.badge-green  { background: rgba(16,185,129,.12); color: #059669;            border: 1px solid rgba(16,185,129,.25); }
.badge-yellow { background: rgba(245,158,11,.12); color: #d97706;            border: 1px solid rgba(245,158,11,.25); }
.badge-red    { background: rgba(239,68,68,.12);  color: #dc2626;            border: 1px solid rgba(239,68,68,.25); }
.badge-gray   { background: rgba(107,114,128,.12);color: #6b7280;            border: 1px solid rgba(107,114,128,.25); }

/* ── Forms ─────────────────────────────────────────────────────── */
.form-group  { display: flex; flex-direction: column; gap: .375rem; }
.form-label  { font-size: .8125rem; font-weight: 500; color: var(--text-dark-sub); }
.form-input  {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .625rem .875rem;
  color: var(--text-dark);
  font-size: .9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-input:focus { outline: none; border-color: var(--purple-500); box-shadow: 0 0 0 3px rgba(139,92,246,.15); }
.form-input::placeholder { color: var(--text-dark-muted); }
select.form-input  { cursor: pointer; }
textarea.form-input{ resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Progress bars ─────────────────────────────────────────────── */
.progress-bar  { width: 100%; height: 6px; background: rgba(139,92,246,.12); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--gradient); border-radius: var(--radius-full); transition: width .6s ease; }
.progress-bar-lg { height: 10px; }

/* ── CEFR level pills ───────────────────────────────────────────── */
.cefr-levels { display: flex; gap: .25rem; width: 100%; }
.cefr-pill {
  flex: 1;
  text-align: center;
  padding: .25rem .125rem;
  border-radius: var(--radius-sm);
  font-size: .6875rem;
  font-weight: 600;
  background: var(--purple-50);
  color: var(--text-dark-muted);
  border: 1px solid transparent;
  transition: all var(--transition);
}
.cefr-pill.active { background: var(--gradient); color: #fff; box-shadow: var(--shadow-glow); }
.cefr-pill.passed { background: rgba(139,92,246,.12); color: var(--purple-700); border-color: rgba(139,92,246,.22); }

/* ── Stat cards ────────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  box-shadow: var(--shadow-card);
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.stat-label { font-size: .75rem; color: var(--text-dark-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── Tabs ──────────────────────────────────────────────────────── */
.nav-tabs {
  display: inline-flex;
  gap: .25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: .25rem;
  box-shadow: var(--shadow-card);
}
.nav-tab {
  padding: .5rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-dark-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-tab.active          { background: var(--gradient); color: #fff; box-shadow: var(--shadow-glow); }
.nav-tab:hover:not(.active) { color: var(--text-dark); background: var(--purple-50); }

/* ── Tables ────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: .75rem 1rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-dark-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky; top: 0;
}
.data-table td {
  padding: .875rem 1rem;
  font-size: .875rem;
  color: var(--text-dark);
  border-bottom: 1px solid rgba(139,92,246,.07);
  vertical-align: middle;
}
.data-table tr:hover td      { background: var(--purple-50); }
.data-table tr:last-child td { border-bottom: none; }

/* ── Toasts ────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  display: flex; flex-direction: column; gap: .5rem;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .875rem;
  color: var(--text-dark);
  box-shadow: var(--shadow);
  animation: toast-in .3s ease;
  pointer-events: auto;
  max-width: 320px;
}
.toast.success { border-color: rgba(16,185,129,.4); }
.toast.error   { border-color: rgba(239,68,68,.4); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ── Modals ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(45,27,105,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: fade-in .2s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  animation: slide-up .3s ease;
  color: var(--text-dark);
  box-shadow: var(--shadow);
}
.modal-lg { max-width: 680px; }
.modal-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title   { font-size: 1.25rem; font-weight: 600; color: var(--text-dark); }
.modal-close   {
  background: var(--purple-50); border: 1px solid var(--border); color: var(--text-dark-muted);
  width: 32px; height: 32px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.125rem; line-height: 1; transition: all var(--transition);
}
.modal-close:hover { color: var(--text-dark); border-color: var(--border-strong); background: var(--purple-100); }
.modal-footer  { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; }
@keyframes fade-in  { from { opacity: 0; }              to { opacity: 1; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ── Divider ───────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* ════════════════════════════════════════════════════════════════
   LOGIN SCREEN
════════════════════════════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center; padding: 2rem;
  background: var(--bg-base);
  position: relative; overflow: hidden;
}
.login-bg-blob { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; opacity: .18; }
.login-bg-blob-1 { width: 420px; height: 420px; background: var(--purple-400); top: -120px; left: -100px; }
.login-bg-blob-2 { width: 320px; height: 320px; background: var(--pink-400);   bottom: -60px; right: -60px; }
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%; max-width: 400px;
  position: relative; z-index: 1;
  box-shadow: var(--shadow);
  color: var(--text-dark);
}
.login-logo {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: 2rem; justify-content: center;
}
.login-logo-icon {
  width: 48px; height: 48px;
  background: var(--gradient);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-glow);
}
.login-logo-text { font-size: 1.5rem; font-weight: 700; color: var(--text-dark); }
.login-tagline { text-align: center; color: var(--text-dark-muted); font-size: .875rem; margin-bottom: 2rem; }
.login-error {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  color: #dc2626;
  font-size: .875rem;
  margin-bottom: 1rem;
}

/* ════════════════════════════════════════════════════════════════
   STUDENT APP — two-column layout
════════════════════════════════════════════════════════════════ */
.app-shell {
  display: grid;
  grid-template-columns: 1fr 300px;
  height: 100vh;
  overflow: hidden;
}

/* ─ Mobile top bar ─ */
.mobile-bar {
  display: none;
  background: var(--bg-nav);
  border-bottom: 1px solid rgba(255,255,255,.10);
  padding: .75rem 1rem;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mobile-stats { display: flex; align-items: center; gap: .75rem; font-size: .8125rem; }
.mobile-stat  { display: flex; align-items: center; gap: .375rem; color: rgba(255,255,255,.75); }

/* ─ Chat panel ─ */
.chat-panel {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--bg-card-2);
}
.chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  flex-shrink: 0;
  background: var(--bg-nav);
}
.chat-avatar {
  width: 40px; height: 40px;
  background: var(--gradient);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}
.chat-name   { font-weight: 600; font-size: .9375rem; color: var(--text-on-dark); }
.chat-status {
  font-size: .75rem; color: rgba(255,255,255,.60);
  display: flex; align-items: center; gap: .375rem;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s infinite;
}
.status-dot.recording  { background: var(--danger);  animation: pulse-dot .6s infinite; }
.status-dot.processing { background: var(--warning); }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.35} }

/* ─ Messages ─ */
.messages-area {
  flex: 1; overflow-y: auto;
  padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.message {
  display: flex; gap: .75rem;
  max-width: 82%;
  animation: msg-in .3s ease;
}
@keyframes msg-in { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.message.keneai  { align-self: flex-start; }
.message.student { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem; flex-shrink: 0;
}
.message.keneai  .msg-avatar { background: var(--gradient); box-shadow: var(--shadow-glow); }
.message.student .msg-avatar { background: var(--purple-100); border: 1px solid var(--border); }
.msg-bubble {
  padding: .75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: .9375rem; line-height: 1.6;
}
.message.keneai  .msg-bubble {
  background: var(--bg-card); border: 1px solid var(--border);
  border-top-left-radius: 4px; color: var(--text-dark);
  box-shadow: var(--shadow-card);
}
.message.student .msg-bubble {
  background: linear-gradient(135deg, rgba(139,92,246,.15), rgba(236,72,153,.12));
  border: 1px solid rgba(139,92,246,.22);
  border-top-right-radius: 4px; color: var(--text-dark);
}
.msg-time { font-size: .6875rem; color: var(--text-dark-muted); margin-top: .25rem; }
.message.keneai  .msg-time { text-align: left; }
.message.student .msg-time { text-align: right; }

.typing-indicator { display: flex; gap: .75rem; align-items: center; animation: msg-in .3s ease; }
.typing-dots {
  display: flex; gap: 4px; padding: .875rem 1rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); border-top-left-radius: 4px;
}
.typing-dot {
  width: 6px; height: 6px; background: var(--purple-400); border-radius: 50%;
  animation: bounce-dot 1.2s infinite;
}
.typing-dot:nth-child(2){ animation-delay: .2s; }
.typing-dot:nth-child(3){ animation-delay: .4s; }
@keyframes bounce-dot { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-6px);opacity:1} }

/* ─ Chat controls ─ */
.chat-controls {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex; flex-direction: column; align-items: center; gap: .875rem;
  flex-shrink: 0;
}
.mic-btn {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--gradient);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  transition: all .2s ease;
  box-shadow: var(--shadow-glow);
  position: relative;
}
.mic-btn:hover:not(:disabled){ transform: scale(1.06); }
.mic-btn:active:not(:disabled){ transform: scale(.95); }
.mic-btn.recording {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 0 0 10px rgba(239,68,68,.18);
  animation: mic-pulse-red .9s infinite;
}
.mic-btn.processing { opacity: .65; cursor: not-allowed; animation: spin-slow 1.2s linear infinite; }
.mic-btn.playing {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 0 0 10px rgba(16,185,129,.15);
  animation: mic-pulse-green 1.4s infinite;
}
.mic-btn:disabled { opacity: .4; cursor: not-allowed; }
@keyframes mic-pulse-red {
  0%,100%{ box-shadow: 0 0 0 0   rgba(239,68,68,.45); }
  50%    { box-shadow: 0 0 0 18px rgba(239,68,68,0);   }
}
@keyframes mic-pulse-green {
  0%,100%{ box-shadow: 0 0 0 0   rgba(16,185,129,.45); }
  50%    { box-shadow: 0 0 0 18px rgba(16,185,129,0);  }
}
@keyframes spin-slow { to { transform: rotate(360deg); } }
.mic-hint { font-size: .8125rem; color: var(--text-dark-muted); text-align: center; }

/* ─ Sidebar ─ */
.sidebar {
  display: flex; flex-direction: column;
  height: 100vh; overflow-y: auto;
  padding: 1.25rem;
  gap: .875rem;
  background: var(--bg-base);
}
.sidebar-close-row { display: none; justify-content: flex-end; }

.profile-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 1.25rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); gap: .375rem;
  box-shadow: var(--shadow-card);
}
.profile-initials {
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; font-weight: 700; color: #fff;
  box-shadow: var(--shadow-glow);
  margin-bottom: .25rem;
}
.profile-name  { font-weight: 600; font-size: 1rem; color: var(--text-dark); }
.profile-sub   { font-size: .75rem; color: var(--text-dark-muted); }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .625rem;
}
.sidebar-label {
  font-size: .6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-secondary);
  margin-bottom: .375rem;
}
.level-progress-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  display: flex; flex-direction: column; gap: .5rem;
  box-shadow: var(--shadow-card);
}
.level-progress-header { display: flex; justify-content: space-between; align-items: center; font-size: .8125rem; color: var(--text-dark); }
.level-pct { font-weight: 600; color: var(--purple-600); }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; }

/* ════════════════════════════════════════════════════════════════
   PROGRESS PAGE
════════════════════════════════════════════════════════════════ */
.progress-page { min-height: 100vh; background: var(--bg-base); }
.progress-topbar {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: var(--bg-nav);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: sticky; top: 0; z-index: 10;
}
.progress-topbar-logo { display: flex; align-items: center; gap: .5rem; font-size: 1.125rem; font-weight: 700; color: var(--text-on-dark); }
.progress-body { max-width: 820px; margin: 0 auto; padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }

.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  display: flex; align-items: center; gap: 1.5rem;
  background-image: var(--gradient-soft);
  color: var(--text-dark);
  box-shadow: var(--shadow-card);
}
.hero-avatar {
  width: 72px; height: 72px;
  border-radius: var(--radius-full);
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.875rem; font-weight: 700; color: #fff;
  box-shadow: var(--shadow-glow); flex-shrink: 0;
}
.hero-info { flex: 1; min-width: 0; }
.hero-name { font-size: 1.5rem; font-weight: 700; color: var(--text-dark); }
.hero-level-row { display: flex; align-items: center; gap: .5rem; margin-top: .375rem; }

.skill-bars { display: flex; flex-direction: column; gap: .875rem; }
.skill-row  { display: flex; align-items: center; gap: 1rem; }
.skill-name { width: 100px; font-size: .875rem; color: var(--text-dark-sub); flex-shrink: 0; }
.skill-wrap { flex: 1; }
.skill-score{ width: 36px; text-align: right; font-size: .875rem; font-weight: 600; color: var(--purple-600); flex-shrink: 0; }

.sessions-list { display: flex; flex-direction: column; gap: .5rem; }
.session-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .875rem 1rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); transition: border-color var(--transition);
  color: var(--text-dark);
  box-shadow: var(--shadow-card);
}
.session-row:hover { border-color: var(--border-strong); }
.session-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius); background: rgba(139,92,246,.12);
  display: flex; align-items: center; justify-content: center;
  font-size: .9375rem; flex-shrink: 0;
}
.session-info  { flex: 1; min-width: 0; }
.session-title { font-size: .9rem; font-weight: 500; color: var(--text-dark); }
.session-meta  { font-size: .75rem; color: var(--text-dark-muted); }
.session-dur   { font-size: .8125rem; color: var(--text-dark-sub); flex-shrink: 0; }

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .75rem;
}
.achievement-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: .5rem;
  transition: border-color var(--transition);
  color: var(--text-dark);
  box-shadow: var(--shadow-card);
}
.achievement-card:not(.locked):hover { border-color: var(--border-strong); }
.achievement-card.locked { opacity: .38; filter: grayscale(.6); }
.achievement-icon { font-size: 1.75rem; }
.achievement-name { font-size: .75rem; font-weight: 600; color: var(--text-dark-sub); }

/* ════════════════════════════════════════════════════════════════
   ADMIN DASHBOARD
════════════════════════════════════════════════════════════════ */
.admin-layout { min-height: 100vh; display: flex; flex-direction: column; }
.admin-topbar {
  background: var(--bg-nav); border-bottom: 1px solid rgba(255,255,255,.08);
  padding: .875rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: sticky; top: 0; z-index: 10;
}
.admin-logo { display: flex; align-items: center; gap: .625rem; font-size: 1.125rem; font-weight: 700; color: var(--text-on-dark); }
.admin-logo-icon {
  width: 32px; height: 32px;
  background: var(--gradient); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: .9375rem;
}
.admin-body { flex: 1; padding: 1.5rem; max-width: 1240px; margin: 0 auto; width: 100%; }
.admin-tabs-row { margin-bottom: 1.5rem; overflow-x: auto; padding-bottom: .25rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap;
}
.section-title { font-size: 1.125rem; font-weight: 600; color: var(--text-dark); }

.search-box { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: .75rem; color: var(--text-dark-muted); pointer-events: none; font-size: .875rem; }
.search-input {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: .5rem .875rem .5rem 2.25rem;
  color: var(--text-dark); font-size: .875rem; width: 220px;
  transition: border-color var(--transition);
}
.search-input:focus { outline: none; border-color: var(--purple-500); }
.search-input::placeholder { color: var(--text-dark-muted); }

.table-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.table-wrap  { overflow-x: auto; }

.usage-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }

/* ── Admin topbar buttons on dark bg ─────────────────────────── */
.admin-topbar .btn-ghost { color: rgba(255,255,255,.75); }
.admin-topbar .btn-ghost:hover { background: rgba(255,255,255,.10); color: #fff; }
.admin-topbar .btn-secondary { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.20); color: #fff; }
.admin-topbar .btn-secondary:hover { background: rgba(255,255,255,.18); }

/* ── Progress topbar buttons on dark bg ─────────────────────── */
.progress-topbar .btn-ghost { color: rgba(255,255,255,.75); }
.progress-topbar .btn-ghost:hover { background: rgba(255,255,255,.10); color: #fff; }

/* ── Mobile bar buttons on dark bg ──────────────────────────── */
.mobile-bar .btn-ghost { color: rgba(255,255,255,.75); }
.mobile-bar .btn-ghost:hover { background: rgba(255,255,255,.10); color: #fff; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Student — stacked layout */
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar {
    display: none;
    position: fixed; inset: 0; z-index: 100;
    background: var(--bg-base); animation: slide-up .3s ease;
  }
  .sidebar.open { display: flex; }
  .sidebar-close-row { display: flex; }
  .mobile-bar { display: flex; }
  .chat-panel { height: calc(100vh - 52px); }
  .messages-area { padding: 1rem; }
  .chat-controls { padding: 1rem; }
  .mic-btn { width: 64px; height: 64px; font-size: 1.5rem; }
  .message { max-width: 90%; }

  /* Progress */
  .hero-card { flex-direction: column; text-align: center; }
  .hero-avatar { margin: 0 auto; }
  .skill-name { width: 76px; font-size: .8125rem; }
  .progress-body { padding: 1rem; }

  /* Admin */
  .admin-body { padding: 1rem; }
  .admin-tabs-row .nav-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .search-input { width: 100%; }
  .data-table th:nth-child(n+5),
  .data-table td:nth-child(n+5) { display: none; }
  .form-row { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .modal { padding: 1.5rem; }
}

@media (max-width: 480px) {
  .login-card { padding: 1.75rem 1.25rem; }
  .achievements-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
