/* ============================================================
   StudyMind — Premium Dark Theme CSS
   ============================================================ */

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

:root, [data-theme="dark"] {
  --bg:          #000000;
  --bg2:         #111111;
  --surface:     rgba(20, 20, 20, 0.85);
  --surface2:    rgba(30, 30, 30, 0.95);
  --border:      rgba(255, 255, 255, 0.1);
  --border2:     rgba(255, 255, 255, 0.2);
  --primary:       #3b82f6;
  --primary2:      #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-glow:  rgba(59, 130, 246, 0.2);
  --primary-glow2: rgba(59, 130, 246, 0.4);
  --text:        #ffffff;
  --text-muted:  #a3a3a3;
  --text-dim:    #737373;
  --red:         #ef4444;
  --yellow:      #eab308;
  --blue:        #60a5fa;
  --font:        'Inter', sans-serif;
  --font2:       'Plus Jakarta Sans', sans-serif;
  --radius:      14px;
  --radius-lg:   20px;
  --shadow:      0 10px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 50px rgba(59,130,246,0.3);
  --transition:  0.25s ease;
}

[data-theme="light"] {
  --bg:          #f1f5f9;
  --bg2:         #ffffff;
  --surface:     rgba(255, 255, 255, 0.95);
  --surface2:    rgba(250, 250, 250, 1);
  --border:      rgba(0, 0, 0, 0.2);
  --border2:     rgba(0, 0, 0, 0.35);
  --primary:       #2563eb;
  --primary2:      #1d4ed8;
  --primary-dark:  #1e40af;
  --primary-glow:  rgba(37, 99, 235, 0.2);
  --primary-glow2: rgba(37, 99, 235, 0.4);
  --text:        #000000;
  --text-muted:  #525252;
  --text-dim:    #737373;
  --red:         #ef4444;
  --yellow:      #eab308;
  --blue:        #2563eb;
  --shadow:      0 8px 30px rgba(0,0,0,0.1);
  --shadow-glow: 0 0 40px rgba(37,99,235,0.25);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* BACKGROUND */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
}
.bg-glow {
  position: fixed; top: -200px; left: 50%; z-index: 0; pointer-events: none;
  transform: translateX(-50%);
  width: 800px; height: 400px;
  background: radial-gradient(ellipse, rgba(45,212,191,0.07) 0%, transparent 70%);
}

/* HEADER */
.header {
  position: relative; z-index: 10;
  text-align: center;
  padding: 2.5rem 1rem 1rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
}
.header-inner { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.logo { display: flex; align-items: center; gap: 0.5rem; }
.logo-icon { font-size: 2rem; }
.logo-text {
  font-family: var(--font2);
  font-size: 2.4rem; font-weight: 700;
  background: linear-gradient(135deg, #ccfbf1 0%, #2dd4bf 50%, #0f766e 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-accent { color: var(--primary); }
.logo-sub { font-size: 0.72rem; letter-spacing: 0.2em; color: var(--text-muted); font-weight: 500; }
.header-badge {
  margin-top: 0.4rem;
  background: rgba(45,212,191,0.1);
  border: 1px solid var(--border2);
  color: var(--primary);
  font-size: 0.75rem; font-weight: 600;
  padding: 0.3rem 1rem; border-radius: 999px;
  letter-spacing: 0.05em;
}

/* APP CONTAINER */
.app-container {
  position: relative; z-index: 5;
  max-width: 900px; margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow), var(--shadow-glow);
  backdrop-filter: blur(12px);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--border2); box-shadow: var(--shadow), 0 0 60px rgba(45,212,191,0.12); }
.card-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.2rem; }
.card-header h2 { font-family: var(--font2); font-size: 1.15rem; font-weight: 600; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.card-title-row h3 { font-family: var(--font2); font-size: 1.05rem; font-weight: 600; }
.step-badge { font-size: 1.3rem; }

/* API CARD */
.api-steps {
  list-style: none; counter-reset: step-counter;
  display: flex; flex-direction: column; gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.api-steps li {
  counter-increment: step-counter;
  display: flex; align-items: baseline; gap: 0.75rem;
  font-size: 0.88rem; color: var(--text-muted);
}
.api-steps li::before {
  content: counter(step-counter);
  min-width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary-dark); color: var(--primary);
  font-size: 0.72rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.api-steps li strong { color: var(--text); }

.api-input-row {
  display: flex; gap: 0.5rem; align-items: center;
  margin: 1rem 0 0.6rem;
  flex-wrap: wrap;
}
.api-input {
  flex: 1; min-width: 200px;
  background: rgba(0,0,0,0.4); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text);
  padding: 0.65rem 1rem; font-size: 0.9rem; font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.api-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow2); }
.api-note { font-size: 0.78rem; color: var(--text-dim); }
.key-status { margin-top: 0.5rem; padding: 0.5rem 1rem; border-radius: var(--radius); font-size: 0.85rem; font-weight: 500; }
.key-status.success { background: rgba(45,212,191,0.1); color: var(--primary); border: 1px solid var(--border2); }
.key-status.error { background: rgba(248,113,113,0.1); color: var(--red); border: 1px solid rgba(248,113,113,0.3); }

/* UPLOAD CARD */
.drop-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-glow);
}
.drop-icon { font-size: 2.8rem; margin-bottom: 0.3rem; }
.drop-zone h3 { font-family: var(--font2); font-size: 1.1rem; font-weight: 600; }
.drop-sub { color: var(--text-muted); font-size: 0.85rem; }

.divider {
  display: flex; align-items: center; gap: 1rem;
  color: var(--text-dim); font-size: 0.8rem; margin: 1rem 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border2), transparent);
}

.text-area {
  width: 100%; min-height: 120px; resize: vertical;
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  padding: 0.85rem 1rem; font-size: 0.88rem; font-family: var(--font);
  transition: border-color var(--transition); outline: none;
}
.text-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

.upload-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; flex-wrap: wrap; gap: 0.75rem; }
.file-info { font-size: 0.85rem; color: var(--primary); padding: 0.4rem 0.8rem; background: var(--primary-glow); border-radius: var(--radius); border: 1px solid var(--border2); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600; font-family: var(--font);
  cursor: pointer; border: none; outline: none;
  transition: all var(--transition); white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff;
  box-shadow: 0 0 20px var(--primary-glow2);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #60a5fa, var(--primary));
  box-shadow: 0 0 40px var(--primary-glow2);
  transform: translateY(-1px);
}
.btn-secondary {
  background: transparent; color: var(--primary);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { background: var(--primary-glow); border-color: var(--primary); }
.btn-outline {
  background: rgba(255,255,255,0.04); color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--border2); background: rgba(45,212,191,0.05); }
.btn-outline.active { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-group { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* LOADING */
.loading-overlay {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 3rem; text-align: center; color: var(--text-muted);
}
.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* NAV TABS */
.app-nav {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding-top: 1rem;
}
.nav-tab {
  padding: 0.85rem 1rem; border-radius: 12px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-muted); font-size: 0.95rem; font-weight: 500;
  text-align: left; display: flex; align-items: center; gap: 0.6rem;
  cursor: pointer; font-family: var(--font2);
  transition: all var(--transition); white-space: nowrap;
}
.nav-tab:hover { background: var(--border); color: var(--text); }
.nav-tab.active {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
  border: 1px solid var(--border2);
}

/* TAB PANELS */
.tab-panel { display: none; flex-direction: column; gap: 1.25rem; }
.tab-panel.active { display: flex; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* PANEL GRID */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 640px) { .panel-grid { grid-template-columns: 1fr; } }

/* PROSE CONTENT */
.prose-content {
  color: var(--text-muted); font-size: 0.9rem; line-height: 1.8;
  white-space: pre-wrap; min-height: 60px;
}
.prose-content strong { color: var(--text); }
.prose-content h1, .prose-content h2, .prose-content h3 { color: var(--primary); font-family: var(--font2); margin: 0.75rem 0 0.35rem; }

/* TOPICS */
.topics-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.topic-chip {
  padding: 0.35rem 0.85rem; border-radius: 999px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition); user-select: none;
}
.topic-chip:hover { background: rgba(255,255,255,0.1); transform: scale(1.03); }
.topic-chip.good { background: rgba(45,212,191,0.1); border-color: rgba(45,212,191,0.35); color: var(--primary); }
.topic-chip.good:hover { background: rgba(45,212,191,0.2); }
.topic-chip.medium { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.35); color: var(--yellow); }
.topic-chip.medium:hover { background: rgba(251,191,36,0.2); }
.topic-chip.weak { background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.35); color: var(--red); }
.topic-chip.weak:hover { background: rgba(248,113,113,0.2); }

/* QUIZ */
.quiz-settings-card { }
.settings-row { display: flex; gap: 1.25rem; align-items: flex-end; flex-wrap: wrap; margin-top: 1rem; }
.setting-group { display: flex; flex-direction: column; gap: 0.35rem; }
.setting-group label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }
.setting-input {
  background: rgba(0,0,0,0.4); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text);
  padding: 0.55rem 0.85rem; font-size: 0.88rem; font-family: var(--font);
  outline: none; width: 90px;
  transition: border-color var(--transition);
}
.setting-input:focus { border-color: var(--primary); }

.quiz-q-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  margin-bottom: 1rem;
}
.quiz-q-card .q-number { font-size: 0.75rem; color: var(--primary); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.5rem; }
.quiz-q-card .q-text { font-size: 0.95rem; font-weight: 500; margin-bottom: 1rem; }
.quiz-options { display: flex; flex-direction: column; gap: 0.5rem; }
.quiz-option {
  display: flex; align-items: center; gap: 0.75rem;
  background: rgba(0,0,0,0.25); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.65rem 1rem;
  cursor: pointer; transition: all var(--transition);
  font-size: 0.88rem;
}
.quiz-option:hover { border-color: var(--border2); background: var(--primary-glow); }
.quiz-option input[type="radio"] { accent-color: var(--primary); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-glow); }
.quiz-short-input {
  width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  padding: 0.65rem 1rem; font-size: 0.88rem; font-family: var(--font); outline: none;
  transition: border-color var(--transition);
}
.quiz-short-input:focus { border-color: var(--primary); }
.quiz-footer { text-align: center; margin-top: 1rem; }

/* RESULTS */
.result-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1rem;
}
.result-card .result-q { font-weight: 600; margin-bottom: 0.5rem; }
.result-card .result-answer { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.result-card .result-feedback { font-size: 0.88rem; padding: 0.6rem 0.85rem; border-radius: 8px; margin-top: 0.5rem; }
.result-card.correct { border-color: rgba(45,212,191,0.4); }
.result-card.correct .result-feedback { background: rgba(45,212,191,0.1); color: var(--primary); }
.result-card.incorrect { border-color: rgba(248,113,113,0.4); }
.result-card.incorrect .result-feedback { background: rgba(248,113,113,0.1); color: var(--red); }
.result-card.partial { border-color: rgba(251,191,36,0.4); }
.result-card.partial .result-feedback { background: rgba(251,191,36,0.1); color: var(--yellow); }

.score-banner {
  background: linear-gradient(135deg, rgba(45,212,191,0.15), rgba(20,184,166,0.08));
  border: 1px solid var(--border2); border-radius: var(--radius-lg);
  padding: 1.5rem; text-align: center; margin-bottom: 1.25rem;
}
.score-banner .score-num { font-size: 3rem; font-weight: 800; color: var(--primary); font-family: var(--font2); }
.score-banner .score-label { color: var(--text-muted); font-size: 0.9rem; }
.score-banner .score-badge { display: inline-block; margin-top: 0.5rem; padding: 0.3rem 1rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }

/* PERFORMANCE */
.perf-stats { display: flex; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }
.stat-box {
  flex: 1; min-width: 80px;
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.85rem;
  text-align: center;
}
.stat-box span { display: block; font-size: 1.6rem; font-weight: 700; color: var(--primary); font-family: var(--font2); }
.stat-box label { font-size: 0.72rem; color: var(--text-dim); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
#perf-chart { width: 100%; margin-top: 1rem; }

/* WEAK TOPICS */
.weak-list { display: flex; flex-direction: column; gap: 0.5rem; }
.weak-item {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(248,113,113,0.07); border: 1px solid rgba(248,113,113,0.25);
  border-radius: var(--radius); padding: 0.65rem 1rem;
}
.weak-item .topic-name { font-size: 0.9rem; font-weight: 500; }
.weak-item .topic-score { font-size: 0.8rem; color: var(--red); font-weight: 600; }
.weak-bar { flex: 1; height: 4px; background: rgba(255,255,255,0.08); border-radius: 999px; margin: 0 0.75rem; overflow: hidden; }
.weak-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--red), var(--yellow)); }

/* CHATBOT */
.chat-card { display: flex; flex-direction: column; height: 520px; }
.chat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.chat-header h3 { font-family: var(--font2); font-size: 1.05rem; font-weight: 600; }
.chat-badge { font-size: 0.73rem; background: rgba(96,165,250,0.1); border: 1px solid rgba(96,165,250,0.3); color: var(--blue); padding: 0.25rem 0.7rem; border-radius: 999px; }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; padding-right: 0.25rem; margin-bottom: 1rem; }
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 999px; }
.chat-msg { max-width: 80%; padding: 0.7rem 1rem; border-radius: 14px; font-size: 0.875rem; line-height: 1.6; animation: fadeIn 0.2s ease; }
.chat-msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--primary2), var(--primary-dark)); color: #000; font-weight: 500; border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px; }
.chat-msg.typing { color: var(--text-muted); font-style: italic; }
.chat-input-row { display: flex; gap: 0.5rem; }

/* TOAST */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text); padding: 0.7rem 1.4rem; border-radius: 999px;
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow), 0 0 30px rgba(45,212,191,0.2);
  z-index: 1000; white-space: nowrap;
  animation: slideUp 0.3s ease;
}
.toast.hidden { display: none; }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* UTILITIES */
.hidden { display: none !important; }
.mt-2 { margin-top: 0.75rem; }

/* STUDY PLAN TIMELINE */
.timeline {
  position: relative; padding-left: 24px; margin-top: 1.5rem;
}
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 8px; bottom: 0;
  width: 2px; background: var(--border2); border-radius: 999px;
}
.timeline-day {
  position: relative; margin-bottom: 2rem;
}
.timeline-dot {
  position: absolute; left: -24px; top: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg2); border: 3px solid var(--primary);
  z-index: 2; box-shadow: 0 0 10px var(--primary-glow);
}
.timeline-day-header { font-size: 0.85rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.25rem; }
.timeline-day-title { font-family: var(--font2); font-size: 1.15rem; font-weight: 600; margin-bottom: 1rem; color: var(--text); }
.timeline-task {
  display: flex; align-items: flex-start; gap: 0.75rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.85rem 1rem; margin-bottom: 0.5rem;
  transition: all var(--transition);
}
.timeline-task:hover { border-color: var(--primary); background: var(--primary-glow); }
.timeline-cb { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.timeline-task-content { flex: 1; font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }
.timeline-task.completed .timeline-task-content { text-decoration: line-through; opacity: 0.5; }
.timeline-task.completed { border-color: transparent; background: transparent; }


/* SCROLLBAR GLOBAL */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 999px; }

/* PROVIDER TOGGLE */
.provider-toggle {
  display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.provider-btn {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.1rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--border);
  color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; font-family: var(--font); transition: all var(--transition);
}
.provider-btn:hover { border-color: var(--border2); color: var(--text); }
.provider-btn.active {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-glow);
  box-shadow: 0 0 16px rgba(45,212,191,0.15);
}
.provider-tag {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem; border-radius: 999px; text-transform: uppercase;
}
.provider-tag.recommended { background: rgba(45,212,191,0.2); color: var(--primary); }

/* ── BLOOM'S TAXONOMY BADGES ─────────────────────────────────── */
.bloom-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.65rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid transparent;
}
.bloom-remember  { background: rgba(96,165,250,0.15);  color: #60a5fa; border-color: rgba(96,165,250,0.35); }
.bloom-understand{ background: rgba(167,139,250,0.15); color: #a78bfa; border-color: rgba(167,139,250,0.35);}
.bloom-apply     { background: rgba(45,212,191,0.15);  color: #2dd4bf; border-color: rgba(45,212,191,0.35); }
.bloom-analyze   { background: rgba(251,191,36,0.15);  color: #fbbf24; border-color: rgba(251,191,36,0.35); }
.bloom-evaluate  { background: rgba(251,146,60,0.15);  color: #fb923c; border-color: rgba(251,146,60,0.35); }
.bloom-create    { background: rgba(248,113,113,0.15); color: #f87171; border-color: rgba(248,113,113,0.35);}

/* Bloom level on quiz question */
.quiz-q-meta { display:flex; align-items:center; gap:0.5rem; margin-bottom:0.5rem; flex-wrap:wrap; }
.q-number-label { font-size: 0.75rem; color: var(--primary); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }

/* Bloom breakdown in performance tab */
.bloom-breakdown { display:flex; flex-direction:column; gap:0.4rem; margin-top:0.75rem; }
.bloom-row { display:flex; align-items:center; gap:0.6rem; }
.bloom-row .bloom-label { width:90px; font-size:0.78rem; font-weight:600; }
.bloom-row .bloom-bar-wrap { flex:1; height:6px; background:rgba(255,255,255,0.07); border-radius:999px; overflow:hidden; }
.bloom-row .bloom-bar-fill { height:100%; border-radius:999px; transition: width 0.6s ease; }
.bloom-row .bloom-pct { width:36px; text-align:right; font-size:0.75rem; color:var(--text-dim); }

/* SRS Badge */
.srs-badge {
  font-size: 0.68rem; padding: 0.15rem 0.55rem; border-radius: 999px;
  background: rgba(251,191,36,0.15); color: var(--yellow);
  border: 1px solid rgba(251,191,36,0.35); font-weight: 700;
  margin-left: 0.35rem; vertical-align: middle;
}

/* ── FLASHCARD 3D FLIP ───────────────────────────────────────── */
.fc-scene {
  width: 100%; perspective: 1000px; cursor: pointer;
  margin: 1rem 0;
}
.fc-card {
  width: 100%; min-height: 220px;
  position: relative; transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-lg);
}
.fc-card.flipped { transform: rotateY(180deg); }

.fc-front, .fc-back {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem; text-align: center; gap: 0.75rem;
}
.fc-front {
  background: linear-gradient(135deg, rgba(10,30,18,0.95), rgba(16,40,24,0.95));
  border: 1px solid var(--border2);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 40px var(--primary-glow);
}
.fc-back {
  background: linear-gradient(135deg, rgba(20,50,30,0.97), rgba(10,30,18,0.97));
  border: 1px solid rgba(45,212,191,0.4);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 50px rgba(45,212,191,0.15);
  transform: rotateY(180deg);
}
.fc-side-label {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--text-dim); position: absolute; top: 1rem;
}
.fc-text { font-size: 1.05rem; font-weight: 500; line-height: 1.6; color: var(--text); max-width: 560px; }
.fc-back .fc-text { color: var(--primary); }
.fc-bloom-row { margin-top:0.35rem; }
.fc-tap-hint { font-size:0.75rem; color:var(--text-dim); position:absolute; bottom:1rem; }
.fc-counter { font-size:0.82rem; color:var(--text-muted); font-weight:500; }

/* Flashcard navigation */
.fc-actions {
  display: flex; justify-content: center; gap: 0.75rem; margin: 0.5rem 0; flex-wrap: wrap;
}
.fc-btn-hard {
  background: rgba(248,113,113,0.12); color: var(--red);
  border: 1px solid rgba(248,113,113,0.35); padding: 0.6rem 1.25rem; border-radius: var(--radius);
  font-weight:600; cursor:pointer; font-family:var(--font); font-size:0.875rem;
  transition: all var(--transition);
}
.fc-btn-hard:hover { background: rgba(248,113,113,0.22); }
.fc-btn-ok {
  background: rgba(251,191,36,0.12); color: var(--yellow);
  border: 1px solid rgba(251,191,36,0.35); padding: 0.6rem 1.25rem; border-radius: var(--radius);
  font-weight:600; cursor:pointer; font-family:var(--font); font-size:0.875rem;
  transition: all var(--transition);
}
.fc-btn-ok:hover { background: rgba(251,191,36,0.22); }
.fc-btn-easy {
  background: rgba(45,212,191,0.12); color: var(--primary);
  border: 1px solid var(--border2); padding: 0.6rem 1.25rem; border-radius: var(--radius);
  font-weight:600; cursor:pointer; font-family:var(--font); font-size:0.875rem;
  transition: all var(--transition);
}
.fc-btn-easy:hover { background: rgba(45,212,191,0.22); }

.fc-nav { display:flex; align-items:center; justify-content:center; gap:1rem; margin-top:0.5rem; }
.fc-dots { display:flex; gap:0.4rem; align-items:center; }
.fc-dot {
  width:8px; height:8px; border-radius:50%;
  background: var(--border2); transition: all var(--transition); cursor:pointer;
}
.fc-dot.active { background: var(--primary); transform:scale(1.3); }
.fc-dot.done { background: rgba(45,212,191,0.4); }

.fc-session-stats {
  display:flex; align-items:center; justify-content:center; gap:1.5rem;
  background: rgba(0,0,0,0.25); border: 1px solid var(--border);
  border-radius: var(--radius); padding:0.85rem 1.25rem; margin-top:0.75rem;
  font-size:0.875rem; flex-wrap:wrap; gap:0.75rem;
}

/* ── SOCRATIC CHATBOT TOGGLE ─────────────────────────────────── */
.socratic-toggle-wrapper { display: flex; align-items: center; gap: 0.5rem; background: rgba(0,0,0,0.2); padding: 0.35rem 0.75rem; border-radius: 999px; border: 1px solid var(--border2); }
.socratic-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); transition: color var(--transition); }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 34px; border: 1px solid var(--border); }
.switch .slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 2px; bottom: 2px; background-color: var(--text-muted); transition: .4s; border-radius: 50%; }
.switch input:checked + .slider { background-color: rgba(45,212,191,0.2); border-color: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(16px); background-color: var(--primary); }

/* ── WORKSPACE SPLIT LAYOUT ──────────────────────────────────── */
.workspace-split {
  display: flex; gap: 1.5rem; padding: 0 1.5rem 1.5rem;
  width: 100%; max-width: none; margin: 0 auto; height: calc(100vh - 110px);
  position: relative;
}

/* Panel Triggers */
.panel-trigger {
  position: absolute; top: 0; bottom: 1.5rem; width: 40px;
  display: flex; justify-content: center; padding-top: 1rem;
  cursor: pointer; z-index: 40; transition: background 0.3s ease;
  background: transparent;
}
.panel-trigger:hover { background: rgba(59, 130, 246, 0.05); }
.left-trigger { left: 0; }
.right-trigger { right: 0; }
.trigger-icon {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); font-size: 1.1rem;
}

/* Base Panel Styles */
.sidebar-nav, .right-pane {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow-y: auto; overflow-x: hidden; box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
}
.sidebar-nav::-webkit-scrollbar, .right-pane::-webkit-scrollbar { width: 6px; }

/* Panel Header */
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1rem 0; margin-bottom: -0.5rem;
}
.panel-title { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }
.icon-btn {
  background: transparent; border: none; color: var(--text-muted); padding: 0.4rem;
  border-radius: 6px; cursor: pointer; transition: all 0.2s; font-size: 0.8rem;
}
.icon-btn:hover { background: var(--bg); color: var(--primary); }

/* Left Sidebar States */
.sidebar-nav.locked { position: relative; width: 220px; flex-shrink: 0; opacity: 1; margin-left: 0; }
.sidebar-nav.collapsed { width: 0; padding: 0; opacity: 0; border: none; margin-left: -1.5rem; pointer-events: none; }
.sidebar-nav.overlay {
  position: absolute; left: 1.5rem; top: 0; bottom: 1.5rem; z-index: 50;
  width: 220px; opacity: 1; box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

/* Middle Pane (PDF Viewer) */
.left-pane {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow); transition: all 0.3s ease;
}
.pdf-header {
  padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border);
  background: var(--surface2); font-weight: 600; font-size: 0.9rem;
  display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted);
}
.left-pane iframe { flex: 1; width: 100%; height: 100%; border: none; background: transparent; min-height: 500px; }

/* Right Pane States */
.right-pane.locked { position: relative; flex: 1; max-width: 550px; opacity: 1; }
.right-pane.collapsed { width: 0; padding: 0; opacity: 0; border: none; max-width: 0; flex: 0; min-width: 0; margin-right: -1.5rem; pointer-events: none; }
.right-pane.overlay {
  position: absolute; right: 1.5rem; top: 0; bottom: 1.5rem; z-index: 50;
  width: 550px; max-width: 90%; opacity: 1; box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  padding: 1rem 1.5rem; /* maintain app-container padding */
}
@media (max-width: 1024px) {
  .workspace-split { flex-direction: column; height: auto; }
  .sidebar-nav { width: 100%; }
  .app-nav { flex-direction: row; flex-wrap: wrap; padding-top: 0; }
  .nav-tab { flex: 1; text-align: center; justify-content: center; }
  .left-pane { max-width: none; height: 600px; min-width: 0; }
  .right-pane { overflow-y: visible; }
}

/* Force Mobile View Mode */
body.force-mobile .workspace-split { flex-direction: column; height: auto; }
body.force-mobile .sidebar-nav { width: 100%; }
body.force-mobile .app-nav { flex-direction: row; flex-wrap: wrap; padding-top: 0; }
body.force-mobile .nav-tab { flex: 1; text-align: center; justify-content: center; }
body.force-mobile .left-pane { max-width: none; height: 600px; min-width: 0; }
body.force-mobile .right-pane { overflow-y: visible; }



/* TOGGLE BUTTONS */
.theme-toggle-btn, .device-toggle-btn {
  position: absolute; top: 1.5rem;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 50%;
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; cursor: pointer; transition: all var(--transition);
  box-shadow: var(--shadow); z-index: 100;
}
.theme-toggle-btn { right: 1.5rem; }
.device-toggle-btn { left: 1.5rem; }

.theme-toggle-btn:hover, .device-toggle-btn:hover { background: var(--primary-glow); transform: scale(1.05); }

/* MERMAID & CHEAT SHEET */
.mermaid-container {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; min-height: 400px; display: flex; align-items: center; justify-content: center;
  overflow: auto;
}
.mermaid-container svg { max-width: 100%; height: auto; }

/* Cheat sheet hidden export template */
#print-template {
  display: none; padding: 40px; background: white; color: #111; font-family: sans-serif;
}

/* DOCX VIEWER */
.docx-viewer {
  flex: 1; overflow-y: auto; padding: 2.5rem 3rem; background: var(--surface2);
  color: var(--text); line-height: 1.6; word-wrap: break-word; font-family: var(--font2); font-size: 0.95rem;
}
.docx-viewer h1, .docx-viewer h2, .docx-viewer h3 { margin-top: 1.5rem; margin-bottom: 0.75rem; color: var(--primary); font-weight: 700; }
.docx-viewer p { margin-bottom: 1rem; }
.docx-viewer ul, .docx-viewer ol { padding-left: 20px; margin-bottom: 1rem; }
.docx-viewer table { border-collapse: collapse; width: 100%; margin-bottom: 1rem; }
.docx-viewer td, .docx-viewer th { border: 1px solid var(--border); padding: 0.5rem; }

/* DOC LIST */
.doc-list-item {
  background: var(--surface2); padding: 0.75rem; border-radius: var(--radius);
  margin-bottom: 0.5rem; display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--border); font-size: 0.9rem;
}
.doc-list-badge {
  background: var(--primary-glow); color: var(--primary); padding: 0.2rem 0.5rem;
  border-radius: 4px; font-size: 0.75rem; font-weight: bold; margin-left: 0.5rem;
}
