/* ===== CSS Variables & Reset ===== */
:root {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-sidebar: #1e293b;
  --bg-sidebar-hover: #334155;
  --bg-sidebar-active: #3b82f6;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #eff6ff;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #f59e0b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-width: 260px;
  --transition: 0.2s ease;

  /* Semantic colors for result scores */
  --score-good-bg: #dcfce7;
  --score-good-text: #15803d;
  --score-medium-bg: #fef9c3;
  --score-medium-text: #a16207;
  --score-poor-bg: #fef2f2;
  --score-poor-text: #dc2626;

  /* Topic card active gradient */
  --topic-active-bg: linear-gradient(135deg, #f0fdf4 0%, var(--bg-secondary) 100%);
  --topic-selected-bg: linear-gradient(135deg, var(--accent-light) 0%, var(--bg-secondary) 100%);

  /* Detail items */
  --detail-correct-bg: #f0fdf4;
  --detail-correct-border: #bbf7d0;
  --detail-wrong-bg: #fef2f2;
  --detail-wrong-border: #fecaca;

  /* Flipped card / highlight */
  --highlight-bg: #dcfce7;

  /* Login gradient */
  --login-bg: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);

  /* Toggle slider off */
  --toggle-off: #cbd5e1;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #2563eb;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-sidebar: #94a3b8;
  --text-sidebar-active: #f1f5f9;
  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-light: #1e3a5f;
  --danger: #f87171;
  --danger-hover: #ef4444;
  --success: #4ade80;
  --warning: #fbbf24;
  --border: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.5);

  --score-good-bg: #14532d;
  --score-good-text: #86efac;
  --score-medium-bg: #713f12;
  --score-medium-text: #fde68a;
  --score-poor-bg: #7f1d1d;
  --score-poor-text: #fca5a5;

  --topic-active-bg: linear-gradient(135deg, #14532d 0%, var(--bg-secondary) 100%);
  --topic-selected-bg: linear-gradient(135deg, var(--accent-light) 0%, var(--bg-secondary) 100%);

  --detail-correct-bg: #14532d;
  --detail-correct-border: #166534;
  --detail-wrong-bg: #7f1d1d;
  --detail-wrong-border: #991b1b;

  --highlight-bg: #14532d;

  --login-bg: linear-gradient(135deg, #020617 0%, #0f172a 50%, #020617 100%);

  --toggle-off: #475569;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* ===== Utility ===== */
.hidden {
  display: none !important;
}

/* ===== Login Screen ===== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: var(--login-bg);
  z-index: 100;
}

.login-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

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

.login-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.login-credit {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-top: 8px;
  opacity: 0.7;
}

.login-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 12px;
}
.login-qr-img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 6px;
}
.login-qr-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 4px;
  opacity: 0.7;
}
.login-qr-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.login-qr-img-small {
  width: 80px;
  height: 80px;
}
.login-qr-url {
  font-size: 0.65rem;
  color: var(--accent);
  margin-top: 2px;
  word-break: break-all;
  text-align: center;
  opacity: 0.8;
}

.login-form {
  margin-bottom: 16px;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.login-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.login-divider span {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 0 12px;
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}

.login-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.admin-login-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
  font-weight: 600;
}

/* ===== App Container ===== */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.app-title {
  color: var(--text-sidebar-active);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.user-info {
  margin-top: 12px;
  color: var(--text-sidebar);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.user-role-badge.teacher {
  background: #6366f1;
  color: white;
}

.user-role-badge.student {
  background: #22c55e;
  color: white;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-sidebar);
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-align: left;
}

.nav-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.nav-btn.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.setting-label {
  color: var(--text-sidebar);
  font-size: 0.8rem;
}

.setting-select {
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
}

.btn-theme-toggle {
  padding: 4px 10px !important;
  font-size: 0.9rem !important;
  min-width: auto;
  background: var(--bg-sidebar-hover) !important;
  color: var(--text-sidebar-active) !important;
  border-color: rgba(255,255,255,0.15) !important;
}

.version-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-align: center;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

.view-header {
  margin-bottom: 28px;
}

.view-header h2 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ===== Dashboard Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===== Type Grid (Dashboard) ===== */
.section-title {
  margin-bottom: 16px;
}

.section-title h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.type-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.type-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.type-card-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.type-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.type-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ===== Topic Cards ===== */
.topic-actions-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

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

.topic-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.topic-card:hover {
  box-shadow: var(--shadow-md);
}

.topic-card.topic-active {
  border-color: var(--success);
  background: var(--topic-active-bg);
}

.topic-card.topic-inactive {
  border-color: var(--border);
}

.topic-card.topic-selected {
  border-color: var(--accent);
  background: var(--topic-selected-bg);
}

.topic-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topic-card-info {
  flex: 1;
  min-width: 0;
}

.topic-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.topic-card-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.topic-card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.82rem;
}

.topic-module-count {
  color: var(--accent);
  font-weight: 600;
}

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

.topic-status.active {
  color: var(--success);
}

.topic-status.inactive {
  color: var(--text-secondary);
}

.topic-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ===== Toggle Switch ===== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--toggle-off);
  border-radius: 26px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ===== Topic Form ===== */
.topic-form-container {
  margin-top: 20px;
}

.topic-form-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 600px;
}

.topic-form-card h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.breadcrumb-link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--text-secondary);
}

.breadcrumb-current {
  color: var(--text-secondary);
}

/* ===== Modules List ===== */
.header-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.search-input {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  flex: 1;
  min-width: 200px;
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus {
  border-color: var(--accent);
}

.filter-select {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg-secondary);
  cursor: pointer;
  outline: none;
}

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

.module-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: box-shadow var(--transition);
}

.module-card:hover {
  box-shadow: var(--shadow-md);
}

.module-card-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
}

.module-card-info {
  flex: 1;
  min-width: 0;
}

.module-card-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-card-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.module-card-type {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 8px;
}

.module-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

/* ===== Forms ===== */
.module-form {
  max-width: 720px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
  background: var(--bg-secondary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.rich-text-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.rich-text-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary, #f8f9fa); /* Slight background contrast like docs */
}

/* New Compact Toolbar Controls */
.form-group select.rt-select,
.rt-select {
  height: 28px;
  padding: 0 24px 0 8px;
  font-size: 13px;
  color: var(--text-primary);
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23666%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 6px top 50%;
  background-size: 8px auto;
  transition: background-color 0.15s, border-color 0.15s;
}

.rt-select:hover {
  background-color: rgba(0, 0, 0, 0.05);
}
.rt-select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--bg-primary);
}

.form-group select.rt-block-format,
.rt-block-format { width: 85px; }

.form-group select.rt-spacing,
.rt-spacing { width: 100px; }

.form-group select.rt-font-size,
.rt-font-size { width: 95px; }

.rt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  font-size: 14px;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.rt-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
}
.rt-btn:active {
  background-color: rgba(0, 0, 0, 0.15);
}

.rt-separator {
  width: 1px;
  height: 20px;
  background-color: var(--border);
  margin: 0 4px;
}

.rich-text-surface {
  min-height: 140px;
  padding: 14px;
  outline: none;
  font-size: 0.95rem;
  line-height: 1.6;
}

.rich-text-surface:empty::before {
  content: 'Optionale Beschreibung...';
  color: var(--text-secondary);
}

.rich-text-surface h1,
.rich-text-surface h2,
.rich-text-surface h3,
.module-description-content h1,
.module-description-content h2,
.module-description-content h3 {
  margin: 0 0 10px;
}

.rich-text-surface p,
.module-description-content p,
.module-description-content ul,
.module-description-content ol,
.module-description-content blockquote,
.module-description-content table {
  margin: 0 0 12px;
}

.rich-text-surface blockquote,
.module-description-content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 12px;
  color: var(--text-secondary);
}

.rich-text-surface table,
.module-description-content table {
  width: 100%;
  border-collapse: collapse;
}

.rich-text-surface th,
.rich-text-surface td,
.module-description-content th,
.module-description-content td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.rich-text-surface th,
.module-description-content th {
  background: var(--bg-primary);
}

/* ===== Content Editor ===== */
.content-editor {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 8px;
  display: none;
}

.content-editor.active {
  display: block;
}

.content-editor h4 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.editor-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}

.editor-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.editor-item-header h5 {
  font-size: 0.9rem;
  font-weight: 600;
}

.editor-item .form-group {
  margin-bottom: 12px;
}

.editor-item .form-group:last-child {
  margin-bottom: 0;
}

.btn-add-item {
  width: 100%;
  padding: 12px;
  background: var(--accent-light);
  color: var(--accent);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-add-item:hover {
  background: #dbeafe;
}

.exam-mode-row {
  margin: 12px 0 18px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.exam-mode-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.exam-mode-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* ===== Drag and Drop Visual Editor ===== */
.dnd-img-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dnd-img-status {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.dnd-canvas-wrapper {
  margin-bottom: 16px;
}

.dnd-canvas {
  position: relative;
  width: 100%;
  min-height: 200px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
}

.dnd-canvas.dnd-drawing {
  cursor: crosshair;
}

.dnd-canvas-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.dnd-canvas-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  padding: 24px;
  text-align: center;
}

.dnd-zone-overlay {
  position: absolute;
  border: 2px solid;
  border-radius: 4px;
  cursor: move;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  touch-action: none;
}

.dnd-zone-overlay.selected {
  border-width: 3px;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

.dnd-zone-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  padding: 2px 6px;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}

.dnd-zone-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid #666;
  border-radius: 2px;
  cursor: se-resize;
  touch-action: none;
}

.dnd-draw-rect {
  position: absolute;
  border: 2px dashed var(--accent);
  background: rgba(59, 130, 246, 0.15);
  pointer-events: none;
}

.dnd-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.dnd-draw-hint {
  font-size: 0.82rem;
  color: var(--accent);
  font-style: italic;
}

.dnd-zone-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.dnd-zone-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dnd-zone-label-input {
  flex: 1;
  min-width: 100px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.dnd-zone-pos {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.dnd-drag-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.dnd-drag-num {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 24px;
}

.dnd-drag-text-input {
  flex: 1;
  min-width: 120px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.dnd-drag-zone-select {
  min-width: 140px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* ===== Drag and Drop Player ===== */
.dnd-player {
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.dnd-player-desc {
  margin-bottom: 16px;
  line-height: 1.5;
}

.dnd-player-draggables {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 40px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
}

.dnd-player-drag {
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  transition: opacity 0.2s, transform 0.15s;
}

.dnd-player-drag:active,
.dnd-player-drag.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.dnd-player-drag.placed {
  opacity: 0.85;
  font-size: 0.8rem;
  padding: 4px 10px;
}

.dnd-player-canvas-wrap {
  margin-bottom: 12px;
}

.dnd-player-canvas {
  position: relative;
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
}

.dnd-player-no-img {
  padding: 16px;
}

.dnd-player-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.dnd-player-zone {
  position: absolute;
  border: 2px solid;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: visible;
  transition: background 0.2s, border-style 0.2s, box-shadow 0.2s, transform 0.15s ease-out;
}

/* Expand the dropzone target area slightly */
.dnd-player-zone::after {
  content: '';
  position: absolute;
  top: -12px;
  left: -12px;
  right: -12px;
  bottom: -12px;
  pointer-events: auto !important;
  z-index: -1;
}

.dnd-player-zone.dnd-zone-hover {
  filter: brightness(1.1);
  border-style: solid !important;
  box-shadow: 0 0 14px currentColor, inset 0 0 10px rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.02);
  z-index: 10;
}

/* Highlight all zones with a dashed border when a drag is in progress */
.dnd-player:has(.dragging) .dnd-player-zone {
  border-style: dashed !important;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
}

/* Ignore pointer events on drop zone children during active drag to prevent flickering */
.dnd-player:has(.dragging) .dnd-player-zone * {
  pointer-events: none !important;
}

.dnd-player:has(.dragging) .dnd-player-zone::after {
  pointer-events: auto !important;
}

.dnd-player-zone-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  padding: 1px 5px;
  border-radius: 2px;
  white-space: nowrap;
  align-self: flex-start;
  pointer-events: none;
}

.dnd-player-zone-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 2px;
  flex: 1;
}

/* ===== Buttons ===== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

.btn-secondary:hover {
  background: var(--bg-primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-icon {
  padding: 6px 10px;
  font-size: 1rem;
  min-width: 36px;
  justify-content: center;
}

/* ===== Results ===== */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

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

.result-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-card-info strong {
  font-size: 1rem;
}

.result-topic-name {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.result-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.result-score {
  font-size: 1.1rem;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.result-score.good {
  background: var(--score-good-bg);
  color: var(--score-good-text);
}

.result-score.medium {
  background: var(--score-medium-bg);
  color: var(--score-medium-text);
}

.result-score.poor {
  background: var(--score-poor-bg);
  color: var(--score-poor-text);
}

.result-details {
  margin-top: 12px;
}

.result-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 4px 0;
}

.result-detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.result-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.result-detail-item.correct {
  background: var(--detail-correct-bg);
  border: 1px solid var(--detail-correct-border);
}

.result-detail-item.wrong {
  background: var(--detail-wrong-bg);
  border: 1px solid var(--detail-wrong-border);
}

.result-detail-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ===== Student Topics ===== */
.student-topics-list .topic-card {
  cursor: default;
}

.student-topic-card {
  transition: border-color var(--transition), background var(--transition);
}

/* ===== Quiz Mode ===== */
.quiz-topic-select {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-topic-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transition: box-shadow var(--transition);
}

.quiz-topic-card:hover {
  box-shadow: var(--shadow-md);
}

.quiz-topic-card-info h3 {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.quiz-topic-card-info p {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.quiz-player-area {
  margin-top: 20px;
}

.quiz-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin-bottom: 16px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

.quiz-info {
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.quiz-type-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-left: 8px;
}

.quiz-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ===== Quiz Result ===== */
.quiz-result-area {
  margin-top: 20px;
}

.quiz-final-result {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.quiz-result-icon {
  font-size: 4rem;
  margin-bottom: 12px;
}

.quiz-final-result h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.quiz-result-score {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 40px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.quiz-result-number {
  font-size: 2rem;
  font-weight: 800;
}

.quiz-result-pct {
  font-size: 1.2rem;
  font-weight: 600;
}

.quiz-result-score.good {
  background: var(--score-good-bg);
  color: var(--score-good-text);
}

.quiz-result-score.medium {
  background: var(--score-medium-bg);
  color: var(--score-medium-text);
}

.quiz-result-score.poor {
  background: var(--score-poor-bg);
  color: var(--score-poor-text);
}

.quiz-result-details {
  text-align: left;
  margin-top: 20px;
}

/* ===== H5P Player ===== */
.player-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.h5p-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 500px;
  padding: 24px;
  overflow: auto;
}

/* ===== Import/Export ===== */
.ie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.ie-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
}

.ie-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.ie-card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.ie-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.import-result {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.import-result.success {
  border-color: var(--success);
  background: var(--detail-correct-bg);
}

.import-result.error {
  border-color: var(--danger);
  background: var(--detail-wrong-bg);
}

/* ===== Custom Confirm Dialog ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

.confirm-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.15s ease;
}

.confirm-message {
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  background: var(--bg-sidebar);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  max-width: 380px;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--accent);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(60px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== Module selection checkbox ===== */
.module-select-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.module-card-disabled {
  opacity: 0.45;
  filter: grayscale(0.4);
}
.module-card-disabled .module-select-checkbox {
  opacity: 1;
  filter: none;
}

/* ===== Module Drag Reorder ===== */
.module-drag-handle {
  font-size: 1.3rem;
  cursor: grab;
  color: var(--text-secondary);
  user-select: none;
  flex-shrink: 0;
  padding: 4px 2px;
  line-height: 1;
  transition: color var(--transition);
}

.module-drag-handle:hover {
  color: var(--accent);
}

.module-drag-handle:active {
  cursor: grabbing;
}

.module-card-number {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 1.8em;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.module-card.dragging {
  opacity: 0.4;
  border-style: dashed;
}

.module-card.drag-over {
  border-top: 3px solid var(--accent);
}

/* ===== Import Modules Modal ===== */
.import-modules-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 520px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.15s ease;
}

.import-modules-card h3 {
  margin-bottom: 8px;
  color: var(--text-primary);
}

.import-modules-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.import-modules-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.import-module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.import-module-item:hover {
  background: var(--bg-hover);
}

.import-module-item label {
  cursor: pointer;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.import-module-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.import-module-type {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ===== Image Field ===== */
.image-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-field-preview {
  min-height: 48px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.image-field-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: var(--radius-sm);
}

.image-field-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Audio Field ===== */
.audio-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audio-field-preview {
  min-height: 40px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

.audio-field-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Dialog Cards Player ===== */
.dc-player {
  max-width: 520px;
  margin: 0 auto;
}

.dc-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}

.dc-image {
  margin-bottom: 12px;
}

.dc-image img {
  max-width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
}

.dc-audio {
  margin-bottom: 12px;
}

.dc-display {
  padding: 40px;
  min-height: 150px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dc-hint {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.dc-tip {
  margin-top: 8px;
}

.dc-tip-icon {
  font-size: 0.85rem;
  color: var(--accent);
  cursor: help;
  padding: 4px 8px;
  background: var(--accent-light, rgba(99, 102, 241, 0.1));
  border-radius: var(--radius-sm);
}

.dc-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.dc-counter {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 36px;
}

/* ===== Flashcard Image ===== */
.flashcard-image {
  margin-bottom: 12px;
}

/* ===== Flashcard Player ===== */
.fc-player {
  max-width: 520px;
  margin: 0 auto;
}

.fc-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}

.fc-image {
  margin-bottom: 16px;
}

.fc-image img {
  max-width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
}

.fc-question {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  min-height: 1.5em;
}

.fc-answer-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.fc-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.fc-input:focus {
  border-color: var(--accent);
}

.fc-input:disabled {
  opacity: 0.6;
}

.fc-feedback {
  min-height: 1.5em;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
}

.fc-feedback-correct {
  background: #dcfce7;
  color: #166534;
}

.fc-feedback-wrong {
  background: #fef2f2;
  color: #991b1b;
}

.fc-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.fc-counter {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.fc-score {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* ===== True/False Player ===== */
.tf-player {
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}
.tf-progress {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.tf-card {
  margin-bottom: 16px;
}
.tf-question {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 16px;
  line-height: 1.5;
}
.tf-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.tf-buttons .tf-btn {
  min-width: 100px;
  transition: background 0.15s, border-color 0.15s;
}
.tf-buttons .tf-btn.tf-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.tf-buttons .tf-btn:disabled:not(.tf-selected) {
  opacity: 0.5;
}
.tf-feedback {
  min-height: 1.5em;
  padding: 8px 0;
  font-weight: 600;
}
.tf-feedback-correct { color: #22c55e; }
.tf-feedback-wrong { color: #ef4444; }
.tf-correct { color: #22c55e; }
.tf-wrong { color: #ef4444; }
.tf-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.tf-score {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* ===== Drag the Words ===== */
.dtw-container {
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.dtw-description {
  margin-bottom: 16px;
}

.dtw-text-area {
  line-height: 2.4;
  margin-bottom: 16px;
  font-size: 1rem;
}

.dtw-static-text {
  white-space: pre-wrap;
}

.dtw-drop-zone {
  display: inline-block;
  min-width: 80px;
  min-height: 28px;
  padding: 4px 12px;
  margin: 2px 4px;
  border: 2px dashed var(--text-secondary);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  vertical-align: middle;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.dtw-drop-zone.dtw-drop-hover {
  border-color: var(--accent);
  background: var(--accent-light, rgba(99, 102, 241, 0.1));
}

.dtw-drop-zone.dtw-drop-filled {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-light, rgba(99, 102, 241, 0.1));
  cursor: grab;
  font-weight: 600;
}

.dtw-drop-zone.dtw-correct {
  border-color: var(--success, #22c55e);
  background: #dcfce7;
  color: #166534;
}

.dtw-drop-zone.dtw-wrong {
  border-color: var(--danger, #ef4444);
  background: #fef2f2;
  color: #991b1b;
}

.dtw-drop-zone.dtw-missing {
  border-color: #eab308;
  background: #fef9c3;
}

.dtw-word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 44px;
}

.dtw-chip {
  display: inline-block;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  cursor: grab;
  font-weight: 600;
  font-size: 0.9rem;
  user-select: none;
  transition: opacity 0.15s, transform 0.1s;
}

.dtw-chip:hover {
  transform: translateY(-1px);
}

.dtw-chip:active {
  cursor: grabbing;
}

.dtw-chip.dtw-chip-used {
  opacity: 0.25;
  pointer-events: none;
}

/* ===== Responsive ===== */
@media (max-width: 800px) {
  .sidebar {
    width: 64px;
  }
  .sidebar-header .app-title,
  .sidebar-header .user-info,
  .nav-btn span:not(.nav-icon),
  .sidebar-footer .version-label,
  .sidebar-settings .setting-label {
    display: none;
  }
  .nav-btn {
    justify-content: center;
    padding: 12px;
  }
  .main-content {
    padding: 20px;
  }
  .login-card {
    margin: 16px;
  }
}

/* ===== Option group styling ===== */
.option-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.option-row input[type="text"] {
  flex: 1;
}

.option-row .btn-icon {
  flex-shrink: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ===== Drag handle ===== */
.drag-handle {
  cursor: grab;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ===== H5P Native Preview ===== */
.h5p-native-preview {
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.h5p-native-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.h5p-native-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.h5p-native-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.h5p-native-type-label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.h5p-native-lib-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.h5p-native-question {
  margin-bottom: 12px;
  line-height: 1.6;
  font-size: 0.95rem;
}

.h5p-native-extra {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.h5p-native-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

/* ==================== v2.0 Admin UI Styles ==================== */

/* User role badges */
.user-role-badge {
  display: inline-block;
  font-size: 0.75em;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.user-role-badge.admin   { background: #8b5cf6; color: #fff; }
.user-role-badge.teacher { background: var(--accent); color: #fff; }
.user-role-badge.student { background: #10b981; color: #fff; }

/* Admin nav section */
.nav-section-label {
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  padding: 14px 16px 4px;
}

/* Admin list */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 0 16px;
}
.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: box-shadow 0.15s;
}
.admin-list-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.admin-list-item-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.admin-list-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Admin filter tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.admin-tab {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Settings panel */
.settings-panel {
  max-width: 560px;
}
.settings-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.settings-group h3 {
  margin: 0 0 12px;
  font-size: 1em;
  font-weight: 700;
}
.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  font-size: 0.95em;
}
.settings-hint {
  font-size: 0.82em;
  color: var(--text-secondary);
  margin: 8px 0 0;
}

/* Login error */
.login-error {
  color: #dc2626;
  font-size: 0.87em;
  margin: 4px 0 8px;
}

/* Small button variant */
.btn.btn-sm {
  font-size: 0.78em;
  padding: 4px 10px;
}

/* Topic sharing badges */
.topic-shared-badge {
  display: inline-block;
  font-size: 0.75em;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: #dbeafe;
  color: #1d4ed8;
}
.topic-shared-badge.owner {
  background: #dcfce7;
  color: #166534;
}
