/* -------------------------------------------------------------
   ProfessorAI - Custom Stylesheet
   Designed for premium academics, RTL, and beautiful animations
------------------------------------------------------------- */

/* Theme Variables */
:root {
  /* Font Families */
  --font-primary: 'Rubik', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-academic: 'Outfit', 'Rubik', serif;
  
  /* Layout Dimensions */
  --sidebar-width: 280px;
  --header-height: 80px;
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 24px;
  
  /* Color Palette - Dark Theme Default */
  --bg-primary: #0a0c10;
  --bg-secondary: #111420;
  --bg-card: rgba(22, 28, 45, 0.65);
  --bg-card-hover: rgba(30, 38, 60, 0.85);
  --bg-input: #171d30;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --color-gold: #d4af37;
  --color-gold-hover: #f3cf58;
  --color-gold-glow: rgba(212, 175, 55, 0.18);
  
  --color-blue: #3b82f6;
  --color-blue-glow: rgba(59, 130, 246, 0.2);
  
  --color-green: #10b981;
  --color-green-glow: rgba(16, 185, 129, 0.15);
  
  --color-red: #ef4444;
  --color-red-glow: rgba(239, 68, 68, 0.15);
  
  --border-color: rgba(255, 255, 255, 0.06);
  --border-color-hover: rgba(255, 255, 255, 0.12);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  
  --backdrop-blur: blur(12px);
  --transition-speed: 0.3s;
}

/* Light Theme overrides */
body.light-theme {
  --bg-primary: #f4f6fb;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-input: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --color-gold: #b28913;
  --color-gold-hover: #d4af37;
  --color-gold-glow: rgba(178, 137, 19, 0.1);
  
  --color-blue: #2563eb;
  --color-blue-glow: rgba(37, 99, 235, 0.1);
  
  --color-green: #059669;
  --color-green-glow: rgba(5, 150, 105, 0.1);
  
  --color-red: #dc2626;
  --color-red-glow: rgba(220, 38, 38, 0.1);
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(0, 0, 0, 0.14);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-speed), color var(--transition-speed);
  display: flex;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-academic);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

a {
  color: inherit;
  text-decoration: none;
}

/* App Container Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* -------------------------------------------------------------
   Sidebar Styles (Right in RTL)
------------------------------------------------------------- */
.app-sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
  transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 8px var(--color-gold));
}

.logo-text h2 {
  font-size: 1.35rem;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--color-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-top: 1px;
}

.sidebar-nav {
  flex-grow: 1;
  padding: 24px 12px;
  overflow-y: auto;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all var(--transition-speed) ease;
  position: relative;
}

.sidebar-nav a i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar-nav li:not(.disabled):hover a {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  padding-right: 20px;
}

.sidebar-nav li.active a {
  color: var(--color-gold);
  background-color: var(--color-gold-glow);
  font-weight: 600;
}

.sidebar-nav li.active a::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 4px;
  background-color: var(--color-gold);
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
  box-shadow: 0 0 10px var(--color-gold);
}

.sidebar-nav li.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sidebar-nav li.disabled a {
  pointer-events: none;
}

.sidebar-status-card {
  margin: 16px;
  padding: 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  font-size: 0.85rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-red);
  box-shadow: 0 0 6px var(--color-red);
}

.status-dot.connected {
  background-color: var(--color-green);
  box-shadow: 0 0 6px var(--color-green);
}

.status-text {
  font-weight: 600;
}

.active-doc-info {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.settings-btn {
  width: 100%;
  padding: 12px;
  background-color: transparent;
  border: 1px dashed var(--color-gold);
  border-radius: var(--border-radius-sm);
  color: var(--color-gold);
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-speed) ease;
}

.settings-btn:hover {
  background-color: var(--color-gold-glow);
  color: var(--color-gold-hover);
  border-style: solid;
}

/* -------------------------------------------------------------
   Main Content Layout
------------------------------------------------------------- */
.app-main {
  flex-grow: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-primary);
  transition: background-color var(--transition-speed);
}

.app-header {
  height: var(--header-height);
  padding: 0 40px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  transition: border-color var(--transition-speed);
}

.header-welcome h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.professor-quote {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-speed) ease;
}

.theme-toggle:hover {
  background-color: var(--bg-secondary);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.theme-toggle .icon-sun {
  display: none;
}

body.light-theme .theme-toggle .icon-moon {
  display: none;
}

body.light-theme .theme-toggle .icon-sun {
  display: block;
}

/* Tab Content */
.tab-content {
  flex-grow: 1;
  padding: 40px;
  overflow-y: auto;
  position: relative;
}

.tab-panel {
  display: none;
  height: 100%;
  animation: fadeIn var(--transition-speed) ease forwards;
}

.tab-panel.active {
  display: block;
}

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

/* -------------------------------------------------------------
   Components: Cards, Buttons & Forms
------------------------------------------------------------- */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 28px;
  backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-speed) ease;
  position: relative;
}

.card:hover {
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-lg);
}

.card-header {
  margin-bottom: 24px;
}

.card-header h3 {
  font-size: 1.35rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header h3 i {
  color: var(--color-gold);
}

.card-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.btn {
  font-family: var(--font-primary);
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.95rem;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background-color: var(--color-gold);
  color: #000;
  box-shadow: 0 4px 12px var(--color-gold-glow);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-gold-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(212, 175, 55, 0.35);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-secondary);
  border-color: var(--text-secondary);
}

.btn-danger {
  background-color: var(--color-red-glow);
  color: var(--color-red);
  border: 1px solid var(--color-red);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--color-red);
  color: #fff;
  box-shadow: 0 4px 12px var(--color-red-glow);
}

.btn-success {
  background-color: var(--color-green-glow);
  color: var(--color-green);
  border: 1px solid var(--color-green);
}

.btn-success:hover:not(:disabled) {
  background-color: var(--color-green);
  color: #fff;
  box-shadow: 0 4px 12px var(--color-green-glow);
}

.btn-large {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: var(--border-radius-sm);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.95rem;
}

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  transition: all var(--transition-speed) ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px var(--color-gold-glow);
}

/* -------------------------------------------------------------
   Tab 1: Library & Uploader CSS
------------------------------------------------------------- */
.grid-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 30px;
  height: auto;
}

.main-upload-card {
  display: flex;
  flex-direction: column;
}

.upload-drag-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.01);
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-drag-zone.dragover {
  border-color: var(--color-gold);
  background-color: var(--color-gold-glow);
  transform: scale(0.99);
}

.upload-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.upload-icon-pulse {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background-color: rgba(212, 175, 55, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--color-gold);
  transition: all var(--transition-speed) ease;
}

.upload-drag-zone:hover .upload-icon-pulse {
  background-color: var(--color-gold-glow);
  transform: scale(1.08);
}

.upload-zone-content h4 {
  font-size: 1.15rem;
  font-weight: 600;
}

.upload-zone-content p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.paste-text-wrapper {
  margin-bottom: 24px;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 20px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.divider:not(:empty)::before {
  margin-left: .5em;
}

.divider:not(:empty)::after {
  margin-right: .5em;
}

.upload-actions {
  display: flex;
  justify-content: flex-end;
}

/* Library Sidebar Files List */
.stats-docs-card {
  display: flex;
  flex-direction: column;
  max-height: 650px;
}

.docs-list-container {
  flex-grow: 1;
  overflow-y: auto;
  margin: 16px 0;
  max-height: 380px;
}

.docs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-speed) ease;
  cursor: pointer;
}

.doc-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: var(--color-gold-glow);
}

.doc-item.active {
  border-color: var(--color-gold);
  background-color: var(--color-gold-glow);
}

.doc-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.doc-icon {
  font-size: 1.4rem;
  color: var(--color-gold);
}

.doc-name {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-size {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.doc-actions {
  display: flex;
  gap: 8px;
}

.doc-action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.95rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
}

.doc-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--color-red);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  text-align: center;
  gap: 12px;
}

.empty-state i {
  font-size: 2.2rem;
  color: var(--text-muted);
}

.card-footer-tip {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.text-gold {
  color: var(--color-gold);
}

/* -------------------------------------------------------------
   Tab 2: Summaries & Explanations CSS
------------------------------------------------------------- */
.summary-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 30px;
  align-items: start;
}

.outline-card {
  padding: 16px;
}

.outline-card h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.outline-list {
  list-style: none;
}

.outline-list li {
  padding: 12px 14px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.outline-list li:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

.outline-list li.active {
  color: var(--color-gold);
  background-color: var(--color-gold-glow);
  font-weight: 600;
}

.summary-display-card {
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.summary-header h2 {
  font-size: 1.6rem;
  color: var(--text-primary);
}

.summary-section-content {
  display: none;
  animation: fadeIn var(--transition-speed) ease forwards;
}

.summary-section-content.active {
  display: block;
}

.academic-quote-block {
  padding: 16px 20px;
  background-color: rgba(255, 255, 255, 0.01);
  border-right: 4px solid var(--color-gold);
  margin-bottom: 24px;
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.academic-quote {
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Markdown Rendering Custom Styles */
.markdown-body {
  line-height: 1.7;
  font-size: 1.05rem;
}

.markdown-body h2 {
  font-size: 1.4rem;
  margin: 28px 0 14px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
  color: var(--text-primary);
}

.markdown-body h3 {
  font-size: 1.15rem;
  margin: 20px 0 10px;
  color: var(--text-primary);
}

.markdown-body p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.markdown-body ul,
.markdown-body ol {
  margin-bottom: 20px;
  padding-right: 24px;
}

.markdown-body li {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* Term explainer trigger on text hover selection */
.markdown-body span.highlight-term {
  border-bottom: 2px dotted var(--color-gold);
  cursor: help;
  transition: background-color var(--transition-speed);
  padding: 0 2px;
}

.markdown-body span.highlight-term:hover {
  background-color: var(--color-gold-glow);
  color: var(--color-gold-hover);
}

/* Concepts Grid */
.concepts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.concept-card {
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 20px;
  transition: all var(--transition-speed) ease;
}

.concept-card:hover {
  border-color: var(--color-gold-glow);
  transform: translateY(-2px);
}

.concept-card h4 {
  font-size: 1.1rem;
  color: var(--color-gold);
  margin-bottom: 8px;
}

.concept-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* -------------------------------------------------------------
   Tab 3: Flashcards CSS
------------------------------------------------------------- */
.flashcards-wrapper {
  max-width: 700px;
  margin: 0 auto;
}

.flashcard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flashcard-deck-selector select {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.flashcard-stage {
  height: 320px;
  perspective: 1000px;
  margin: 30px 0;
  position: relative;
}

.flashcard-container {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.flashcard-container.flipped .flashcard {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius-md);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.flashcard-front {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.flashcard-back {
  background-color: var(--bg-input);
  transform: rotateY(180deg);
  border-color: var(--color-gold-glow);
}

.card-category {
  position: absolute;
  top: 24px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--color-gold);
  border: 1px solid var(--color-gold-glow);
  padding: 4px 10px;
  border-radius: 20px;
}

.card-text {
  font-family: var(--font-academic);
  font-size: 1.6rem;
  line-height: 1.4;
  margin: 16px 0;
}

.flashcard-back .card-text {
  font-size: 1.25rem;
  font-family: var(--font-primary);
  font-weight: normal;
  color: var(--text-secondary);
  overflow-y: auto;
  max-height: 140px;
}

.card-hint {
  position: absolute;
  bottom: 24px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-mnemonic-box {
  background-color: rgba(212, 175, 55, 0.04);
  border: 1px dashed var(--color-gold);
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-top: 10px;
  width: 100%;
  max-width: 480px;
}

/* Controls & progress */
.flashcard-controls-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.flashcard-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.flashcard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-gold) 0%, var(--color-gold-hover) 100%);
  transition: width 0.4s ease;
}

.flashcard-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.flashcard-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.mastery-decisions {
  display: flex;
  gap: 10px;
}

.btn-mastery {
  padding: 12px 24px;
  font-weight: 700;
}

/* -------------------------------------------------------------
   Tab 4: Quiz CSS
------------------------------------------------------------- */
.quiz-wrapper {
  max-width: 750px;
  margin: 0 auto;
}

.quiz-header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.quiz-info-block h3 {
  font-size: 1.35rem;
  margin-bottom: 4px;
}

.quiz-score-badge {
  background-color: var(--color-blue-glow);
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.quiz-score-badge strong {
  font-size: 1.1rem;
}

.question-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progress-bar-mini {
  width: 140px;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-mini-fill {
  height: 100%;
  background-color: var(--color-blue);
  transition: width 0.3s ease;
}

.question-title {
  font-size: 1.35rem;
  line-height: 1.4;
  margin-bottom: 24px;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.quiz-option:hover {
  background-color: var(--bg-input);
  border-color: var(--border-color-hover);
}

.quiz-option.selected {
  border-color: var(--color-blue);
  background-color: var(--color-blue-glow);
}

.option-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--transition-speed) ease;
}

.quiz-option.selected .option-badge {
  background-color: var(--color-blue);
  border-color: var(--color-blue);
  color: #fff;
}

.option-text {
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Success / Incorrect option validation styles */
.quiz-option.correct {
  border-color: var(--color-green) !important;
  background-color: var(--color-green-glow) !important;
}

.quiz-option.correct .option-badge {
  background-color: var(--color-green) !important;
  border-color: var(--color-green) !important;
  color: #fff;
}

.quiz-option.incorrect {
  border-color: var(--color-red) !important;
  background-color: var(--color-red-glow) !important;
}

.quiz-option.incorrect .option-badge {
  background-color: var(--color-red) !important;
  border-color: var(--color-red) !important;
  color: #fff;
}

/* Quiz feedback panel */
.quiz-feedback-box {
  display: flex;
  gap: 16px;
  padding: 18px 22px;
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  margin-top: 24px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease;
}

.quiz-feedback-box.active {
  opacity: 1;
  transform: translateY(0);
}

.quiz-feedback-box.correct-feedback {
  border-color: var(--color-green-glow);
  background-color: rgba(16, 185, 129, 0.03);
}

.quiz-feedback-box.incorrect-feedback {
  border-color: var(--color-red-glow);
  background-color: rgba(239, 68, 68, 0.03);
}

.feedback-icon {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.feedback-content p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.quiz-actions-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

/* Quiz Finished view */
.quiz-summary-view {
  animation: fadeIn var(--transition-speed) ease forwards;
}

.summary-trophy {
  font-size: 3.8rem;
  display: block;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 10px var(--color-gold));
}

.quiz-report-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  max-width: 450px;
  margin: 24px auto;
}

.report-stat {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

.report-stat strong {
  font-size: 1.15rem;
}

.report-comment {
  margin-top: 16px;
  padding: 14px;
  background-color: var(--bg-card);
  border-radius: var(--border-radius-sm);
  font-size: 0.88rem;
  line-height: 1.5;
  font-style: italic;
  text-align: center;
  border-right: 3px solid var(--color-gold);
}

/* -------------------------------------------------------------
   Tab 5: Exam Simulation CSS
------------------------------------------------------------- */
.exam-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

.academic-seal {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 12px;
}

.exam-settings-form {
  margin-top: 32px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-col label {
  font-size: 0.9rem;
  font-weight: 500;
}

.exam-instructions {
  background-color: rgba(59, 130, 246, 0.02);
  border: 1px dashed var(--color-blue);
  padding: 20px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 30px;
}

.exam-instructions h4 {
  color: var(--color-blue);
  margin-bottom: 8px;
}

.exam-instructions ul {
  padding-right: 20px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Active Exam View */
.exam-active-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 28px;
}

#exam-time-elapsed {
  font-size: 0.88rem;
  color: var(--color-gold);
  font-weight: 700;
  margin-top: 4px;
  font-family: var(--font-academic);
}

.exam-question-item {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 28px;
}

.exam-question-item:last-child {
  border-bottom: none;
}

.exam-q-title {
  font-size: 1.15rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.exam-footer-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}

/* Exam report view */
.exam-report-card-view {
  background-color: var(--bg-secondary);
}

.report-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
  margin-bottom: 28px;
  position: relative;
}

.academic-badge {
  position: absolute;
  top: 0;
  left: 0;
  border: 2px solid var(--color-gold);
  color: var(--color-gold);
  padding: 6px 14px;
  border-radius: var(--border-radius-sm);
  font-weight: 800;
  font-family: var(--font-academic);
  font-size: 1.15rem;
  transform: rotate(-10deg);
  box-shadow: 0 0 10px var(--color-gold-glow);
}

.exam-report-summary-box {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  margin-bottom: 32px;
}

.summary-grade-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--border-color);
  padding-left: 12px;
}

.summary-grade-section span {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.summary-grade-section strong {
  font-size: 2.2rem;
  color: var(--color-gold);
  font-family: var(--font-academic);
}

.summary-text-section h4 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.summary-text-section p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Per Question Review in Report */
.question-review-item {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 20px;
  margin-bottom: 20px;
  background-color: rgba(255, 255, 255, 0.01);
}

.q-review-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  font-weight: 600;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 8px;
}

.q-review-title {
  color: var(--text-primary);
  font-size: 1.05rem;
}

.q-review-score {
  color: var(--color-gold);
  font-family: var(--font-academic);
}

.q-review-body {
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.answer-block {
  background-color: rgba(255, 255, 255, 0.01);
  padding: 12px;
  border-radius: var(--border-radius-sm);
  border-right: 3px solid var(--text-muted);
}

.answer-block strong {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.answer-block.sample-block {
  border-right-color: var(--color-green);
}

.feedback-block {
  background-color: var(--bg-input);
  padding: 12px;
  border-radius: var(--border-radius-sm);
  border-right: 3px solid var(--color-gold);
  font-style: italic;
}

.feedback-block strong {
  display: block;
  font-size: 0.78rem;
  color: var(--color-gold);
  margin-bottom: 4px;
}

/* -------------------------------------------------------------
   Modal Overlay & Card
------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-speed) ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  width: 100%;
  max-width: 550px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(20px);
  transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}

.close-modal-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.modal-body p {
  margin-bottom: 14px;
}

.modal-info-alert {
  padding: 12px 16px;
  background-color: rgba(59, 130, 246, 0.05);
  border: 1px solid var(--color-blue);
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  font-size: 0.85rem;
}

.modal-info-alert i {
  color: var(--color-blue);
  margin-top: 3px;
}

.help-section {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  margin-top: 20px;
}

.help-section h4 {
  color: var(--text-primary);
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.help-section ol {
  padding-right: 20px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.help-section li {
  margin-bottom: 6px;
}

.help-section a {
  color: var(--color-gold);
  font-weight: 600;
  text-decoration: underline;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.1);
}

/* -------------------------------------------------------------
   Drawer Explainer CSS (Selection Drawer)
------------------------------------------------------------- */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-speed) ease;
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.explainer-drawer {
  position: fixed;
  top: 0;
  right: -450px;
  width: 450px;
  height: 100vh;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  z-index: 950;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.explainer-drawer.active {
  right: 0;
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header h3 {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-drawer-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.drawer-content {
  flex-grow: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.selected-text-box {
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 14px;
}

.selected-text-box span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.selected-text-box blockquote {
  font-size: 0.9rem;
  color: var(--text-primary);
  border-right: 3px solid var(--color-gold);
  padding-right: 10px;
  line-height: 1.5;
}

.explanation-box {
  flex-grow: 1;
  position: relative;
}

.drawer-loader {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  gap: 16px;
  color: var(--text-secondary);
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--color-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* -------------------------------------------------------------
   Toasts & Utilities
------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--border-radius-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.toast-success {
  border-right: 4px solid var(--color-green);
}

.toast.toast-success i {
  color: var(--color-green);
}

.toast.toast-error {
  border-right: 4px solid var(--color-red);
}

.toast.toast-error i {
  color: var(--color-red);
}

.toast.toast-info {
  border-right: 4px solid var(--color-blue);
}

.toast.toast-info i {
  color: var(--color-blue);
}

.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.text-center { text-align: center; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .grid-layout {
    grid-template-columns: 1fr;
  }
  .summary-layout {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100%;
    height: auto;
    border-left: none;
    border-bottom: 1px solid var(--border-color);
  }
  .app-header {
    padding: 0 20px;
  }
  .tab-content {
    padding: 20px;
  }
  .explainer-drawer {
    width: 100%;
    right: -100%;
  }
}

/* -------------------------------------------------------------
   Bloom's Taxonomy badge on quiz questions
------------------------------------------------------------- */
.bloom-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}
.bloom-badge.bloom-recall { color: #60a5fa; border-color: rgba(96, 165, 250, 0.4); background: rgba(59, 130, 246, 0.1); }
.bloom-badge.bloom-application { color: var(--color-gold); border-color: rgba(212, 175, 55, 0.4); background: var(--color-gold-glow); }
.bloom-badge.bloom-analysis { color: #34d399; border-color: rgba(52, 211, 153, 0.4); background: rgba(16, 185, 129, 0.12); }

/* -------------------------------------------------------------
   Weakness Diagnosis report (quiz summary)
------------------------------------------------------------- */
.weakness-report {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background: var(--bg-card);
  text-align: right;
}
.weakness-report h4 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}
.weakness-intro, .weakness-clear {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 16px;
}
.weakness-row {
  margin-bottom: 14px;
}
.weakness-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 12px;
}
.weakness-topic {
  font-weight: 600;
  color: var(--text-primary);
}
.weakness-rate {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.weakness-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.weakness-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.weakness-row.high .weakness-bar-fill { background: var(--color-red); }
.weakness-row.mid .weakness-bar-fill { background: var(--color-gold); }
.weakness-row.low .weakness-bar-fill { background: var(--color-green); }
.weakness-advice {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Keep MathJax formulas readable inside RTL content */
mjx-container { direction: ltr; }

/* -------------------------------------------------------------
   AI Tutor Chat
------------------------------------------------------------- */
.tutor-wrapper { max-width: 900px; margin: 0 auto; }
.tutor-card { display: flex; flex-direction: column; height: calc(100vh - 200px); min-height: 480px; }
.tutor-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px 4px; display: flex; flex-direction: column; gap: 14px;
}
.chat-bubble {
  max-width: 82%; padding: 12px 16px; border-radius: 16px; line-height: 1.6;
  font-size: 0.95rem; word-wrap: break-word; animation: fadeIn 0.25s ease;
}
.chat-bubble.chat-user {
  align-self: flex-start; background: var(--color-gold-glow); border: 1px solid rgba(212,175,55,0.3);
  color: var(--text-primary); border-bottom-right-radius: 4px;
}
.chat-bubble.chat-model {
  align-self: flex-end; background: var(--bg-input); border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}
.chat-bubble.chat-model h3, .chat-bubble.chat-model h4 { margin: 6px 0; font-size: 1rem; }
.chat-bubble.chat-model p { margin: 6px 0; }
.chat-bubble.chat-model ul, .chat-bubble.chat-model ol { margin: 6px 0; padding-right: 20px; }
.chat-typing { display: flex; gap: 5px; align-items: center; }
.chat-typing span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted);
  animation: chatBlink 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatBlink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
.chat-input-row {
  display: flex; gap: 10px; align-items: flex-end; padding-top: 12px;
  border-top: 1px solid var(--border-color);
}
.chat-input-row textarea {
  flex: 1; resize: none; max-height: 140px; padding: 12px 14px; border-radius: 12px;
  background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-primary);
  font-family: inherit; font-size: 0.95rem; line-height: 1.5;
}
.chat-input-row .btn { padding: 12px 18px; }

/* Record lecture */
.record-lecture-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.record-status { font-size: 0.85rem; color: var(--color-red); font-weight: 600; }
#record-lecture-btn.recording { background: var(--color-red); color: #fff; border-color: var(--color-red); }

/* -------------------------------------------------------------
   Progress dashboard + Study plan
------------------------------------------------------------- */
.progress-wrapper { display: flex; flex-direction: column; gap: 20px; max-width: 1000px; margin: 0 auto; }
.progress-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 16px;
}
.progress-stat-card {
  text-align: center; padding: 18px 12px; border-radius: var(--border-radius-md);
  background: var(--bg-input); border: 1px solid var(--border-color);
}
.progress-stat-card i { font-size: 1.5rem; margin-bottom: 8px; }
.progress-stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text-primary); }
.progress-stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }
.progress-weakness h4 { margin: 8px 0 12px; }

.plan-form { margin-bottom: 16px; }
.plan-form .form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.plan-form .form-col { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 6px; }
.plan-form input, .plan-form select {
  padding: 10px 12px; border-radius: 10px; background: var(--bg-input);
  border: 1px solid var(--border-color); color: var(--text-primary); font-family: inherit;
}
.plan-days { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.plan-day {
  padding: 14px 16px; border-radius: var(--border-radius-md);
  background: var(--bg-input); border: 1px solid var(--border-color);
}
.plan-day-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.plan-day-num {
  font-weight: 700; color: var(--color-gold); background: var(--color-gold-glow);
  padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; white-space: nowrap;
}
.plan-day-title { font-weight: 600; }
.plan-day-focus { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 6px; }
.plan-day ul { margin: 4px 0 0; padding-right: 20px; }
.plan-day li { margin: 3px 0; line-height: 1.5; }
.plan-tip {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--border-radius-md);
  background: var(--color-gold-glow); border: 1px solid rgba(212,175,55,0.3); line-height: 1.6;
}

.quiz-end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* -------------------------------------------------------------
   Login Screen (PRO auth gate)
------------------------------------------------------------- */
.login-screen {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(212,175,55,0.12), transparent), var(--bg-primary);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--bg-card); backdrop-filter: blur(12px);
  border: 1px solid var(--border-color); border-radius: var(--border-radius-lg);
  padding: 36px 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); text-align: center;
}
.login-brand .logo-icon { font-size: 2.6rem; }
.login-brand h1 { margin: 10px 0 2px; font-size: 1.8rem; color: var(--text-primary); }
.login-brand p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 22px; }
.login-form-box { text-align: right; display: flex; flex-direction: column; gap: 6px; }
.login-form-box label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 8px; }
.login-form-box input {
  padding: 12px 14px; border-radius: 12px; background: var(--bg-input);
  border: 1px solid var(--border-color); color: var(--text-primary); font-family: inherit; font-size: 1rem;
}
.login-form-box .btn { margin-top: 18px; }
.login-error { color: var(--color-red); font-size: 0.85rem; min-height: 18px; margin-top: 6px; }
.login-help { margin-top: 18px; font-size: 0.8rem; color: var(--text-muted); }

/* -------------------------------------------------------------
   Combined (multi-file) study bar + selection checkbox
------------------------------------------------------------- */
.combined-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px; border: 1px dashed var(--border-color);
  border-radius: 12px; background: rgba(212,175,55,0.06);
}
.combined-bar-info { font-size: 0.85rem; color: var(--text-secondary); }
.combined-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-select {
  width: 18px; height: 18px; accent-color: var(--color-gold); cursor: pointer; flex-shrink: 0; margin-left: 4px;
}
.doc-item-meta { display: flex; align-items: center; gap: 8px; }
