/* Williams Education Training Portal – Custom Styles */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: #f8fafc; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Layout ── */
#app { min-height: 100vh; }

.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #1e3a8a 0%, #1d4ed8 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.1rem; font-weight: 700; color: white; text-decoration: none;
}
.sidebar-logo i { font-size: 1.4rem; color: #fbbf24; }

.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-section { padding: 8px 20px 4px; font-size: 0.65rem; font-weight: 600; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.08em; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.15s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(255,255,255,0.15); color: white; font-weight: 600; border-right: 3px solid #fbbf24; }
.nav-item i { width: 18px; text-align: center; font-size: 0.9rem; }
.nav-badge { margin-left: auto; background: #ef4444; color: white; font-size: 0.65rem; font-weight: 700; padding: 1px 6px; border-radius: 10px; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.12); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #3b82f6; display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; font-size: 0.85rem; flex-shrink: 0; }
.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 0.82rem; font-weight: 600; color: white; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 0.7rem; color: rgba(255,255,255,0.55); text-transform: capitalize; }

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; color: #1e293b; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { flex: 1; padding: 28px 28px 40px; width: 100%; min-width: 0; box-sizing: border-box; }

/* ── Cards ── */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); }
.card-header { padding: 18px 20px; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 0.95rem; font-weight: 700; color: #1e293b; }
.card-body { padding: 20px; }

/* ── Stat cards ── */
.stat-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: #1e293b; line-height: 1; }
.stat-label { font-size: 0.78rem; color: #64748b; margin-top: 2px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: white; }
.btn-warning:hover { background: #d97706; }
.btn-ghost { background: transparent; color: #64748b; border: 1px solid #e2e8f0; }
.btn-ghost:hover { background: #f8fafc; color: #1e293b; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 0.72rem; border-radius: 5px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: #374151; margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #1e293b;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-textarea { min-height: 100px; resize: vertical; font-family: inherit; }
.form-hint { font-size: 0.75rem; color: #9ca3af; margin-top: 3px; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.855rem; }
thead th { background: #f8fafc; padding: 10px 14px; text-align: left; font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid #e2e8f0; }
tbody td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ── Progress bars ── */
.progress-bar { background: #e2e8f0; border-radius: 20px; height: 8px; overflow: hidden; }
.progress-fill { background: linear-gradient(90deg, #2563eb, #3b82f6); height: 100%; border-radius: 20px; transition: width 0.4s ease; }
.progress-fill.green { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-fill.yellow { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

/* ── Module cards ── */
.module-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  transition: all 0.2s;
  cursor: pointer;
}
.module-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); border-color: #bfdbfe; }
.module-card-cover { height: 120px; background: linear-gradient(135deg, #1e3a8a, #3b82f6); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: rgba(255,255,255,0.7); }
.module-card-body { padding: 16px; }
.module-card-title { font-size: 0.95rem; font-weight: 700; color: #1e293b; margin-bottom: 6px; line-height: 1.3; }
.module-card-desc { font-size: 0.78rem; color: #64748b; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px; }
.module-card-meta { display: flex; gap: 12px; font-size: 0.75rem; color: #94a3b8; }

/* ── Lesson viewer ── */
.lesson-content { line-height: 1.75; color: #334155; }
.lesson-content h1, .lesson-content h2 { color: #1e293b; font-weight: 700; margin: 1.5em 0 0.5em; }
.lesson-content h2 { font-size: 1.2rem; border-bottom: 2px solid #e2e8f0; padding-bottom: 6px; }
.lesson-content h3 { font-size: 1rem; color: #1d4ed8; margin: 1.2em 0 0.4em; }
.lesson-content p { margin: 0.8em 0; }
.lesson-content ul, .lesson-content ol { padding-left: 1.5em; margin: 0.8em 0; }
.lesson-content li { margin: 0.3em 0; }
.lesson-content table { border-collapse: collapse; margin: 1em 0; width: auto; }
.lesson-content table th, .lesson-content table td { border: 1px solid #e2e8f0; padding: 8px 12px; }
.lesson-content table th { background: #f8fafc; font-weight: 700; }
.lesson-content strong { color: #1d4ed8; }
.lesson-content code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.88em; }
.lesson-content iframe { width: 100%; height: 450px; border: none; border-radius: 8px; margin: 1em 0; }

/* ── Quiz ── */
.quiz-question { background: white; border-radius: 10px; border: 1px solid #e2e8f0; padding: 20px; margin-bottom: 16px; }
.quiz-question-text { font-size: 0.95rem; font-weight: 600; color: #1e293b; margin-bottom: 14px; }
.quiz-option { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 2px solid #e2e8f0; border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: all 0.15s; }
.quiz-option:hover { border-color: #93c5fd; background: #eff6ff; }
.quiz-option.selected { border-color: #2563eb; background: #eff6ff; }
.quiz-option.correct { border-color: #10b981; background: #d1fae5; }
.quiz-option.incorrect { border-color: #ef4444; background: #fee2e2; }
.quiz-option input { accent-color: #2563eb; }

/* ── Q&A ── */
.question-thread { border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.question-thread-header { padding: 14px 16px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.answer-bubble { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; display: flex; gap: 12px; }
.answer-bubble:last-child { border-bottom: none; }
.answer-bubble.admin-answer { background: #eff6ff; }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: white; border-radius: 14px; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1.05rem; font-weight: 700; color: #1e293b; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #f1f5f9; display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; font-size: 1.2rem; color: #94a3b8; cursor: pointer; }
.modal-close:hover { color: #1e293b; }

/* ── Login page ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #3b82f6 100%); }
.login-card { background: white; border-radius: 20px; padding: 48px 40px; width: 100%; max-width: 420px; text-align: center; box-shadow: 0 24px 64px rgba(0,0,0,0.25); }
.login-logo { font-size: 3rem; color: #2563eb; margin-bottom: 8px; }
.login-title { font-size: 1.5rem; font-weight: 800; color: #1e293b; margin-bottom: 4px; }
.login-subtitle { color: #64748b; font-size: 0.9rem; margin-bottom: 32px; }

/* ── Alert/Toast ── */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 200;
  padding: 12px 20px;
  border-radius: 10px;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transform: translateX(110%);
  transition: transform 0.3s ease;
  max-width: 360px;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { transform: translateX(0); }
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.info { background: #2563eb; }
.toast.warning { background: #f59e0b; }

/* ── Rich text editor ── */
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: #f8fafc; border: 1px solid #e2e8f0; border-bottom: none; border-radius: 8px 8px 0 0; }
.editor-btn { padding: 4px 10px; border: 1px solid #e2e8f0; border-radius: 5px; background: white; cursor: pointer; font-size: 0.8rem; font-weight: 600; color: #374151; }
.editor-btn:hover { background: #e2e8f0; }
.editor-area { border: 1px solid #e2e8f0; border-radius: 0 0 8px 8px; min-height: 200px; padding: 12px; outline: none; font-size: 0.88rem; line-height: 1.6; }
.editor-area:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .stat-card { flex-direction: column; text-align: center; }
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.25s ease forwards; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 0.8s linear infinite; }

/* ── Empty states ── */
.empty-state { text-align: center; padding: 60px 20px; color: #94a3b8; }
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: #64748b; margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; }

/* ── Sidebar toggle ── */
.sidebar-toggle { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #64748b; }
@media (max-width: 768px) { .sidebar-toggle { display: block; } }

/* ── WhatsApp button ── */
.whatsapp-btn { background: #25d366; color: white; }
.whatsapp-btn:hover { background: #128c7e; }

/* ── Content type icons ── */
.content-type-text { color: #3b82f6; }
.content-type-video { color: #ef4444; }
.content-type-pdf { color: #f59e0b; }
.content-type-image { color: #10b981; }
.content-type-embed { color: #8b5cf6; }

/* ── Rich content preview ── */
.video-wrapper { position: relative; padding-top: 56.25%; background: #000; border-radius: 8px; overflow: hidden; margin: 12px 0; }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* ── Block-based lesson editor ── */
.lesson-editor-canvas {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-block-wrapper {
  position: relative;
}

.lesson-block-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lesson-block-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 12px rgba(37,99,235,0.08);
}

.lesson-block-card:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.lesson-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  gap: 8px;
}

.lesson-block-type-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lesson-block-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.block-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: white;
  color: #64748b;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.12s;
  padding: 0;
}

.block-action-btn:hover { background: #f1f5f9; color: #1e293b; border-color: #cbd5e1; }
.block-action-btn.danger:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

.lesson-block-body {
  padding: 12px;
}

/* Text block: editor-area inherits existing .editor-area styles but scoped per block */
.block-text-editor {
  border-radius: 0 0 8px 8px;
  min-height: 140px;
}

/* URL / media blocks */
.block-url-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.block-media-preview {
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
}

.block-media-preview img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.block-media-preview .video-wrapper {
  margin: 0;
}

/* Add-block bar */
.add-block-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 2px dashed #e2e8f0;
  border-radius: 10px;
  flex-wrap: wrap;
}

.add-block-bar span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}

.add-block-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  background: white;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all 0.12s;
}
.add-block-btn:hover { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }

/* Lesson viewer: multi-block rendering */
.lesson-blocks-viewer {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lesson-block-view {
  /* Individual block in viewer */
}

.lesson-block-view + .lesson-block-view {
  padding-top: 4px;
  border-top: 1px solid #f1f5f9;
}

/* Drag handle (future enhancement placeholder) */
.drag-handle {
  cursor: grab;
  color: #cbd5e1;
  padding: 0 4px;
  font-size: 0.9rem;
}
.drag-handle:active { cursor: grabbing; }

/* ── Video block: tab switcher ── */
.block-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 12px;
}

.block-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all 0.15s;
}
.block-tab-btn:hover { color: #1e293b; background: #f8fafc; }
.block-tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; }

/* ── Upload dropzone ── */
.block-upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 32px 20px;
  border: 2px dashed #bfdbfe;
  border-radius: 10px;
  background: #f0f7ff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.block-upload-dropzone:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

/* ── Upload success banner ── */
.block-upload-success {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* ── Upload progress bar lives inside .progress-bar/.progress-fill (reused) ── */
.upload-filename { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Video viewer (HTML5) in lesson page ── */
.lesson-video-player {
  width: 100%;
  border-radius: 8px;
  background: #000;
  display: block;
  max-height: 480px;
}

/* ── Drag-and-drop states ── */
.lesson-block-wrapper.dragging { opacity: 0.4; }
.lesson-block-wrapper.drag-over .lesson-block-card {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}
.lesson-sort-row.drag-over {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* ── Font selector in editor toolbar ── */
.editor-font-select {
  padding: 3px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: white;
  font-size: 0.78rem;
  color: #374151;
  cursor: pointer;
  height: 28px;
}
.editor-font-select:hover { border-color: #93c5fd; }

/* ── Lesson content lists (ensure bullets render) ── */
.lesson-content ul,
.lesson-block-view ul {
  list-style: disc;
  margin: 8px 0 8px 24px;
  padding: 0;
}
.lesson-content ol,
.lesson-block-view ol {
  list-style: decimal;
  margin: 8px 0 8px 24px;
  padding: 0;
}
.lesson-content li,
.lesson-block-view li {
  margin-bottom: 4px;
  line-height: 1.6;
}
/* Also fix lists inside the editor area */
.block-text-editor ul { list-style: disc; margin: 6px 0 6px 20px; }
.block-text-editor ol { list-style: decimal; margin: 6px 0 6px 20px; }
.block-text-editor li { margin-bottom: 2px; }

/* ── Multi-page lesson navigation ── */
.lesson-page-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}
.lesson-page-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
  background: white;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.12s;
}
.lesson-page-dot:hover { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.lesson-page-dot.active {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
}
.lesson-page-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

/* ── Page-break block in editor ── */
.lesson-page-break-card .lesson-block-header {
  background: transparent;
  border-bottom: none;
}

/* ── Badge system ── */
@keyframes badge-pop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
.badge-earned-img {
  animation: badge-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Admin module grid ── */
.main-content { overflow-x: hidden; }

.admin-module-group {
  margin-bottom: 32px;
  width: 100%;
}

.admin-module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.admin-module-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

@media (max-width: 1100px) {
  .admin-module-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .admin-module-grid { grid-template-columns: 1fr; }
}

/* ── Lesson editor page sections ── */
.editor-page-section {
  margin-bottom: 4px;
}

.editor-page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 6px;
}

.editor-page-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.editor-page-blocks {
  padding: 4px 0;
  min-height: 40px;
}

/* Page-break divider */
.page-break-wrapper {
  margin: 8px 0;
}

.editor-page-break-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.editor-page-break-line {
  flex: 1;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    #cbd5e1 0, #cbd5e1 8px,
    transparent 8px, transparent 16px
  );
  border-radius: 2px;
}

.editor-page-break-label {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 5px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.editor-page-break-remove {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: #ef4444;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  transition: background 0.1s;
}
.editor-page-break-remove:hover { background: #fee2e2; }
