:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --primary: #0f5c4d;
  --primary-dark: #0a4237;
  --accent: #c89b3c;
  --text: #1c2422;
  --muted: #5a6965;
  --border: #dfe6e3;
  --danger: #b83227;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.hidden { display: none !important; }

.topbar {
  background: var(--primary);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo-badge {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent); color: #11241f;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px;
}
.brand h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.brand p { margin: 0; font-size: 12px; opacity: 0.88; }
.ver { background: rgba(255,255,255,0.18); padding: 1px 8px; border-radius: 99px; font-size: 12px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-badge { font-weight: 700; font-size: 14px; }

.container { max-width: 1280px; margin: 24px auto; padding: 0 18px 40px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(15, 92, 77, 0.05);
}

.auth-card { max-width: 460px; margin: 40px auto; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab {
  flex: 1; padding: 10px; border: 1px solid var(--border);
  background: #f8faf9; border-radius: 10px; cursor: pointer;
  font-family: inherit; font-weight: 700;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-family: inherit; font-size: 15px;
}

.btn {
  border: none; border-radius: 10px; padding: 10px 16px;
  font-family: inherit; font-weight: 700; font-size: 14px;
  cursor: pointer; transition: 0.15s ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: inherit; }
.topbar .btn-outline { border-color: rgba(255,255,255,0.4); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-full { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.pill { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.pill-muted { background: rgba(255,255,255,0.16); color: #fff; }
.pill-success { background: #dff5ec; color: #0c5d43; }
.pill-warn { background: #fff3d6; color: #8c5a00; }

.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.alert-error { background: #fdecec; color: #9c2219; }
.alert-info { background: #eaf4f2; color: #0f5c4d; }

.section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); }

.curriculum-grid, .persona-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.select-card {
  border: 2px solid var(--border); border-radius: 12px; padding: 14px;
  cursor: pointer; transition: 0.15s ease; background: #fbfdfc;
}
.select-card:hover { border-color: var(--primary); }
.select-card.selected { border-color: var(--primary); background: #edf7f4; }
.select-card h4 { margin: 0 0 6px; font-size: 16px; color: var(--primary-dark); }
.select-card p { margin: 6px 0; font-size: 13px; color: var(--muted); }
.select-card .tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px; background: #e2eeea; color: var(--primary-dark); font-weight: 700; }

.start-bar { text-align: center; margin-top: 16px; }

.classroom-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 14px;
}
.challenge-line { margin: 4px 0 0; color: var(--primary); font-weight: 600; font-size: 14px; }
.classroom-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timer { background: #1c2422; color: #fff; padding: 6px 12px; border-radius: 8px; font-weight: 700; font-variant-numeric: tabular-nums; }

.classroom-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 18px; }
@media (max-width: 960px) { .classroom-grid { grid-template-columns: 1fr; } }

.board-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.board-nav { display: flex; align-items: center; gap: 8px; }
.upload-label { display: inline-flex; align-items: center; cursor: pointer; }

.slide-stage {
  background: linear-gradient(135deg, #fdfcf7, #f2f8f6);
  border: 2px dashed #b9d1ca; border-radius: 14px;
  min-height: 430px; padding: 28px; display: flex;
  flex-direction: column; justify-content: center; align-items: center; text-align: center;
}
.slide-heading { font-size: 18px; font-weight: 700; color: var(--primary); margin-bottom: 18px; }
.slide-arabic { font-size: 44px; font-weight: 800; color: #12211e; margin: 14px 0; letter-spacing: 1px; }
.slide-english { font-size: 16px; color: #36504b; direction: ltr; margin-bottom: 18px; }
.slide-tip { background: #fff9e8; border: 1px solid #edd48b; color: #6b4e09; padding: 10px 14px; border-radius: 10px; font-size: 13px; max-width: 580px; }
.uploaded-media { max-width: 100%; max-height: 380px; border-radius: 10px; border: 1px solid var(--border); }
iframe.uploaded-media { width: 100%; height: 380px; }

.video-card { padding: 12px; }
.video-box {
  position: relative; background: #101917; border-radius: 12px;
  overflow: hidden; margin-bottom: 10px;
}
.student-box { height: 210px; }
.teacher-box { height: 140px; margin-bottom: 0; }
.video-box video { width: 100%; height: 100%; object-fit: cover; }
.video-label {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 11px;
  padding: 2px 8px; border-radius: 6px;
}
.avatar-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #d9ece7; text-align: center; padding: 12px;
}
.avatar-circle { font-size: 44px; margin-bottom: 6px; }

.chat-card { display: flex; flex-direction: column; height: 290px; padding: 12px; }
.chat-header { font-weight: 700; font-size: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.transcript-log { flex: 1; overflow-y: auto; padding: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 8px 12px; border-radius: 10px; font-size: 13px; max-width: 90%; }
.msg-teacher { background: #e6f3ef; align-self: flex-start; }
.msg-student { background: #f3f4f6; align-self: flex-end; }
.chat-form { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; }

.score-circle {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; font-size: 28px;
}
.score-circle small { font-size: 12px; opacity: 0.8; }

.criteria-list { display: grid; gap: 10px; margin: 18px 0; }
.criterion-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.criterion-top { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }
.report-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 720px) { .report-columns { grid-template-columns: 1fr; } }
.report-box { background: #f9fbfa; border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.next-drill-box { background: #edf7f4; border-right: 4px solid var(--primary); padding: 12px 16px; border-radius: 8px; }
