/* style.css - مدرسة بوابة الذكاء الفائق (الصف الأول المتوسط - المنهج العراقي) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Reem+Kufi:wght@500;600;700&family=Noto+Sans+Math&display=swap');

:root {
  /* خطوط منصة نفهم: IBM Plex Sans Arabic للنص، و Reem Kufi للعناوين */
  --font-base: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-title: 'Reem Kufi', 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --font-math: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;

  /* Color Palette */
  --bg-page: #FAFAF6;
  --bg-card: #ffffff;
  --border-color: #E0E0D6;
  --border-active: #606C38;

  --text-dark: #191914;
  --text-medium: #45453C;
  --text-muted: #75756A;

  --color-primary: #606C38;       /* Iraqi Educational Blue */
  --color-primary-dark: #4A5528;
  --color-primary-light: #EEF0DF;

  --color-emerald: #0d9488;       /* Teal/Emerald */
  --color-emerald-light: #ccfbf1;

  --color-gold: #BC6C25;          /* Amber/Gold */
  --color-gold-light: #FDF0E2;

  --color-purple: #7c3aed;
  --color-purple-light: #ede9fe;

  --color-success: #16a34a;
  --color-success-light: #dcfce7;
  --color-danger: #dc2626;
  --color-danger-light: #fee2e2;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 28px;
}

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

body {
  font-family: var(--font-base);
  background-color: var(--bg-page);
  color: var(--text-dark);
  direction: rtl;
  text-align: right;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================== */
/* MATH DIRECTION RULES: EQUATIONS STRICTLY LTR, ARABIC RTL       */
/* ============================================================== */
.math-ltr {
  direction: ltr !important;
  text-align: left !important;
  display: inline-block;
  font-family: var(--font-math);
  font-weight: 800;
  unicode-bidi: embed;
  padding: 0 4px;
  color: #4A5528;
}

.math-block-ltr {
  direction: ltr !important;
  text-align: center !important;
  font-family: var(--font-math);
  font-size: 1.25rem;
  font-weight: 800;
  background: #ffffff;
  border: 1.5px solid #D6D6CB;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  margin: 0.75rem 0;
  color: #4A5528;
  letter-spacing: 0.5px;
}

/* NAVBAR */
.global-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  cursor: pointer;
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-dark);
  line-height: 1.2;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.nav-center-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-user-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.role-pill-indicator {
  display: inline-flex;
  align-items: center;
  background: #F1F1EA;
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.notif-badge-pill {
  background: var(--color-danger);
  color: white;
  border-radius: 9999px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 900;
  margin-right: 4px;
}

/* NOTIFICATION DRAWER */
.notif-drawer {
  position: fixed;
  top: 65px;
  left: 20px;
  width: 380px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.notif-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
}

.notif-drawer-header h4 {
  font-size: 0.95rem;
  font-weight: 800;
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
}

.notif-item {
  background: #FAFAF6;
  border-right: 4px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.85rem;
}

.notif-item.father-target {
  border-right-color: var(--color-emerald);
}

.notif-title {
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.notif-msg {
  color: var(--text-medium);
  line-height: 1.5;
  white-space: pre-line;
  font-size: 0.82rem;
}

.notif-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* MAIN CONTENT */
.main-content-area {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 1.75rem 1.5rem;
}

.view-panel {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

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

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

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-base);
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 6px rgba(96, 108, 56, 0.2);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

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

.btn-emerald:hover {
  background: #0f766e;
}

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

.btn-purple:hover {
  background: #6d28d9;
}

.btn-outline-dark {
  background: white;
  color: var(--text-dark);
  border: 1.5px solid var(--border-color);
}

.btn-outline-dark:hover {
  background: #FAFAF6;
  border-color: var(--color-primary);
}

.btn-outline-sm {
  background: white;
  color: var(--text-dark);
  border: 1.5px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
}

.btn-outline-sm:hover {
  background: #F1F1EA;
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 800;
  cursor: pointer;
  font-family: var(--font-base);
  font-size: 0.82rem;
  text-decoration: underline;
}

/* BADGES */
.badge-gold {
  background: var(--color-gold-light);
  color: var(--color-gold);
  border: 1px solid #fcd34d;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  display: inline-block;
}

.badge-light {
  background: #F1F1EA;
  color: var(--text-medium);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  display: inline-block;
}

.pill-tag {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: #F1F1EA;
  color: var(--text-medium);
}

/* FORMS */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: right;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-dark);
}

.form-control {
  font-family: var(--font-base);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
}

.form-control:focus {
  border-color: var(--color-primary);
}

/* ============================================================== */
/* VIEW 1: PORTAL ENTRANCE (ZERO ICONS)                           */
/* ============================================================== */
.portal-hero {
  text-align: center;
  margin-bottom: 2.5rem;
  padding: 1.5rem 0;
}

.portal-main-heading {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-dark);
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}

.portal-sub-heading {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto;
}

.portal-roles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.role-entry-card {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.role-entry-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.student-card { border-color: #D8DCC0; }
.student-card:hover { border-color: var(--color-primary); }

.father-card { border-color: #99f6e4; }
.father-card:hover { border-color: var(--color-emerald); }

.teacher-card { border-color: #ddd6fe; }
.teacher-card:hover { border-color: var(--color-purple); }

.admin-card { border-color: #fecaca; }
.admin-card:hover { border-color: var(--color-danger); }

.role-badge {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  margin-bottom: 0.75rem;
}

.role-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.role-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.role-form-group {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #FAFAF6;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.role-form-group label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-medium);
}

.role-quick-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ============================================================== */
/* VIEW 2: FATHER DASHBOARD (DETAILED TRACKING & PROFILE EDIT)    */
/* ============================================================== */
.dashboard-header-bar {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.breadcrumb-tag {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--color-emerald);
  display: inline-block;
  margin-bottom: 0.25rem;
}

.dash-heading {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-dark);
}

.dash-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.section-block {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

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

.count-pill {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.students-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.father-student-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.father-student-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.std-card-top {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.std-photo-thumb {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.std-card-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.3;
}

.std-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.std-details-list {
  background: #FAFAF6;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border: 1px solid var(--border-color);
}

.std-detail-row {
  display: flex;
  justify-content: space-between;
}

.std-access-code-box {
  background: #fef3c7;
  border: 1.5px dashed #f59e0b;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.access-code-val {
  font-family: var(--font-math);
  font-size: 1.25rem;
  font-weight: 900;
  color: #92400e;
  letter-spacing: 2px;
}

/* DETAILED STUDY TRACKER CARD (HOURS, MINUTES, EXERCISES, ERRORS) */
.study-tracker-card {
  background: #FAFAF6;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.study-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.kpi-mini-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: right;
}

.kpi-mini-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
}

.kpi-mini-value {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--color-primary-dark);
  margin-top: 2px;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: right;
  margin-top: 0.5rem;
}

.breakdown-table th {
  background: #F1F1EA;
  padding: 0.65rem 0.85rem;
  border-bottom: 2px solid var(--border-color);
  font-weight: 800;
}

.breakdown-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.tag-correct {
  background: var(--color-success-light);
  color: #166534;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  display: inline-block;
}

.tag-error-corrected {
  background: var(--color-gold-light);
  color: #92400e;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  display: inline-block;
}

/* ============================================================== */
/* VIEW 3: STUDENT DASHBOARD                                      */
/* ============================================================== */
.student-profile-banner {
  background: linear-gradient(135deg, #4A5528, #0c4a6e);
  color: white;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.std-profile-avatar-wrap {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.std-profile-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.std-profile-info { flex: 1; }

.std-profile-name {
  font-size: 1.5rem;
  font-weight: 900;
  margin-top: 0.25rem;
  line-height: 1.2;
}

.std-profile-sub {
  font-size: 0.88rem;
  color: #D8DCC0;
  margin-top: 0.35rem;
}

.std-profile-code-box {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.1rem;
  text-align: center;
}

.std-code-badge {
  font-family: var(--font-math);
  font-size: 1.3rem;
  font-weight: 900;
  color: #fef08a;
  letter-spacing: 2px;
}

.student-options-tabs {
  display: flex;
  gap: 0.5rem;
  background: #E0E0D6;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.tab-pill-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-base);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-medium);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-pill-btn.active {
  background: white;
  color: var(--color-primary-dark);
  box-shadow: var(--shadow-sm);
}

.subtab-pane { display: none; }
.subtab-pane.active { display: block; }

/* 7 TEXTBOOKS CARDS GRID */
.textbooks-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.book-shelf-card {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}

.book-shelf-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.book-shelf-card.featured-book {
  border-color: var(--color-primary);
}

.book-cover-container {
  height: 200px;
  background: #2A2A23;
  position: relative;
  overflow: hidden;
}

.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.book-shelf-card:hover .book-cover-img {
  transform: scale(1.03);
}

.book-tag-official {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.88);
  color: #fef08a;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid rgba(254, 240, 138, 0.3);
}

.book-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.book-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.book-desc {
  font-size: 0.85rem;
  color: var(--text-medium);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.book-footer-bar {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--color-primary);
}

/* WEEKLY TIMETABLE TABLE */
.weekly-timetable-container {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.timetable-tbl {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.88rem;
}

.timetable-tbl th {
  background: #F1F1EA;
  color: var(--text-dark);
  padding: 0.85rem;
  border-bottom: 2px solid var(--border-color);
  font-weight: 800;
}

.timetable-tbl td {
  padding: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.period-cell {
  background: #FAFAF6;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.35rem;
}

.period-sub-name {
  font-weight: 800;
  color: var(--text-dark);
  font-size: 0.85rem;
}

.period-teacher {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================== */
/* VIEW 4: CHAPTERS DRILL-DOWN (PAGE RANGES CLEARLY ON CARDS)    */
/* ============================================================== */
.drilldown-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  background: white;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.breadcrumb-trail {
  font-size: 0.9rem;
  color: var(--text-medium);
}

.book-banner-card {
  background: linear-gradient(135deg, #606C38, #3E4822);
  color: white;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.book-banner-heading {
  font-size: 1.4rem;
  font-weight: 900;
}

.book-banner-sub {
  font-size: 0.88rem;
  color: #EEF0DF;
}

.chapters-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.chapter-card-item {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.chapter-card-item:hover {
  border-color: var(--color-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.chapter-pages-pill {
  align-self: flex-start;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

.chapter-card-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.chapter-card-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.chapter-card-action {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
  font-weight: 800;
  color: var(--color-primary);
  font-size: 0.88rem;
}

/* ============================================================== */
/* VIEW 5: TOPICS LIST VIEW                                       */
/* ============================================================== */
.chapter-info-summary {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.topics-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.topic-row-card {
  background: white;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.topic-row-card:hover {
  border-color: var(--color-primary);
  transform: translateX(-3px);
  background: #FAFAF6;
}

.topic-row-card.featured-topic {
  border-color: #97A363;
  background: #FAFAF3;
}

.topic-row-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topic-num-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-weight: 900;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topic-title-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
}

.topic-page-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* ============================================================== */
/* VIEW 6: TOPIC FULL SCREEN & THE 6-ELEMENT TOP RIBBON           */
/* ============================================================== */
.topic-header-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.topic-badge-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.topic-main-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.topic-citation-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* THE 6-ELEMENT TOP RIBBON */
.topic-top-ribbon-bar {
  position: sticky;
  top: 70px;
  z-index: 90;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.35rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-md);
}

.topic-ribbon-nav {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
}

.ribbon-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-base);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-medium);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
}

.ribbon-tab-btn:hover {
  background: #F1F1EA;
  color: var(--text-dark);
}

.ribbon-tab-btn.active {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 6px rgba(96, 108, 56, 0.2);
}

.topic-tab-pane {
  display: none;
  animation: fadeIn 0.2s ease;
}

.topic-tab-pane.active {
  display: block;
}

.content-box {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.content-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.content-box-header h3 {
  font-size: 1.2rem;
  font-weight: 900;
}

/* ============================================================== */
/* SYNCHRONIZED TOPIC TOOLBAR (شريط مزامنة الموضوع الدراسي)       */
/* ============================================================== */
.topic-synced-toolbar-box {
  background: #FAFAF6;
  border: 1.5px solid #D6D6CB;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.topic-synced-toolbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.topic-nav-side {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.topic-synced-selector-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topic-selector-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #56564C;
  white-space: nowrap;
}

.topic-synced-dropdown {
  font-family: var(--font-base);
  font-size: 0.92rem;
  font-weight: 800;
  color: #4A5528;
  background: #ffffff;
  border: 1.5px solid #606C38;
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(96, 108, 56, 0.1);
}

.topic-synced-dropdown:hover,
.topic-synced-dropdown:focus {
  border-color: #4A5528;
  background: #FAFAF3;
}

.topic-synced-status-side {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.topic-nav-dir-btn {
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
}

/* ============================================================== */
/* SECTION 1: AUTHENTIC PAGE-BY-PAGE TEXTBOOK VIEWER             */
/* ============================================================== */
.topic-page-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: #FAFAF3;
  border: 1.5px solid #D8DCC0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
}

.topic-page-nav-bar.bottom-nav {
  margin-top: 1.5rem;
  margin-bottom: 0;
  background: #FAFAF6;
  border-color: #E0E0D6;
}

.page-pills-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.page-pill-btn {
  border: 1px solid #D6D6CB;
  background: #ffffff;
  color: #45453C;
  font-family: var(--font-base);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-pill-btn:hover {
  background: #EEF0DF;
  color: #4A5528;
  border-color: #97A363;
}

.page-pill-btn.active {
  background: #606C38;
  border-color: #606C38;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(96, 108, 56, 0.25);
  transform: translateY(-1px);
}

.page-counter-badge {
  font-size: 0.88rem;
  font-weight: 900;
  color: #4A5528;
  background: #ffffff;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  border: 1px solid #D8DCC0;
}

.nav-page-dir-btn {
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-page-dir-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: #D6D6CB !important;
  color: #A3A396 !important;
}

.textbook-single-page-paper {
  background: #ffffff;
  border: 2px solid #D6D6CB;
  border-radius: var(--radius-md);
  padding: 2.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  position: relative;
  min-height: 520px;
  animation: fadeIn 0.25s ease;
}

.tb-page-number-seal {
  width: 44px;
  height: 44px;
  background: #fef08a;
  color: #854d0e;
  border: 1.5px solid #eab308;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.88rem;
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.25);
}

.tb-page-footer-seal {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1.5px dashed #D6D6CB;
}

.tb-footer-page-num {
  background: #F1F1EA;
  border: 1px solid #D6D6CB;
  color: #56564C;
  padding: 0.3rem 1.25rem;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.85rem;
}

.tb-page-header {
  border-bottom: 2px solid #4A5528;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.tb-page-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.tb-page-title-ar {
  font-size: 1.4rem;
  font-weight: 900;
  color: #4A5528;
  line-height: 1.3;
}

.tb-page-title-en {
  font-family: var(--font-math);
  font-size: 0.95rem;
  color: #75756A;
  direction: ltr;
  text-align: left;
}

.tb-page-key-box {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  font-size: 0.85rem;
}

.tb-page-section-box {
  background: #FAFAF6;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.tb-section-title {
  font-size: 1.05rem;
  font-weight: 900;
  color: #191914;
  margin-bottom: 0.5rem;
}

.tb-section-text {
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--text-dark);
  white-space: pre-line;
}

.tb-example-item {
  background: white;
  border: 1px solid #E0E0D6;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 0.75rem;
}

/* ============================================================== */
/* AUTHENTIC IRAQI TEXTBOOK REPLICA STYLING (طبعة وزارة التربية)  */
/* ============================================================== */
.iraq-tb-page-paper {
  background: #ffffff;
  border: 2px solid #D6D6CB;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  position: relative;
  font-family: inherit;
  color: #2A2A23;
  margin-bottom: 1.5rem;
}

/* Top Official Header Bar */
.iraq-tb-header-bar {
  background: #fde8c4;
  border-radius: 10px;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  margin-bottom: 1.25rem;
  border: 1.5px solid #fbd38d;
}

.iraq-tb-lesson-badge-red {
  background: #dc2626;
  color: white;
  padding: 0.85rem 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 90px;
}

.iraq-tb-lesson-badge-red .lb-title {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
}

.iraq-tb-lesson-badge-red .lb-code {
  font-size: 1.6rem;
  font-weight: 900;
  margin-top: 3px;
  letter-spacing: 1px;
}

.iraq-tb-header-titles {
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.iraq-tb-title-ar {
  font-size: 1.35rem;
  font-weight: 900;
  color: #2A2A23;
  margin: 0;
  line-height: 1.3;
}

.iraq-tb-title-en {
  font-size: 0.9rem;
  color: #75756A;
  font-weight: 600;
  direction: ltr;
  text-align: right;
  margin-top: 3px;
}

/* Two Columns Split (Notepad on right, story on left) */
.iraq-tb-top-split-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 850px) {
  .iraq-tb-top-split-grid {
    grid-template-columns: 1fr;
  }
}

/* Spiral Notepad on Right */
.iraq-tb-spiral-notepad {
  background: #fefce8;
  border: 1.5px solid #fef08a;
  border-radius: 10px;
  padding: 1.25rem 1.5rem 1.25rem 1.25rem;
  position: relative;
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.1);
}

/* Simulated Metal Spiral Coil Rings */
.iraq-tb-spiral-rings-track {
  position: absolute;
  top: 10px;
  bottom: 10px;
  right: -9px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 18px;
}

.iraq-tb-ring {
  width: 18px;
  height: 8px;
  background: linear-gradient(180deg, #A3A396 0%, #D6D6CB 50%, #75756A 100%);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.iraq-tb-notepad-sec-title {
  color: #dc2626;
  font-size: 1.05rem;
  font-weight: 900;
  margin-bottom: 0.35rem;
}

.iraq-tb-notepad-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.85rem 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #45453C;
}

.iraq-tb-notepad-list li {
  margin-bottom: 0.3rem;
  position: relative;
  padding-right: 0.85rem;
}

.iraq-tb-notepad-list li::before {
  content: "•";
  position: absolute;
  right: 0;
  color: #dc2626;
  font-weight: bold;
}

/* Learn Story Box on Left */
.iraq-tb-story-box {
  background: #FAFAF6;
  border: 1.5px solid #E0E0D6;
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.iraq-tb-learn-pill {
  align-self: flex-start;
  background: #606C38;
  color: white;
  padding: 0.3rem 1.25rem;
  border-radius: 20px;
  font-weight: 900;
  font-size: 0.95rem;
}

.iraq-tb-story-content-row {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

@media (max-width: 600px) {
  .iraq-tb-story-content-row {
    flex-direction: column;
  }
}

.iraq-tb-orange-basket-img {
  width: 150px;
  height: 110px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid #fed7aa;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.2);
  flex-shrink: 0;
}

.iraq-tb-story-text {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #2A2A23;
  margin: 0;
}

/* Deep Blue Section Banner */
.iraq-tb-sub-banner {
  background: #606C38;
  color: white;
  border-radius: 25px;
  padding: 0.6rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-weight: 800;
}

.iraq-tb-sub-banner-ar {
  font-size: 1.05rem;
}

.iraq-tb-sub-banner-en {
  font-size: 0.88rem;
  direction: ltr;
  opacity: 0.9;
}

/* Cyan Intro Box */
.iraq-tb-intro-box {
  background: #FAFAF3;
  border: 1.5px solid #D8DCC0;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
  line-height: 1.8;
}

.iraq-tb-integers-set {
  font-family: var(--font-math);
  direction: ltr;
  font-size: 1.1rem;
  font-weight: 800;
  color: #4A5528;
  display: inline-block;
  margin-right: 0.5rem;
}

/* Examples Boxes */
.iraq-tb-example-box {
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  background: #ffffff;
}

.iraq-tb-example-box.orange-theme {
  border: 2px solid #fb923c;
  background: #fffaf5;
}

.iraq-tb-example-box.blue-theme {
  border: 2px solid #97A363;
  background: #f8fcff;
}

.iraq-tb-ex-pill {
  display: inline-block;
  padding: 0.35rem 1.25rem;
  border-radius: 20px;
  font-weight: 900;
  font-size: 0.95rem;
  margin-left: 0.75rem;
}

.iraq-tb-ex-pill.orange {
  background: #ea580c;
  color: white;
}

.iraq-tb-ex-pill.blue {
  background: #606C38;
  color: white;
}

.iraq-tb-ex-title {
  font-size: 1.05rem;
  font-weight: 900;
  color: #191914;
}

.iraq-tb-ex-sub {
  font-size: 0.92rem;
  color: #45453C;
  margin: 0.4rem 0 0.85rem 0;
}

/* Math on Left, Sky-Blue Arabic Step Annotations on Right */
.iraq-tb-step-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px dashed #E0E0D6;
}

.iraq-tb-step-row:last-child {
  border-bottom: none;
}

.iraq-tb-math-val {
  font-family: var(--font-math);
  direction: ltr;
  font-size: 1.15rem;
  font-weight: 800;
  color: #191914;
}

.iraq-tb-step-note {
  font-size: 0.88rem;
  font-weight: 800;
  color: #606C38;
}

/* Interactive Math Lab Problem Selector & Stepper */
.lab-problems-pills-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.lab-prob-pill-btn {
  background: #F1F1EA;
  border: 1.5px solid #D6D6CB;
  color: #45453C;
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lab-prob-pill-btn:hover {
  background: #E0E0D6;
  border-color: #A3A396;
}

.lab-prob-pill-btn.active {
  background: #606C38;
  border-color: #606C38;
  color: white;
  box-shadow: 0 2px 6px rgba(96, 108, 56, 0.3);
}

.lab-stepper-stage-card {
  background: white;
  border: 2px solid #97A363;
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
}

.lab-stepper-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1.5px solid #F1F1EA;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Page 14 Exercises Grid */
.tb-ex-grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.tb-ex-card {
  background: #FAFAF6;
  border: 1.5px solid #E0E0D6;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tb-ex-num {
  width: 28px;
  height: 28px;
  background: #606C38;
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.82rem;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

/* SECTION 2: PRO AI EXPLANATION */
.pro-theme-box {
  border-color: #fde68a;
  background: #fffdf5;
}

.golden-rule-card {
  background: white;
  border: 1.5px solid #fef08a;
  border-right: 5px solid #d97706;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.golden-rule-card h4 {
  font-size: 1rem;
  font-weight: 900;
  color: #92400e;
  margin-bottom: 0.35rem;
}

.golden-rule-card p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-dark);
  white-space: pre-line;
}

/* SECTION 3: REAL WORLD ANALOGY */
.analogy-story-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-right: 5px solid #16a34a;
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.analogy-story-card h4 {
  font-size: 1.05rem;
  font-weight: 900;
  color: #166534;
  margin-bottom: 0.5rem;
}

.analogy-story-card p {
  font-size: 0.92rem;
  line-height: 1.8;
  color: #14532d;
  white-space: pre-line;
}

/* SECTION 4: INTERACTIVE MATH LAB */
.lab-widget {
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.number-line-container {
  background: white;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.number-line-slider {
  width: 100%;
  margin: 1.5rem 0;
  cursor: pointer;
}

.number-line-visual {
  width: 100%;
  min-height: 90px;
  position: relative;
  margin-bottom: 1rem;
}

.lab-math-display {
  background: #F1F1EA;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.5rem;
  text-align: center;
  font-family: var(--font-math);
  font-size: 1.3rem;
  font-weight: 900;
  color: #4A5528;
  direction: ltr;
}

/* SECTION 5: STEP-BY-STEP SOLVED EXERCISES */
.exercise-box {
  background: white;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.exercise-question-title {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border-color);
}

.exercise-steps-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-right: 1.25rem;
}

.exercise-steps-list li {
  font-size: 0.92rem;
  line-height: 1.7;
}

.exercise-caution-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.85rem;
  color: #92400e;
  font-weight: 700;
}

/* SECTION 6: TOPIC QUIZ */
.quiz-question-wrap {
  background: #FAFAF6;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.quiz-q-title {
  font-size: 1.05rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.quiz-options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.quiz-choice-lbl {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: white;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.92rem;
  width: 100%;
  font-family: inherit;
  color: inherit;
  text-align: start;
  min-height: 44px;
}

.quiz-choice-lbl:disabled {
  cursor: default;
  opacity: 1;
}

.quiz-choice-lbl:disabled:not(.correct-pick):not(.wrong-pick) {
  opacity: 0.6;
}

.quiz-choice-lbl:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.quiz-choice-lbl:not(:disabled):hover {
  border-color: var(--color-primary);
  background: #FAFAF3;
}

.quiz-choice-lbl.correct-pick {
  border-color: var(--color-success);
  background: var(--color-success-light);
  color: #14532d;
  font-weight: 800;
}

.quiz-choice-lbl.wrong-pick {
  border-color: var(--color-danger);
  background: var(--color-danger-light);
  color: #7f1d1d;
}

/* ============================================================== */
/* VIEW 8: ADMIN BOOK COVERS GRID                                 */
/* ============================================================== */
.admin-books-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.admin-book-edit-card {
  background: #FAFAF6;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-book-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* PEDAGOGY STEP BY STEP CARD (FROM USER SPEC) */
.pedagogy-step-card {
  background: #f0f7ff;
  border: 1.5px solid #D8DCC0;
  border-right: 5px solid #606C38;
  border-radius: var(--radius-md);
  padding: 1.25rem 1.75rem;
  margin-bottom: 1.5rem;
}

.pedagogy-step-heading {
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 800;
  color: #0c4a6e;
  margin-bottom: 0.35rem;
  letter-spacing: -0.2px;
}

.pedagogy-step-text {
  font-family: var(--font-base);
  font-size: 1rem;
  font-weight: 400;
  color: #45453C;
  line-height: 1.8;
}

/* MODALS */
.modal-overlay-custom {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-dialog-box {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
}

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

.modal-dialog-header h3 {
  font-size: 1.2rem;
  font-weight: 900;
}

.modal-close-icon {
  background: #F1F1EA;
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 800;
}

.modal-dialog-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* TOAST */
.toast-box {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: #191914;
  color: white;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  display: none;
}

.toast-box.show {
  display: block;
  animation: slideUp 0.3s ease;
}

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

/* RESPONSIVE */
@media (max-width: 1024px) {
  .portal-roles-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .portal-roles-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .dashboard-header-bar,
  .student-profile-banner { flex-direction: column; align-items: flex-start; }
  .topic-top-ribbon-bar { top: 60px; }
  .notif-drawer { width: 92%; left: 4%; }
}

/* ============================================================== */
/* SYSTEM ARCHITECTURE UTILITIES */
/* ============================================================== */

/* Portal Showcase */
.council-portal-section {
  background: linear-gradient(135deg, #FAFAF6 0%, #F6F6EC 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 1.75rem;
}

.council-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.council-mini-card {
  background: #ffffff;
  border: 1px solid #E0E0D6;
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.council-mini-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.08);
}

.council-mini-card h4 {
  font-size: 0.95rem;
  font-weight: 900;
  color: #191914;
  margin: 0.5rem 0 0.35rem 0;
}

.council-mini-card p {
  font-size: 0.82rem;
  color: #56564C;
  line-height: 1.55;
  margin: 0;
}

.c-role-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.tech-pill { background: #dbeafe; color: #1e40af; }
.peda-pill { background: #fef3c7; color: #92400e; }
.teacher-pill { background: #dcfce7; color: #166534; }
.super-pill { background: #ede9fe; color: #5b21b6; }
.design-pill { background: #fee2e2; color: #991b1b; }
.visual-pill { background: #fce7f3; color: #9d174d; }

/* Study View Accreditation Banner */
.council-accreditation-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.council-accreditation-bar:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.council-acc-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.council-acc-badge {
  background: #16a34a;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.council-acc-text {
  font-size: 0.84rem;
  font-weight: 700;
  color: #14532d;
}

.btn-council-pill {
  background: #ffffff;
  border-color: #16a34a;
  color: #15803d;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 0.35rem 0.85rem;
}

.btn-council-pill:hover {
  background: #16a34a;
  color: #ffffff;
}

/* Council Modal Backdrop & Card */
.council-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.council-modal-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  border: 1px solid #E0E0D6;
  display: flex;
  flex-direction: column;
}

.council-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid #E0E0D6;
  background: #FAFAF6;
}

.council-active-topic-report {
  padding: 1.25rem 1.75rem;
  background: #F6F6EC;
  border-bottom: 1px solid #bfdbfe;
}

.council-advisors-detailed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 1.75rem;
}

.advisor-card {
  background: #FAFAF6;
  border: 1px solid #E0E0D6;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.advisor-header h4 {
  font-size: 1rem;
  font-weight: 900;
  color: #191914;
  margin: 0.5rem 0 0.15rem 0;
}

.advisor-alias {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  color: #75756A;
  margin-bottom: 0.75rem;
}

.advisor-body p {
  font-size: 0.83rem;
  color: #45453C;
  line-height: 1.55;
  margin: 0 0 0.85rem 0;
}

.advisor-stat-pill {
  font-size: 0.76rem;
  font-weight: 800;
  color: #4A5528;
  background: #EEF0DF;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #D8DCC0;
}

.council-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.25rem 1.75rem;
  background: #FAFAF6;
  border-top: 1px solid #E0E0D6;
}

/* ============================================================== */
/* MASTER BOOK PAGES EXPLORER (1 TO 157) STYLES                    */
/* ============================================================== */
.master-pages-header-banner {
  background: linear-gradient(135deg, #606C38 0%, #4A5528 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  box-shadow: var(--shadow-md);
}

.master-pages-header-banner h2 {
  font-size: 1.45rem;
  font-weight: 900;
  margin-bottom: 0.35rem;
  letter-spacing: -0.5px;
}

.master-pages-header-banner p {
  font-size: 0.92rem;
  opacity: 0.92;
  line-height: 1.6;
}

.master-chapter-filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.25rem;
  background: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.master-chapter-btn {
  font-family: var(--font-base);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.45rem 0.85rem;
  border-radius: 20px;
  border: 1px solid #D6D6CB;
  background: #FAFAF6;
  color: #45453C;
  cursor: pointer;
  transition: all 0.2s ease;
}

.master-chapter-btn:hover {
  background: #E0E0D6;
  color: #191914;
}

.master-chapter-btn.active {
  background: #606C38;
  color: #ffffff;
  border-color: #4A5528;
  box-shadow: 0 2px 4px rgba(96, 108, 56, 0.25);
}

.master-navigator-box {
  background: #ffffff;
  border: 1.5px solid #D6D6CB;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.master-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.master-page-slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 280px;
}

.master-page-slider {
  flex: 1;
  height: 8px;
  accent-color: #606C38;
  cursor: pointer;
}

.master-split-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (max-width: 900px) {
  .master-split-container {
    grid-template-columns: 1fr;
  }
}

.master-col-card {
  background: #ffffff;
  border: 1.5px solid #D6D6CB;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.master-col-header {
  padding: 0.9rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #E0E0D6;
  font-weight: 900;
  font-size: 0.95rem;
}

.master-col-header.verbatim-head {
  background: #fefce8;
  color: #854d0e;
  border-bottom-color: #fef08a;
}

.master-col-header.interactive-head {
  background: #FAFAF3;
  color: #4A5528;
  border-bottom-color: #D8DCC0;
}

.master-col-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  max-height: 850px;
}

.master-raw-text-view {
  font-family: var(--font-base);
  font-size: 0.9rem;
  line-height: 1.85;
  color: #2A2A23;
  white-space: pre-wrap;
  background: #fffdf5;
  border: 1px solid #fef08a;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
}

.master-official-seal {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 900;
}


/* ============================================================== */
/* إصلاحات الجوال (360–700px): منع الفيض الأفقي وترويسة مضغوطة    */
/* ============================================================== */
.app-root { overflow-x: clip; }
img, svg, video, iframe { max-width: 100%; }
.students-cards-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.admin-books-edit-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.council-mini-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.topic-top-ribbon-bar, .topic-synced-toolbar-box, .content-box { min-width: 0; max-width: 100%; }
.topic-synced-dropdown { max-width: 100%; min-width: 0; text-overflow: ellipsis; }

@media (max-width: 700px) {
  .global-navbar {
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.4rem 0.5rem;
  }
  .brand-title { font-size: 1rem; white-space: nowrap; }
  .brand-tagline { display: none; }
  .nav-center-actions { display: none; }
  .nav-long { display: none; }
  .nav-user-actions {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .nav-user-actions::-webkit-scrollbar { display: none; }
  .nav-user-actions .btn { flex: 0 0 auto; white-space: nowrap; font-size: 0.78rem; padding: 0.4rem 0.7rem; }

  .main-content-area { padding: 1rem 0.75rem; }
  .content-box { padding: 1rem; border-radius: var(--radius-md); }
  .content-box-header { flex-wrap: wrap; gap: 0.5rem; }

  .topic-ribbon-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3rem; overflow: visible; }
  .ribbon-tab-btn { padding: 0.5rem 0.35rem; font-size: 0.78rem; white-space: normal; line-height: 1.3; min-height: 44px; }

  .topic-synced-toolbar-box { padding: 0.65rem 0.75rem; }
  .topic-nav-side, .topic-synced-selector-wrap { width: 100%; flex-wrap: wrap; }
  .topic-synced-dropdown { width: 100%; font-size: 0.85rem; }

  .father-student-card, .lab-widget, .exercise-box { padding: 1rem; }
  .number-line-container { padding: 1rem 0.5rem; }
  .lab-math-display { font-size: 1.1rem; padding: 0.6rem 1rem; }
  table { display: block; overflow-x: auto; max-width: 100%; }
}

/* الكتب غير المكتملة: بطاقة باهتة بشارة "قريباً" */
.book-shelf-card.book-coming-soon { cursor: default; opacity: 0.78; }
.book-shelf-card.book-coming-soon:hover { transform: none; box-shadow: none; }
.book-shelf-card.book-coming-soon .book-cover-img { filter: grayscale(0.55); }
.book-shelf-card.book-coming-soon .book-tag-official { background: #75756A; color: #fff; }
.book-shelf-card:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 3px; }

/* ============================================================== */
/* صفحة الكتاب الأصلية (صورة) ومفتاح التبديل إلى النسخة النصية      */
/* ============================================================== */
.book-view-toggle {
  display: inline-flex;
  gap: 0.25rem;
  background: #F1F1EA;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.25rem;
  margin: 0.75rem 0 1rem;
}
.book-view-toggle button {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text-medium);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 40px;
}
.book-view-toggle button.active { background: #fff; color: var(--color-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.book-page-figure {
  margin: 0 auto 1rem;
  max-width: 820px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.5rem;
  box-shadow: var(--shadow-sm);
}
.book-page-img { display: block; width: 100%; height: auto; border-radius: 6px; cursor: zoom-in; aspect-ratio: 993 / 1404; background: #FAFAF6; }
.book-page-figure figcaption { text-align: center; font-size: 0.78rem; color: #75756A; margin-top: 0.4rem; }
.book-text-note {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: 8px; padding: 0.5rem 0.85rem; font-size: 0.82rem; margin-bottom: 0.75rem;
}
.site-rights-note { text-align: center; font-size: 0.78rem; color: #75756A; padding: 1rem 1rem 1.5rem; line-height: 1.7; }

/* ============================================================== */
/* المختبرات المرئية (labs_visual.js)                               */
/* ============================================================== */
.vl-lab { background: #fff; border: 1.5px solid #D8DCC0; border-radius: 12px; padding: 1.25rem; }
.vl-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.vl-title { margin: 0; font-size: 1.15rem; font-weight: 900; color: #4A5528; }
.vl-pages { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.75rem; font-weight: 800; }
.vl-intro { font-size: 0.9rem; color: #56564C; line-height: 1.8; margin: 0 0 0.9rem; }
.vl-controls { background: #FAFAF6; border: 1px solid #E0E0D6; border-radius: 10px; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.vl-controls > .btn { align-self: flex-start; }
.vl-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 0.5rem 1rem; }
.vl-slider { display: grid; grid-template-columns: minmax(110px, auto) 1fr 2.5rem; align-items: center; gap: 0.6rem; font-size: 0.85rem; font-weight: 800; color: #45453C; }
.vl-slider input { width: 100%; accent-color: #606C38; min-height: 28px; }
.vl-slider-val { text-align: center; font-weight: 900; color: #606C38; font-size: 1.05rem; }
.vl-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.vl-pill { border: 1.5px solid #D6D6CB; background: #fff; color: #45453C; font-family: inherit; font-weight: 800; font-size: 0.82rem; border-radius: 999px; padding: 0.4rem 0.85rem; cursor: pointer; min-height: 38px; }
.vl-pill.active { background: #606C38; border-color: #606C38; color: #fff; }
.vl-stage { display: flex; flex-direction: column; gap: 0.75rem; }
.vl-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.vl-center { justify-content: center; text-align: center; }
.vl-op { font-size: 2rem; font-weight: 900; color: #191914; }
.vl-pie { width: 120px; height: auto; }
.vl-bar { width: 100%; max-width: 320px; height: auto; display: block; margin-top: 0.3rem; }
.vl-barwrap { direction: ltr; }
.vl-svg { width: 100%; max-width: 520px; height: auto; margin: 0 auto; display: block; }
.vl-math { font-family: var(--font-math, inherit); font-weight: 800; color: #4A5528; unicode-bidi: isolate; white-space: nowrap; }
.vl-steps { margin: 0; padding-inline-start: 1.4rem; line-height: 2; font-size: 0.92rem; color: #2A2A23; }
.vl-steps li { margin-bottom: 0.25rem; }
.vl-expr { text-align: center; font-size: 1.25rem; font-weight: 900; padding: 0.5rem; background: #F6F6EC; border-radius: 8px; }
.vl-result { text-align: center; font-size: 1.05rem; font-weight: 800; color: #191914; }
.vl-note { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 8px; padding: 0.5rem 0.75rem; font-size: 0.85rem; }
.vl-muted { color: #75756A; font-size: 0.85rem; }
.vl-try { background: #FAFAF3; border: 1.5px dashed #B5BE8C; border-radius: 10px; padding: 0.75rem; font-size: 0.9rem; }
.vl-try-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.vl-try-row input { flex: 1; min-width: 120px; max-width: 200px; font-family: inherit; font-size: 1rem; font-weight: 800; padding: 0.45rem 0.6rem; border: 1.5px solid #A3A396; border-radius: 8px; text-align: center; }
.vl-try-ok { background: #f0fdf4; border: 1px solid #86efac; color: #14532d; border-radius: 8px; padding: 0.5rem 0.75rem; margin-top: 0.5rem; font-weight: 800; }
.vl-try-no { background: #fef2f2; border: 1px solid #fca5a5; color: #7f1d1d; border-radius: 8px; padding: 0.5rem 0.75rem; margin-top: 0.5rem; font-weight: 700; }
.vl-moves { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.vl-tile-buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.vl-tile-btn-group { display: inline-flex; gap: 0.25rem; }
.vl-neg { color: #b91c1c !important; border-color: #fca5a5 !important; }
.vl-tile-board { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; min-height: 56px; padding: 0.6rem; background: #fafafa; border: 1px dashed #D6D6CB; border-radius: 8px; direction: ltr; }
.vl-tile-group { display: flex; flex-direction: column; gap: 0.3rem; }
.vl-tile-group-title { font-size: 0.85rem; font-weight: 800; color: #45453C; }
.vl-tile.vl-zero { opacity: 0.35; }
.vl-hist { background: #FAFAF6; border-radius: 8px; padding: 0.5rem 0.5rem 0.5rem 0; padding-inline-start: 1.8rem; }
.vl-table { border-collapse: collapse; margin: 0 auto; font-size: 0.9rem; }
.vl-table th, .vl-table td { border: 1px solid #D6D6CB; padding: 0.35rem 0.7rem; text-align: center; }
.vl-table th { background: #F1F1EA; font-weight: 900; }
.vl-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 2.2rem; padding: 0.2rem 0.5rem; border-radius: 6px; border: 1.5px solid #D6D6CB; background: #fff; font-weight: 800; font-size: 0.9rem; }
.vl-chip.used { background: #EEF0DF; border-color: #B5BE8C; color: #4A5528; }
.vl-chip.next { border-color: #f59e0b; box-shadow: 0 0 0 2px #fde68a; }
.vl-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; direction: ltr; justify-content: center; }
.vl-qa { display: grid; gap: 0.4rem; }
.vl-qa details { background: #FAFAF6; border: 1px solid #E0E0D6; border-radius: 8px; padding: 0.45rem 0.75rem; }
.vl-qa summary { cursor: pointer; font-weight: 800; }
@media (max-width: 700px) {
  .vl-lab { padding: 0.85rem; }
  .vl-slider { grid-template-columns: 1fr 2.2rem; }
  .vl-slider-label { grid-column: 1 / -1; }
}
.btn .vl-math, .vl-try-ok .vl-math, .vl-try-no .vl-math { color: inherit; }
.vl-cubebtn { display: inline-flex; flex-direction: column; align-items: center; gap: 0.2rem; background: #fff; border: 1.5px solid #D6D6CB; border-radius: 10px; padding: 0.4rem 0.6rem; font-family: inherit; font-weight: 800; font-size: 0.8rem; cursor: pointer; min-width: 64px; }
.vl-cubebtn:disabled { opacity: 0.35; cursor: default; }
.vl-slots { gap: 0.4rem; min-height: 60px; }
.vl-slot { display: inline-block; width: 48px; height: 48px; border: 2px dashed #A3A396; border-radius: 6px; }
.vl-cubestrip { display: inline-flex; gap: 1px; padding: 3px; background: #FAFAF6; border: 1px solid #E0E0D6; border-radius: 6px; }
.vl-box { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 0.75rem; background: #fef3c7; border: 2px solid #d97706; border-radius: 8px 8px 14px 14px; max-width: 360px; margin: 0 auto; }
.vl-ball { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset -3px -3px 0 rgba(0,0,0,0.15); display: inline-block; }
.vl-stemleaf td:first-child { width: 4rem; background: #F1F1EA; }



/* ============================================================== */
/* شرح المعلم بشكل ورقة كتاب (teacher_pages.js)                    */
/* ============================================================== */
:root {
  --tp-paper: #fffdf7;
  --tp-ink: #1f2328;
  --tp-band: #f6d77d;
  --tp-badge: #d42a2f;
  --tp-q: #155a65;
  --font-book: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}
.tp-paper {
  max-width: 820px; margin: 0 auto; background: var(--tp-paper); color: var(--tp-ink);
  border: 1px solid #e8dcc2; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(120,90,30,.08);
  padding: clamp(1rem, 4vw, 2.4rem) clamp(0.9rem, 4.5vw, 2.6rem) 1.4rem;
  font-family: var(--font-book); font-size: 1.16rem; line-height: 2.05;
}
.tp-band { display: flex; align-items: stretch; margin-bottom: 1.4rem; border-radius: 4px; overflow: hidden; box-shadow: 0 2px 0 #d9b85a; }
.tp-band-badge { background: var(--tp-badge); color: #fff; min-width: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.35rem 0.6rem; line-height: 1.2; }
.tp-band-badge span { font-size: 0.95rem; font-weight: 600; }
.tp-band-badge strong { font-size: 1.7rem; font-weight: 700; font-family: var(--font-math, sans-serif); }
.tp-band-title { flex: 1; background: var(--tp-band); padding: 0.55rem 1rem; display: flex; flex-direction: column; justify-content: center; }
.tp-band-title h3 { margin: 0; font-family: var(--font-book); font-weight: 700; font-size: clamp(1.15rem, 3.4vw, 1.55rem); line-height: 1.5; color: #1b1b1b; }
.tp-band-title span { font-size: 0.82rem; color: #6b5a24; font-family: var(--font-base); }
.tp-flow { display: flex; flex-direction: column; }
.tp-p, .tp-q { margin: 0 0 0.35rem; text-align: start; }
.tp-q { color: var(--tp-q); font-weight: 700; margin-top: 0.5rem; }
.tp-box { position: relative; border: 2px solid #8cc0e8; border-radius: 10px; padding: 1.5rem 1.1rem 0.8rem; margin: 1.6rem 0 0.6rem; background: #fff; }
.tp-box-tab { position: absolute; top: -0.95rem; inset-inline-start: 0.9rem; margin: 0; background: #fde4d0; color: #3b2a1a; border: 1px solid #f2c8a8; border-radius: 6px; padding: 0.05rem 0.85rem; font-family: var(--font-book); font-size: 1.02rem; font-weight: 700; line-height: 1.8; max-width: calc(100% - 1.8rem); }
.tp-box.tp-mistake { border-color: #e9a0a0; background: #fffafa; }
.tp-box.tp-mistake .tp-box-tab { background: #fde2e2; border-color: #f2b8b8; color: #8a1c1c; }
.tp-box.tp-life { border-color: #9fd3a8; background: #fbfffb; }
.tp-box.tp-life .tp-box-tab { background: #dff3e3; border-color: #b6e0bf; color: #1d5a2a; }
.tp-box.tp-book { border-color: #b9a7e6; background: #fdfcff; }
.tp-box.tp-book .tp-box-tab { background: #ece6fb; border-color: #cfc2f1; color: #45307e; }
.tp-box.tp-exam { border-color: #f0c070; background: #fffdf5; }
.tp-box.tp-exam .tp-box-tab { background: #fdeccb; border-color: #f2d49a; color: #7a4a05; }
.tp-math { direction: ltr; text-align: center; margin: 0.2rem 0 0.45rem; font-size: 1.22rem; overflow-x: auto; overflow-y: hidden; padding: 0.1rem 0; }
.tp-math-plain { font-family: 'Cambria Math', 'Noto Sans Math', 'Times New Roman', serif; font-weight: 500; letter-spacing: 0.02em; }
.tp-paper math { font-family: 'Cambria Math', 'STIX Two Math', 'Noto Sans Math', math; font-size: 1.12em; }
.tp-paper p math { font-size: 1.05em; }
.tp-rule { background: #fff3a6; border-inline-start: 5px solid #e2b007; border-radius: 4px; padding: 0.35rem 0.8rem; margin: 0.4rem 0 0.6rem; font-weight: 700; }
.tp-and { color: #7a7a7a; padding-inline-start: 1.2rem; font-size: 1rem; }
.tp-table-wrap { overflow-x: auto; margin: 0.5rem 0 0.8rem; }
.tp-table { border-collapse: collapse; margin: 0 auto; font-size: 1.02rem; min-width: 50%; background: #fff; }
.tp-table th, .tp-table td { border: 1px solid #7fb3d5; padding: 0.25rem 0.8rem; text-align: center; line-height: 1.7; }
.tp-table th { background: #d9ecf7; font-weight: 700; }
.tp-folio { text-align: center; margin-top: 1.2rem; font-family: var(--font-math, sans-serif); font-size: 1.05rem; color: #555; }
@media (max-width: 700px) {
  .tp-paper { font-size: 1.08rem; line-height: 1.95; border-radius: 0; border-inline: 0; }
  .tp-band-badge { min-width: 64px; }
  .tp-box { padding: 1.4rem 0.75rem 0.6rem; }
}

/* ============================================================== */
/* هوية منصة نفهم: زيتوني + نحاسي + كريمي، عناوين Reem Kufi، أزرار دائرية */
/* ============================================================== */
:root {
  --nf-olive: #606C38; --nf-olive-dim: #4A5528; --nf-forest: #283618;
  --nf-copper: #BC6C25; --nf-caramel: #DDA15E; --nf-cream: #FEFAE0; --nf-cream-edge: #E9E2C2;
  --nf-surface-low: #FAFAF6; --nf-surface: #F4F4EF; --nf-outline: #E0E0D6; --nf-ink: #191914; --nf-muted: #75756A;
  --nf-card-1: #E4E3F5; --nf-card-2: #FFD3DD; --nf-card-3: #E2EFF0; --nf-card-4: #D8EFC3; --nf-card-5: #FAE285; --nf-card-6: #C5FAFF;
}
body { font-family: var(--font-base); color: var(--nf-ink); background: var(--nf-surface-low); }
h1, h2, h3, .brand-title, .vl-title, .tp-band-title h3, .content-box-header h3, .portal-role-card h3 {
  font-family: var(--font-title); font-weight: 700; letter-spacing: 0;
}
.global-navbar { background: rgba(255,255,255,0.92); border-bottom: 1px solid var(--nf-outline); }
.brand-title { color: var(--nf-olive); }
.btn { border-radius: 999px !important; font-family: var(--font-base); font-weight: 700; }
.btn-primary { background: var(--nf-copper) !important; border-color: var(--nf-copper) !important; color: #fff !important; box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1); }
.btn-primary:hover { background: #a65d1f !important; }
.btn-outline-sm, .btn-outline-dark { background: #fff; border: 2px solid var(--nf-outline) !important; color: var(--nf-ink); }
.btn-outline-sm:hover, .btn-outline-dark:hover { border-color: var(--nf-copper) !important; color: var(--nf-copper); }
.btn-emerald { background: var(--nf-olive) !important; border-color: var(--nf-olive) !important; color: #fff !important; }
.badge-gold { background: var(--nf-cream); color: var(--nf-copper); border: 1px solid var(--nf-cream-edge); border-radius: 999px; }
.content-box, .father-student-card, .book-shelf-card, .chapter-card-item, .vl-lab, .portal-role-card, .topic-synced-toolbar-box, .exercise-box {
  border-radius: 24px; border: 2px solid var(--nf-outline);
}
.ribbon-tab-btn { border-radius: 999px; font-family: var(--font-base); }
.ribbon-tab-btn.active { background: var(--nf-olive); box-shadow: 0 4px 10px rgba(96,108,56,.25); }
.topic-top-ribbon-bar { border-radius: 999px; border: 2px solid var(--nf-outline); }
@media (max-width: 700px) { .topic-top-ribbon-bar { border-radius: 20px; } }
.vl-pill.active, .page-pill-btn.active { background: var(--nf-olive) !important; border-color: var(--nf-olive) !important; color: #fff !important; }
.vl-pill, .page-pill-btn { border-radius: 999px; }
.vl-slider input { accent-color: var(--nf-copper); }
.vl-slider-val { color: var(--nf-copper); }
.vl-pages { background: var(--nf-cream); color: var(--nf-copper); border-color: var(--nf-cream-edge); }
.vl-math, .vl-expr { color: var(--nf-olive-dim); }
.vl-expr { background: var(--nf-surface); }
.vl-try { background: var(--nf-cream); border-color: var(--nf-caramel); }
.book-view-toggle button.active { color: var(--nf-olive); }
.site-rights-note { background: var(--nf-surface); }
/* عنوان بكلمة مميزة وخط نحاسي تحتها مثل «أحدث الكورسات» في نفهم */
.nf-hl { color: var(--nf-olive); position: relative; display: inline-block; }
.nf-hl::after { content: ""; position: absolute; inset-inline: 0; bottom: -0.15em; height: 0.28em; border-bottom: 3px solid var(--nf-caramel); border-radius: 0 0 50% 50%; }
.nf-eyebrow { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--nf-copper); font-weight: 700; font-size: 0.85rem; }
.nf-eyebrow::before { content: ""; width: 10px; height: 10px; border-radius: 0 50% 0 50%; background: var(--nf-olive); }

/* ورقة شرح المعلم بألوان نفهم */
.tp-paper { --tp-paper: #FFFFFF; --tp-ink: var(--nf-ink); --tp-q: var(--nf-olive-dim); border: 2px solid var(--nf-outline); border-radius: 24px; box-shadow: 0 10px 30px rgba(40,54,24,.06); line-height: 2; font-size: 1.08rem; }
.tp-band { box-shadow: none; border-radius: 18px; background: var(--nf-cream); border: 1px solid var(--nf-cream-edge); }
.tp-band-badge { background: var(--nf-copper); border-radius: 0 18px 18px 0; }
.tp-band-badge strong { font-family: var(--font-title); }
.tp-band-title { background: transparent; }
.tp-band-title h3 { font-family: var(--font-title); color: var(--nf-forest); }
.tp-band-title span { color: var(--nf-muted); }
.tp-box { border-radius: 20px; border-width: 2px; }
.tp-box-tab { font-family: var(--font-base); border-radius: 999px; padding: 0.05rem 1rem; font-size: 0.95rem; }
.tp-box.tp-idea { border-color: #CBC9EE; background: #FBFBFF; } .tp-box.tp-idea .tp-box-tab { background: var(--nf-card-1); border-color: #CBC9EE; color: #33306b; }
.tp-box.tp-mistake { border-color: #F5B5C3; background: #FFF9FA; } .tp-box.tp-mistake .tp-box-tab { background: var(--nf-card-2); border-color: #F5B5C3; color: #8a1c35; }
.tp-box.tp-life { border-color: #BFE0A3; background: #FBFEF8; } .tp-box.tp-life .tp-box-tab { background: var(--nf-card-4); border-color: #BFE0A3; color: var(--nf-forest); }
.tp-box.tp-book { border-color: #BFDCDE; background: #F9FCFC; } .tp-box.tp-book .tp-box-tab { background: var(--nf-card-3); border-color: #BFDCDE; color: #1f4b50; }
.tp-box.tp-exam { border-color: #F2D46A; background: #FFFDF2; } .tp-box.tp-exam .tp-box-tab { background: var(--nf-card-5); border-color: #F2D46A; color: #6b4a00; }
.tp-rule { background: var(--nf-cream); border-inline-start-color: var(--nf-copper); }
.tp-table th { background: var(--nf-surface); } .tp-table th, .tp-table td { border-color: var(--nf-outline); }
.tp-folio { font-family: var(--font-title); color: var(--nf-copper); }

/* ============================================================== */
/* شريط تبويبات الشرح الستة: ثابت أعلى الشاشة عند النزول            */
/* ============================================================== */
.topic-top-ribbon-bar { position: sticky; top: calc(var(--nav-h, 64px) + 6px); z-index: 90; transition: padding .2s ease, box-shadow .2s ease; }
.topic-top-ribbon-bar.is-stuck { box-shadow: 0 8px 22px rgba(40,54,24,.12); }
.ribbon-short { display: none; }
@media (max-width: 700px) {
  .topic-top-ribbon-bar { top: calc(var(--nav-h, 96px) + 4px); }
  /* عند الالتصاق على الجوال: صف واحد بأسماء قصيرة حتى لا يغطي نصف الشاشة */
  .topic-top-ribbon-bar.is-stuck { padding: 0.25rem; border-radius: 999px; }
  .topic-top-ribbon-bar.is-stuck .topic-ribbon-nav { grid-template-columns: repeat(6, 1fr); gap: 0.15rem; }
  .topic-top-ribbon-bar.is-stuck .ribbon-tab-btn { min-height: 36px; padding: 0.35rem 0.15rem; font-size: 0.72rem; }
  .topic-top-ribbon-bar.is-stuck .ribbon-text { display: none; }
  .topic-top-ribbon-bar.is-stuck .ribbon-short { display: inline; }
}

.tab-sync-hint { position: absolute; inset-inline-start: 50%; transform: translateX(50%); bottom: -2.1rem; background: var(--nf-forest, #283618); color: #fff; font-size: 0.78rem; font-weight: 700; padding: 0.25rem 0.8rem; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s ease; white-space: nowrap; }
.tab-sync-hint.show { opacity: 0.92; }
.topic-top-ribbon-bar { position: sticky; }

/* شريط الموضع المحفوظ في التبويبات التي تخص الدرس كله */
.book-page-img { height: auto; }
.sync-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; background: #f4f6ec; border: 1px solid #d9dfc3; border-radius: 10px; padding: 0.55rem 0.9rem; margin-bottom: 0.9rem; font-size: 0.88rem; color: #3d4420; }
.sync-banner[hidden] { display: none; }
.sync-banner-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.sync-banner button { background: #fff; border: 1px solid #606C38; color: #4A5528; border-radius: 999px; padding: 0.25rem 0.75rem; font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.sync-banner button:hover { background: #606C38; color: #fff; }

/* ===== صوت شرح «مثال من الواقع» ===== */
.tp-listen-row { display: flex; justify-content: flex-start; margin: -0.3rem 0 0.4rem; }
.tp-listen-page { display: flex; justify-content: center; margin: -0.6rem 0 1.2rem; }
.tp-listen { display: inline-flex; align-items: center; gap: .4rem; background: #fff; border: 1.5px solid var(--nf-olive, #606C38); color: var(--nf-olive-dim, #4A5528); border-radius: 999px; padding: .2rem .85rem; font: 700 .85rem var(--font-base, sans-serif); cursor: pointer; line-height: 1.8; }
.tp-listen:hover, .tp-listen.is-playing { background: var(--nf-olive, #606C38); color: #fff; }
.tp-listen-all { padding: .35rem 1.2rem; font-size: .95rem; background: var(--nf-olive, #606C38); color: #fff; }
.tp-listen-ico { font-size: .75em; }
.tp-sec.tp-playing { box-shadow: 0 0 0 3px rgba(221,161,94,.55); background: #fffaf0; border-radius: 10px; transition: box-shadow .2s, background .2s; }
.tp-player { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 9998; display: flex; align-items: center; gap: .5rem; background: #283618; color: #fff; border-radius: 999px; padding: .35rem .6rem; box-shadow: 0 8px 22px rgba(0,0,0,.25); font: 700 .85rem var(--font-base, sans-serif); }
.tp-player[hidden] { display: none; }
.tp-pl-btn { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 999px; min-width: 2.2rem; height: 2.2rem; cursor: pointer; font: inherit; }
.tp-pl-btn:hover { background: rgba(255,255,255,.25); }
.tp-pl-label { padding: 0 .3rem; white-space: nowrap; }

/* ===== كتاب الفيزياء ===== */
.ph-content .ph-body p, .ph-content p { margin: 0 0 .55rem; line-height: 2; }
.ph-sub { font-family: var(--font-title); color: var(--nf-olive-dim, #4A5528); font-size: 1.12rem; margin: 1.2rem 0 .5rem; }
.ph-note { color: #5b5b50; font-size: .92rem; background: #faf7ee; border-inline-start: 4px solid var(--nf-caramel, #DDA15E); padding: .5rem .8rem; border-radius: 6px; }
.ph-content table { border-collapse: collapse; width: 100%; background: #fff; margin: .5rem 0 1rem; font-size: .95rem; }
.ph-content td, .ph-content th { border: 1px solid #d9d2bd; padding: .45rem .6rem; text-align: start; }
.ph-content th { background: #f4f0e2; }
.ph-content .table-scroll { overflow-x: auto; }
.ph-content details { background: #fff; border: 1px solid #e3dcc6; border-radius: 10px; padding: .6rem .9rem; margin: .5rem 0; }
.ph-content summary { cursor: pointer; font-weight: 800; color: var(--nf-olive-dim, #4A5528); }
.ph-content .formula { direction: ltr; text-align: center; font-size: 1.15rem; background: #f7f5ec; border-radius: 8px; padding: .4rem; }
.ph-content figure { margin: .8rem 0; text-align: center; }
.ph-content figcaption { font-size: .85rem; color: #6b6b60; }
.ph-content bdi[dir=ltr] { unicode-bidi: isolate; }
.ph-problem .exercise-question-title { font-size: 1.02rem; }
.ph-pills { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; }
.ph-book-links { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 1rem 0; }
.ph-lab-laws { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
.ph-lab-ins { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.ph-lab-ins label { display: flex; align-items: center; gap: .5rem; background: #fff; border: 1.5px solid #e0dccb; border-radius: 10px; padding: .5rem .7rem; }
.ph-lab-ins label span { flex: 1; font-weight: 700; font-size: .9rem; }
.ph-lab-ins input { width: 6.5rem; font: inherit; font-size: 1.05rem; padding: .3rem .4rem; border: 1px solid #cfc8b0; border-radius: 6px; direction: ltr; }
.ph-lab-ins em { font-style: normal; color: #75756A; font-size: .85rem; }
.ph-lab-out { background: #1E4A3E; color: #F3EEDC; border: 6px solid #8B5E3C; border-radius: 14px; padding: 1rem 1.2rem; font-size: 1.25rem; text-align: center; min-height: 5rem; }
.ph-step { margin: .2rem 0; } .ph-final { color: #FFDF8A; font-weight: 800; font-size: 1.4rem; }
.ph-rec-head { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .6rem; }
.ph-rec-tools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.ph-rec-score { margin-inline-start: auto; font-size: .9rem; color: #4A5528; }
.ph-card { background: #fff; border: 1.5px solid #e6e0cc; border-radius: 12px; padding: .7rem .9rem; margin: .5rem 0; }
.ph-q { font-weight: 800; display: flex; gap: .5rem; align-items: baseline; line-height: 1.9; }
.ph-qn { background: var(--nf-olive, #606C38); color: #fff; border-radius: 999px; min-width: 1.7rem; height: 1.7rem; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; flex: none; }
.ph-card details { border: 0; padding: 0; margin: .3rem 0 0; background: transparent; }
.ph-a { background: #faf8ef; border-radius: 8px; padding: .5rem .8rem; margin: .4rem 0; line-height: 2; }
.ph-rate { display: flex; gap: .4rem; flex-wrap: wrap; }
.ph-rate button { font: inherit; font-size: .82rem; font-weight: 700; border: 1.5px solid #d8d1ba; background: #fff; border-radius: 999px; padding: .2rem .8rem; cursor: pointer; }
.ph-rate .r-ok.on { background: #2b8a3e; border-color: #2b8a3e; color: #fff; }
.ph-rate .r-mid.on { background: #e8a33d; border-color: #e8a33d; color: #fff; }
.ph-rate .r-no.on { background: #c0392b; border-color: #c0392b; color: #fff; }

/* ===== الحفظ ===== */
.mem-stats { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin: .6rem 0 .4rem; font-size: .9rem; color: #45453C; }
.mem-stats b { font-size: 1.05rem; color: #191914; }
.mem-stats .s-m b { color: #b7791f; } .mem-stats .s-x b { color: #2b8a3e; }
.mem-filter { margin-inline-start: auto; font-size: .85rem; display: flex; gap: .3rem; align-items: center; cursor: pointer; }
.mem-bar { height: 8px; background: #ece7d8; border-radius: 99px; overflow: hidden; margin-bottom: .8rem; }
.mem-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8EE3B9, #2b8a3e); }
.mem-card { background: #fff; border: 1.5px solid #e6e0cc; border-inline-start: 6px solid #d9d2bd; border-radius: 12px; padding: .8rem 1rem; margin: .55rem 0; }
.mem-card.is-memorized { border-inline-start-color: #e8a33d; }
.mem-card.is-mastered { border-inline-start-color: #2b8a3e; background: #fbfff9; }
.mem-q { font-weight: 800; color: var(--nf-olive-dim, #4A5528); margin-bottom: .3rem; }
.mem-a { line-height: 2; font-size: 1.04rem; }
.mem-a p { margin: 0 0 .3rem; }
.mem-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; align-items: center; }
.mem-actions button { font: inherit; cursor: pointer; border-radius: 999px; }
.mem-read { background: var(--bd-board, #1E4A3E); color: #F3EEDC; border: 3px solid var(--bd-wood, #8B5E3C); padding: .35rem 1.1rem; font-weight: 800; font-size: .95rem; min-width: 8.5rem; }
.mem-read b { display: inline-block; min-width: 1.6rem; background: #FFDF8A; color: #1E4A3E; border-radius: 99px; padding: 0 .45rem; margin-inline-start: .35rem; }
.mem-read.pop b { animation: memPop .35s ease; }
@keyframes memPop { 50% { transform: scale(1.35); } }
.mem-flag { background: #fff; border: 1.5px solid #d8d1ba; padding: .3rem .9rem; font-weight: 700; font-size: .88rem; }
.mem-m.on { background: #e8a33d; border-color: #e8a33d; color: #fff; }
.mem-x.on { background: #2b8a3e; border-color: #2b8a3e; color: #fff; }
.mem-reset { background: transparent; border: 0; color: #9a9a8c; font-size: 1.1rem; }

/* ===== الملاحظات ===== */
.notes-label { font-weight: 800; display: block; margin-bottom: .4rem; }
.notes-text { width: 100%; box-sizing: border-box; font: inherit; font-size: 1.02rem; line-height: 1.9; border: 1.5px solid #d9d2bd; border-radius: 12px; padding: .8rem; background: #fffdf7 repeating-linear-gradient(transparent 0 1.88rem, #efe8d4 1.88rem 1.94rem); resize: vertical; }
.notes-saved { font-size: .8rem; color: #75756A; margin: .3rem 0 1rem; }
.rem-add { display: flex; flex-wrap: wrap; gap: .5rem; }
.rem-add input[type=text] { flex: 1 1 220px; font: inherit; padding: .5rem .7rem; border: 1.5px solid #d9d2bd; border-radius: 10px; }
.rem-add input[type=date] { font: inherit; padding: .45rem .5rem; border: 1.5px solid #d9d2bd; border-radius: 10px; }
.rem-list { list-style: none; padding: 0; margin: .8rem 0; }
.rem-list li { display: flex; align-items: center; gap: .6rem; background: #fff; border: 1px solid #e6e0cc; border-radius: 10px; padding: .5rem .8rem; margin: .35rem 0; }
.rem-list li label { flex: 1; display: flex; gap: .5rem; align-items: center; cursor: pointer; }
.rem-list li em { font-style: normal; font-size: .8rem; color: #75756A; }
.rem-list li.today em { color: #b7791f; font-weight: 800; } .rem-list li.late em { color: #c0392b; font-weight: 800; }
.rem-list li.done span { text-decoration: line-through; color: #9a9a8c; }
.rem-del { background: transparent; border: 0; font-size: 1.2rem; color: #b0a990; cursor: pointer; }
.rem-empty { color: #75756A; justify-content: center; }
.notes-others { display: grid; gap: .5rem; }
.notes-other { text-align: start; font: inherit; background: #fff; border: 1px solid #e6e0cc; border-radius: 10px; padding: .6rem .8rem; cursor: pointer; display: flex; flex-direction: column; gap: .2rem; }
.notes-other span { font-size: .85rem; color: #56564C; } .notes-other em { font-style: normal; font-size: .78rem; color: #b7791f; }

/* شريط التبويبات السبعة على الجوال */
@media (max-width: 700px) {
  .topic-ribbon-nav { grid-template-columns: repeat(4, 1fr) !important; }
  .topic-top-ribbon-bar.is-stuck .topic-ribbon-nav { grid-template-columns: repeat(7, 1fr) !important; gap: .1rem; }
  .topic-top-ribbon-bar.is-stuck .ribbon-tab-btn { font-size: .66rem; padding: .3rem .05rem; }
}

/* ===== تقليب الصفحات وربط التبويبات بالصفحة ===== */
.page-strip { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: center; background: #fffdf7; border: 1px solid #e6e0cc; border-radius: 14px; padding: .4rem .6rem; margin: 0 0 .8rem; }
.ps-btn { font: inherit; font-weight: 800; font-size: .85rem; background: #fff; border: 1.5px solid #d8d1ba; border-radius: 999px; padding: .25rem .8rem; cursor: pointer; color: #4A5528; }
.ps-pages { display: flex; gap: .25rem; flex-wrap: wrap; justify-content: center; }
.ps-pg { font: inherit; font-size: .82rem; font-weight: 700; min-width: 2.2rem; border: 1px solid #e0dccb; background: #fff; border-radius: 8px; padding: .15rem .35rem; cursor: pointer; }
.ps-pg.on { background: var(--bd-board, #1E4A3E); color: #FFDF8A; border-color: var(--bd-wood, #8B5E3C); }
.ps-tip { width: 100%; text-align: center; font-size: .75rem; color: #8a8a7c; }
@media (min-width: 701px) { .ps-tip { width: auto; } }
.topic-tab-pane.flip-next { animation: flipNext .28s ease; }
.topic-tab-pane.flip-prev { animation: flipPrev .28s ease; }
@keyframes flipNext { from { opacity: .3; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes flipPrev { from { opacity: .3; transform: translateX(28px); } to { opacity: 1; transform: none; } }
.pg-group-head { font-family: var(--font-title); color: var(--nf-olive-dim, #4A5528); font-size: 1.05rem; margin: .4rem 0 .2rem; }
.pg-group-head.pg-rest { margin-top: 1.4rem; color: #8a8a7c; }
.exercise-box.on-page { box-shadow: 0 0 0 3px rgba(221,161,94,.55); }
.mem-card.on-page { box-shadow: 0 0 0 3px rgba(221,161,94,.45); }
.pg-chip { font: inherit; font-size: .78rem; border: 1px solid #d8d1ba; background: #fff; border-radius: 999px; padding: 0 .5rem; cursor: pointer; }
.pg-chip.on { background: #DDA15E; color: #fff; border-color: #DDA15E; }
.notes-page { min-height: 6rem; }
.pg-chips { margin: .5rem 0; font-size: .85rem; color: #56564C; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.pg-chips .pg-chip { font-size: .85rem; padding: .1rem .6rem; }
