/* =========================================================================
   SCORM Studio — Rise-360-inspired design system
   Pure CSS, light theme, emerald/teal + amber palette (no indigo/blue).
   ========================================================================= */

/* ---------- Design tokens ---------- */
:root {
  --primary: #0d9488;          /* teal-600 */
  --primary-dark: #0f766e;     /* teal-700 */
  --primary-light: #14b8a6;    /* teal-500 */
  --primary-fg: #ffffff;
  --primary-soft: #ccfbf1;     /* teal-100 */
  --accent: #f59e0b;           /* amber-500 */
  --accent-dark: #d97706;      /* amber-600 */
  --bg: #f8fafc;               /* slate-50 */
  --card: #ffffff;
  --text: #0f172a;             /* slate-900 */
  --muted: #64748b;            /* slate-500 */
  --muted-2: #94a3b8;          /* slate-400 */
  --border: #e2e8f0;           /* slate-200 */
  --border-strong: #cbd5e1;    /* slate-300 */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, .06);
  --shadow: 0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 16px 40px -8px rgba(15, 23, 42, .20), 0 4px 12px -2px rgba(15, 23, 42, .08);
  --danger: #e11d48;            /* rose-600 */
  --danger-soft: #ffe4e6;
  --success: #059669;
  --warning: #d97706;
  --info: #0284c7; /* used ONLY for callout variant accents — not a UI primary */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --header-h: 60px;
  --transition: 150ms cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ---------- App shell + sticky footer ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-header .hdr-inner {
  max-width: 100%;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.01em;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.app-header .brand:hover { text-decoration: none; }
.app-header .brand .logo-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: var(--shadow-sm);
  font-size: 18px;
}
.app-header .brand .logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}
.app-header .brand small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: -2px;
}
.app-header .spacer { flex: 1 1 auto; }
.app-header .hdr-actions {
  display: flex; align-items: center; gap: 8px;
}
.app-header .hdr-user {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg);
}
.app-header .hdr-user .badge { margin-left: 4px; }

/* ---------- Table ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }

.app-main {
  flex: 1 1 auto;
  width: 100%;
}
.app-footer {
  margin-top: auto;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
}
.app-footer .ftr-inner {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex; flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
}
.app-footer .ftr-links { display: flex; gap: 16px; }
.app-footer a { color: var(--muted); }
.app-footer a:hover { color: var(--primary); }

/* ---------- Boot loader ---------- */
.boot-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60vh;
  color: var(--muted);
  font-size: 14px;
}
.spinner {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  animation: spin .7s linear infinite;
}
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 24px;
}
.container-narrow {
  max-width: 100%;
}
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; }
.spacer { flex: 1 1 auto; }
.muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-center { text-align: center; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hidden { display: none !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr; }
.grid.cols-3 { grid-template-columns: 1fr; }
.grid.editor { grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 640px) {
  .grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid.editor { grid-template-columns: 1fr 320px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-fg);
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}
.btn:hover:not(:disabled) { background: var(--primary-dark); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn svg.sm { width: 14px; height: 14px; }
.btn svg.lg { width: 18px; height: 18px; }

.btn-outline {
  background: var(--card);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--muted-2);
}
.btn-secondary {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.btn-secondary:hover:not(:disabled) { background: #99f6e4; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #be123c; }
.btn-dashed {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  width: 100%;
}

/* Inline block palette — shown below the Add block button */
.block-palette-inline {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}
.btn-dashed:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(13, 148, 136, .04);
}
.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.btn-icon {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}
.btn-icon.lg {
  width: 44px;
  height: 44px;
  min-height: 44px;
}
.btn-icon.sm {
  width: 28px; height: 28px; min-height: 28px;
}
.btn-block { display: flex; width: 100%; }

/* ---------- Forms ---------- */
.label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}
.label.inline { display: inline; margin: 0; }
.field { margin-bottom: 12px; }
.field-row { margin-bottom: 12px; }
.field-hint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.input, .textarea, .select {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
  cursor: pointer;
}
.input-h { min-height: 36px; padding: 6px 10px; }
.input-lg { min-height: 44px; font-size: 16px; }

.input-group {
  display: flex; align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card);
}
.input-group .input-addon {
  display: inline-flex; align-items: center;
  padding: 0 10px;
  background: var(--bg);
  color: var(--muted);
  border-right: 1px solid var(--border-strong);
  font-size: 13px;
}
.input-group .input {
  border: none; border-radius: 0;
  min-height: 38px;
}
.input-group .input:focus { box-shadow: none; }

.search-input {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search-input svg {
  position: absolute;
  left: 12px;
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.search-input .input {
  padding-left: 36px;
  min-width: 220px;
}

input[type="color"] {
  width: 36px; height: 36px;
  padding: 0; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-strong);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  cursor: pointer;
}

input[type="checkbox"], input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Toggle (switch) */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  vertical-align: middle;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-strong);
  border-radius: 22px;
  transition: background var(--transition);
}
.switch .track::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::before { transform: translateX(16px); }

/* Toggle group (segmented buttons) */
.toggle-group {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  overflow: hidden;
  min-height: 36px;
}
.toggle-group .tg-item {
  padding: 0 12px;
  display: inline-flex; align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-right: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  min-height: 36px;
  transition: background var(--transition), color var(--transition);
}
.toggle-group .tg-item:last-child { border-right: none; }
.toggle-group .tg-item:hover { background: var(--bg); color: var(--text); }
.toggle-group .tg-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.toggle-group .tg-item svg { width: 16px; height: 16px; }

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-hover {
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.card-hover:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.card-body { padding: 16px; }
.card-body.p-0 { padding: 0; }
.card-body.p-4 { padding: 16px; }
.card-body.p-6 { padding: 24px; }
.card-header {
  padding: 16px 16px 0;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-dashed {
  border-style: dashed;
  background: rgba(248, 250, 252, .5);
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid transparent;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge-secondary {
  background: #f1f5f9;
  color: var(--muted);
  border-color: var(--border);
}
.badge-success {
  background: #d1fae5;
  color: #065f46;
}
.badge-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--muted);
}
.badge-primary-outline {
  background: transparent;
  border-color: rgba(13, 148, 136, .4);
  color: var(--primary-dark);
}
.badge.tiny { font-size: 10px; padding: 1px 6px; }
.badge.sm { font-size: 11px; padding: 2px 8px; }

/* ---------- Skeleton ---------- */
.skeleton {
  display: block;
  background: linear-gradient(90deg, #eef2f6 25%, #f8fafc 50%, #eef2f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  width: 100%;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton.h-4 { height: 16px; }
.skeleton.h-5 { height: 20px; }
.skeleton.h-6 { height: 24px; }
.skeleton.h-8 { height: 32px; }
.skeleton.h-12 { height: 48px; }
.skeleton.h-24 { height: 96px; }
.skeleton.h-32 { height: 128px; }
.skeleton.h-40 { height: 160px; }
.skeleton.w-1-2 { width: 50%; }
.skeleton.w-3-4 { width: 75%; }
.skeleton.w-1-3 { width: 33.333%; }

/* ---------- Toasts (sonner-style, bottom-right) ---------- */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text);
  animation: toast-in .25s ease-out;
}
.toast.leaving { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}
.toast-icon {
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin-top: 1px;
}
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info .toast-icon { color: var(--primary); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-title { font-weight: 600; }
.toast-desc { color: var(--muted); margin-top: 2px; font-size: 12px; }

/* ---------- Modal / dialog ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  animation: fade-in .15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  margin: 24px auto;
  animation: modal-in .2s ease-out;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}
.modal.lg { max-width: 720px; }
.modal.sm { max-width: 420px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.modal-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  background: var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.modal-close {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: transparent;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-danger .btn-danger { background: var(--danger); }

/* ---------- Sheet (right-side slide-over) ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(1px);
  z-index: 90;
  animation: fade-in .15s ease-out;
}
.sheet {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 91;
  display: flex;
  flex-direction: column;
  animation: slide-in .25s cubic-bezier(.32, .72, 0, 1);
}
@keyframes slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.sheet.leaving { animation: slide-out .2s ease-in forwards; }
@keyframes slide-out {
  to { transform: translateX(100%); }
}
.sheet-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
}
.sheet-title { font-size: 16px; font-weight: 600; margin: 0; }
.sheet-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.sheet-body {
  padding: 16px 20px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* ---------- Dropdown menu ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
  animation: dropdown-in .12s ease-out;
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dropdown-menu .dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  transition: background var(--transition);
}
.dropdown-menu .dd-item:hover { background: var(--bg); }
.dropdown-menu .dd-item.danger { color: var(--danger); }
.dropdown-menu .dd-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.dropdown-menu .dd-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.dropdown-menu .dd-label {
  padding: 4px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------- Tabs ---------- */
.tabs-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}
.tabs-trigger {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  border: none;
  transition: background var(--transition), color var(--transition);
  min-height: 36px;
}
.tabs-trigger:hover { color: var(--text); }
.tabs-trigger.active {
  background: var(--card);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}
.tabs-panel { display: none; }
.tabs-panel.active { display: block; }

/* ---------- Sortable / drag-and-drop ---------- */
.sortable-list { display: flex; flex-direction: column; gap: 12px; }
.sortable-item { position: relative; }
.sortable-item.dragging {
  opacity: .9;
  box-shadow: var(--shadow-lg), 0 0 0 2px rgba(13, 148, 136, .35);
  z-index: 10;
}
.sortable-placeholder {
  height: 56px;
  border: 2px dashed var(--primary);
  background: var(--primary-soft);
  border-radius: var(--radius);
  opacity: .6;
}
.drag-handle {
  cursor: grab;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: transparent;
  transition: background var(--transition), color var(--transition);
}
.drag-handle:hover { background: var(--bg); color: var(--text); }
.drag-handle:active { cursor: grabbing; }
.drag-handle svg { width: 18px; height: 18px; }

/* ---------- Lesson row ---------- */
.lesson-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}
/* Lesson dropdown menu — appended to <body> with position:fixed so it
   always appears above all content regardless of stacking contexts. */
.lesson-dd-menu {
  z-index: 99999 !important;
}
.lesson-row .lr-index {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  min-width: 26px;
  text-align: center;
}
.lesson-row .lr-main {
  flex: 1 1 auto;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  display: block;
}
.lesson-row .lr-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.lesson-row .lr-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.lesson-row .lr-meta {
  display: flex; gap: 6px;
  margin-top: 6px;
}

/* ---------- Block editor card ---------- */
.block-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.block-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.block-card.dragging {
  box-shadow: var(--shadow-lg), 0 0 0 2px rgba(13, 148, 136, .35);
  z-index: 10;
}
.block-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 0;
}
.block-toolbar-left {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.block-toolbar-right {
  display: flex; align-items: center; gap: 4px;
  position: relative;
  opacity: .35;
  transition: opacity var(--transition);
}
.block-card:hover .block-toolbar-right,
.block-card:focus-within .block-toolbar-right {
  opacity: 1;
}
/* The 3-dot kebab menu button on each block */
.block-menu-trigger {
  cursor: pointer;
}
.block-menu-trigger svg { width: 18px; height: 18px; }
/* Block dropdown menu — appended to <body> with position:fixed so it
   always appears above all content regardless of stacking contexts. */
.block-dd-menu {
  z-index: 99999 !important;
}
/* Text labels on Edit / Save buttons — visible on desktop, hidden on mobile */
.btn-label {
  font-size: 13px;
  font-weight: 500;
  margin-left: 4px;
}
@media (max-width: 640px) {
  .btn-label { display: none; }
}
/* Block preview pane (the learner-facing preview shown when "Preview" is toggled) */
.block-preview-pane {
  padding: 16px 4px;
  background: var(--card);
  border-radius: var(--radius-sm);
}
.block-preview-pane .pv-block { margin-bottom: 12px; }
.block-preview-pane .pv-muted { color: var(--muted); font-size: 14px; font-style: italic; }
.block-preview-pane .pv-caption { color: var(--muted); font-size: 13px; margin-top: 6px; text-align: center; }
.block-preview-pane .pv-text { font-size: 15px; line-height: 1.6; }
.block-preview-pane .pv-text p { margin: 0 0 10px; }
.block-preview-pane .pv-heading h1 { font-size: 28px; font-weight: 800; margin: 0 0 8px; }
.block-preview-pane .pv-heading h2 { font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.block-preview-pane .pv-heading h3 { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
.block-preview-pane h4 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.block-preview-pane img { max-width: 100%; }
.block-body { padding: 12px 16px 16px; }
.block-body.pl-2 { padding-left: 28px; }
.block-saving {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.block-saving.saved { color: var(--success); }
.block-saving .spinner.sm {
  width: 12px; height: 12px;
  border-width: 2px;
  border-color: var(--primary-soft);
  border-top-color: var(--primary);
}

/* ---------- Field rows for blocks ---------- */
.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  .field-grid-2 { grid-template-columns: 1fr 1fr; }
  .field-grid-1-2 { grid-template-columns: 1fr 180px; }
}

/* ---------- Inline markdown preview ---------- */
.markdown-preview {
  border: 1px solid var(--border);
  background: #fafbfc;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  min-height: 60px;
}
.markdown-preview.center { text-align: center; }
.markdown-preview h1 { font-size: 1.6em; margin: .4em 0; font-weight: 700; }
.markdown-preview h2 { font-size: 1.4em; margin: .4em 0; font-weight: 600; }
.markdown-preview h3 { font-size: 1.2em; margin: .4em 0; font-weight: 600; }
.markdown-preview p { margin: .4em 0; }
.markdown-preview ul, .markdown-preview ol {
  margin: .4em 0 .4em 1.4em;
  padding-left: 1em;
}
.markdown-preview ul { list-style: disc; }
.markdown-preview ol { list-style: decimal; }
.markdown-preview li { margin: .15em 0; }
.markdown-preview a { color: var(--primary); text-decoration: underline; }
.markdown-preview code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .92em;
  color: #be123c;
}
.markdown-preview pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: .4em 0;
}
.markdown-preview pre code {
  background: none; color: inherit; padding: 0;
}
.markdown-preview strong { font-weight: 700; }
.markdown-preview em { font-style: italic; }
.markdown-preview blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
  margin: .4em 0;
  color: var(--muted);
  font-style: italic;
}
.markdown-preview hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: .8em 0;
}

/* ---------- Preview pane (heading, quote, callout, etc.) ---------- */
.preview-pane {
  border: 1px solid var(--border);
  background: #fafbfc;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.preview-pane.p-0 { padding: 0; }

/* ----------------------------- Code block editor ----------------------------- */
.code-editor { display: flex; flex-direction: column; gap: 12px; }
.code-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
  flex-wrap: wrap;
}
.code-tab-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
  letter-spacing: .02em;
}
.code-tab-btn:hover { color: var(--text); }
.code-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.code-run-php {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.code-panes { position: relative; }
.code-pane { display: none; }
.code-pane.active { display: block; }
.code-textarea {
  width: 100%;
  min-height: 200px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  tab-size: 2;
  white-space: pre;
  overflow-x: auto;
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}
.code-textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: var(--primary);
}
.code-preview-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}
.code-preview-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.code-preview-iframe-wrap { width: 100%; }
.code-preview-iframe {
  width: 100%;
  height: 320px;
  border: 0;
  display: block;
  background: #fff;
}
.preview-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.preview-h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.preview-h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.preview-h3 { font-size: 18px; font-weight: 600; }
.text-center { text-align: center; }

/* ---------- Callout variants ---------- */
.callout-preview {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid;
  font-size: 14px;
}
.callout-preview .ct-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.callout-info    { border-color: #bae6fd; background: #f0f9ff; color: #075985; }
.callout-success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.callout-warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.callout-danger  { border-color: #fecdd3; background: #fff1f2; color: #9f1239; }

/* ---------- Quote preview ---------- */
.quote-preview {
  border-left: 4px solid var(--primary);
  padding: 4px 0 4px 14px;
  font-size: 14px;
  font-style: italic;
}
.quote-preview footer {
  font-size: 12px;
  color: var(--muted);
  font-style: normal;
  margin-top: 6px;
}

/* ---------- Item list (accordion/tabs/timeline/flashcards) ---------- */
.item-card {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.item-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.item-card-head .ic-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------- Question editor ---------- */
.question-card {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.question-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.question-head .qh-meta { display: flex; align-items: center; gap: 6px; }
.option-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.option-row .opt-input { flex: 1 1 auto; }

/* ---------- Image / media preview ---------- */
.media-frame {
  border: 1px dashed var(--border-strong);
  background: #fafbfc;
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-height: 100px;
  justify-content: center;
  color: var(--muted);
}
.media-frame:hover { background: var(--bg); border-color: var(--primary); }
.media-frame .media-img-wrap {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fafbfc;
}
.media-frame .media-img-wrap img { width: 100%; height: auto; display: block; }
.size-small { max-width: 320px; }
.size-medium { max-width: 576px; }
.size-large { max-width: 768px; }
.size-full { max-width: 100%; }

/* ---------- Video / embed preview ---------- */
.aspect-video {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}
.aspect-video iframe, .aspect-video video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 40px 24px;
}
.empty-state .es-icon {
  width: 80px; height: 80px;
  border-radius: var(--radius-lg);
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  margin-bottom: 16px;
}
.empty-state .es-icon svg { width: 32px; height: 32px; }
.empty-state .es-icon.sm {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.empty-state .es-icon.sm svg { width: 24px; height: 24px; }
.empty-state h2 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.empty-state p {
  font-size: 13px;
  color: var(--muted);
  max-width: 360px;
  margin: 0 auto;
}

/* ---------- Course card (dashboard) ---------- */
.course-card {
  position: relative;
  height: 100%;
  overflow: hidden;
}
.course-card .cc-cover {
  position: relative;
  height: 128px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}
.course-card .cc-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-card .cc-cover .cc-status {
  position: absolute;
  top: 8px; right: 8px;
}
.course-card .cc-cover .cc-cover-icon {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .85);
}
.course-card .cc-cover .cc-cover-icon svg { width: 40px; height: 40px; }
.course-card .cc-actions {
  position: absolute;
  top: 8px; right: 8px;
  opacity: 1;
  transition: opacity var(--transition);
  z-index: 30;
}
/* Course dropdown menu — appended to <body> with position:fixed */
.course-dd-menu {
  z-index: 99999 !important;
}
.course-card:hover .cc-actions,
.course-card:focus-within .cc-actions { opacity: 1; }
.course-card .cc-open-btn {
  position: absolute;
  inset: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: inherit;
  z-index: 2;
}
/* The open button must NOT intercept clicks on the actions menu */
.course-card .cc-trigger {
  position: relative;
  z-index: 31;
  color: #111827;
}
.course-card .cc-trigger svg {
  stroke: #111827;
  color: #111827;
}
.course-card .cc-body { padding: 12px 16px 16px; }
.course-card .cc-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.35;
}
.course-card .cc-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 12px;
}
.course-card .cc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.course-card .cc-meta .cc-lessons {
  display: inline-flex; align-items: center; gap: 4px;
}
.course-card .cc-meta .cc-lessons svg { width: 12px; height: 12px; }

/* ---------- Sidebar (course editor) ---------- */
.sidebar-card .sb-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}
.sidebar-card .sb-row .sb-label { color: var(--muted); }
.sidebar-card .sb-row .sb-value { font-weight: 500; }
.swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-block;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08);
}

/* ---------- Inline editable title ---------- */
.editable-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  text-align: left;
}
.editable-title h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
}
.editable-title .pencil-hint {
  color: var(--muted);
  opacity: 0;
  transition: opacity var(--transition);
  width: 14px; height: 14px;
}
.editable-title:hover .pencil-hint { opacity: 1; }
.editable-title svg { width: 14px; height: 14px; }
.editable-desc {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 0;
  cursor: pointer; color: var(--muted);
  font-size: 12px;
}
.editable-desc svg { width: 12px; height: 12px; opacity: 0; transition: opacity var(--transition); }
.editable-desc:hover svg { opacity: 1; }

/* ---------- Always-editable lesson title & description ---------- */
.lesson-title-static {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.lesson-edit-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}
/* Display bar: title text + Edit button side by side */
.title-display-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
/* Edit bar: input + Save + Cancel buttons side by side */
.title-edit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.title-edit-bar .lesson-title-input {
  flex: 1 1 300px;
  min-width: 200px;
}
.title-edit-bar .lesson-desc-input {
  flex: 1 1 300px;
  min-width: 200px;
}
.lesson-title-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}
.lesson-desc-text {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}
.edit-title-btn,
.edit-desc-btn {
  flex-shrink: 0;
  white-space: nowrap;
}
/* Active editing input fields */
.lesson-title-input {
  display: block !important;
  min-height: 44px !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  padding: 8px 12px !important;
  border: 2px solid var(--primary) !important;
  border-radius: 8px;
  background: #fff !important;
  color: var(--text) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
  font-family: inherit !important;
}
.lesson-title-input:focus { outline: none; }
.lesson-desc-input {
  display: block !important;
  min-height: 44px !important;
  font-size: 14px !important;
  padding: 8px 12px !important;
  border: 2px solid var(--primary) !important;
  border-radius: 8px;
  background: #fff !important;
  color: var(--text) !important;
  resize: vertical;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
  font-family: inherit !important;
}
.lesson-desc-input:focus { outline: none; }
.lesson-desc-input::placeholder,
.lesson-title-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* ---------- Block palette items ---------- */
.palette-group + .palette-group { margin-top: 16px; }
.palette-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
}
.palette-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  min-height: 44px;
}
.palette-item:hover {
  border-color: rgba(13, 148, 136, .5);
  background: rgba(13, 148, 136, .04);
}
.palette-item:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.palette-item .pi-icon {
  width: 36px; height: 36px;
  min-width: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center;
}
.palette-item .pi-icon svg { width: 18px; height: 18px; }
.palette-item .pi-body { flex: 1 1 auto; min-width: 0; }
.palette-item .pi-label { font-size: 14px; font-weight: 500; }
.palette-item .pi-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Preview iframe ---------- */
#preview-view {
  padding: 16px 16px 8px;
}
.preview-iframe-wrap {
  width: 100%;
  height: calc(100vh - 9rem);
  min-height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.preview-iframe-wrap iframe {
  width: 100%; height: 100%;
  border: 0;
  display: block;
}

/* ---------- Settings preview ---------- */
.theme-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.theme-preview .tp-title {
  font-size: 16px; font-weight: 700; margin-bottom: 8px;
}
.theme-preview .tp-body { font-size: 13px; opacity: .85; }
.theme-preview .tp-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
}

/* ---------- Cover preview ---------- */
.cover-preview {
  width: 64px; height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Separator ---------- */
.separator {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
  border: none;
}

/* ---------- Custom scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: padding-box; border: 2px solid transparent; }
.modal-body, .sheet-body, .toast-container, .sortable-list, .app-main { scrollbar-width: thin; }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 640px) {
  .app-header .brand small { display: none; }
  .container { padding: 16px 12px; }
  .modal { max-width: 100%; margin: 12px auto; }
  .sheet { max-width: 100%; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: 100%; }
  .btn-block-sm { width: 100%; }
  .row.between-sm { justify-content: space-between; }
}

/* ---------- Mobile saving indicator inside block (hidden on >= sm) ---------- */
.mobile-saving { display: block; margin-top: 8px; }
@media (min-width: 640px) {
  .mobile-saving { display: none; }
  .desktop-saving { display: inline-flex !important; }
}
.desktop-saving { display: none; }

/* ---------- Misc utilities ---------- */
.relative { position: relative; }
.absolute { position: absolute; }
.full-w { width: 100%; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 auto; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.cursor-pointer { cursor: pointer; }
.cursor-grab { cursor: grab; }
.no-underline { text-decoration: none; }
.line-through { text-decoration: line-through; }
.capitalize { text-transform: capitalize; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: .04em; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ===================================================================
   LESSON EDITOR — TWO-COLUMN LAYOUT
   Left sidebar (1/8 width): block palette (always visible)
   Right content (7/8 width): lesson blocks being edited
   =================================================================== */
.lesson-editor-layout {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 16px;
}
.le-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 0 12px;
}
.le-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 60px;
}
.le-sidebar {
  flex: 0 0 12.5%;
  min-width: 160px;
  max-width: 220px;
  position: sticky;
  top: 16px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 12px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  z-index: 2;
}
.le-sidebar-header {
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.le-sidebar-header h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  color: var(--text, #0f172a);
}
.le-sidebar-hint {
  font-size: 11px;
  color: var(--muted, #64748b);
  margin: 4px 0 0;
}
.le-content {
  flex: 1 1 87.5%;
  min-width: 0;
}
/* Compact palette items inside the narrow sidebar */
.le-sidebar .palette-item {
  padding: 8px 6px;
  gap: 6px;
}
.le-sidebar .palette-item .pi-icon {
  width: 26px;
  height: 26px;
  min-width: 26px;
}
.le-sidebar .palette-item .pi-icon svg { width: 14px; height: 14px; }
.le-sidebar .palette-item .pi-label { font-size: 12px; }
.le-sidebar .palette-item .pi-desc { font-size: 10px; }
.le-sidebar .palette-group-title { font-size: 10px; margin-bottom: 6px; }
.le-sidebar .palette-group + .palette-group { margin-top: 12px; }
/* Mobile: stack the sidebar above the content */
@media (max-width: 900px) {
  .le-body { flex-direction: column; }
  .le-sidebar {
    position: static;
    width: 100%;
    max-width: 100%;
    max-height: 280px;
  }
  .le-content { width: 100%; }
}

/* Empty lesson hint and add-block hint */
.empty-lesson-hint {
  text-align: center;
  padding: 60px 20px;
  border: 2px dashed var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--card, #fff);
}
.empty-lesson-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-soft, #f0fdfa);
  color: var(--primary, #0d9488);
  margin-bottom: 16px;
}
.empty-lesson-icon svg { width: 24px; height: 24px; }
.empty-lesson-hint h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text, #0f172a);
}
.empty-lesson-hint p {
  font-size: 14px;
  color: var(--muted, #64748b);
  margin: 0;
}
.add-block-hint {
  text-align: center;
  padding: 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted, #64748b);
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: 8px;
  background: transparent;
}
