/**
 * Layout uses CSS logical properties (inline-start/end, padding-inline) so the
 * entire interface mirrors when the document direction flips to RTL for Arabic.
 * There is no separate Arabic stylesheet.
 */

:root {
  --navy: #14304f;
  --accent: #1e7a5f;      /* Algerian green, used as the primary action colour */
  --accent-dark: #155e49;
  --accent-light: #e3f2ec;
  --sand: #f6f4ef;
  --bg: #f7f9fb;
  --card: #ffffff;
  --line: #e3e8ee;
  --text: #17212e;
  --muted: #5f6b7a;
  --red: #b3402f;
  --amber: #9a6b00;
  --amber-bg: #fdf4e3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 40, 70, .06), 0 4px 14px rgba(16, 40, 70, .05);
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", "Noto Naskh Arabic", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Arabic benefits from slightly more line height and a larger base size. */
html[dir="rtl"] body { line-height: 1.75; font-size: 16.5px; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; }

#root { min-height: 100vh; }

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

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 28px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--navy); }

/* Same gradient recipe as the homepage hero band, so the mark in the topbar
   reads as part of the same palette rather than a separately-chosen colour. */
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(150deg, var(--navy) 0%, #17415f 55%, var(--accent-dark) 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}

.brand-delta {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-weight: 700; letter-spacing: .01em;
}
.brand-suffix { font-weight: 600; }

.nav-links { display: flex; align-items: center; gap: 6px; }

.nav-link {
  padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600;
  color: var(--muted); background: transparent; border: none;
}
.nav-link:hover { background: var(--bg); color: var(--navy); }
.nav-link.active { background: var(--accent-light); color: var(--accent-dark); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.lang-switch { display: flex; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang-btn {
  border: none; background: transparent; padding: 5px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.lang-btn.active { background: var(--navy); color: #fff; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); font-size: 13px;
}
html[dir="rtl"] .user-chip { padding: 5px 5px 5px 12px; }

.avatar {
  width: 28px; height: 28px; border-radius: 999px; background: var(--navy);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; flex-shrink: 0;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 9px; font-size: 14.5px; font-weight: 600;
  border: 1px solid transparent; transition: filter .15s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--navy); }
.btn-danger { background: #fbecea; color: var(--red); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- layout */

.page { flex: 1; padding: 28px; max-width: 1180px; margin: 0 auto; width: 100%; }
.page-narrow { max-width: 620px; }

.page-head { margin-bottom: 22px; }
.page-title { font-size: 25px; font-weight: 800; color: var(--navy); }
.page-sub { color: var(--muted); font-size: 14.5px; margin-top: 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 940px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.spread { margin-inline-start: auto; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.section-title { font-size: 17px; font-weight: 700; color: var(--navy); margin: 26px 0 12px; }

/* ---------------------------------------------------------------- landing */

.hero {
  position: relative; overflow: hidden;
  background: var(--navy); /* fallback while the video loads / if it fails */
  color: #fff; padding: 74px 28px 84px; text-align: center;
}
.hero-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}
.hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(150deg, rgba(20,48,79,.88) 0%, rgba(23,65,95,.82) 55%, rgba(21,94,73,.85) 100%);
}
.hero-content { position: relative; z-index: 2; }
.hero h1 { font-size: 40px; font-weight: 800; max-width: 780px; margin: 0 auto 16px; line-height: 1.2; }
.hero p { font-size: 17px; color: #d6e6df; max-width: 620px; margin: 0 auto 30px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-actions .btn-outline { background: transparent; border-color: rgba(255,255,255,.45); color: #fff; }

/* -------------------------------------------------------- study video band */

.study-band {
  position: relative; overflow: hidden; min-height: 380px;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy);
}
.study-band-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}
.study-band-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(20,32,46,.35) 0%, rgba(20,32,46,.72) 100%);
}
.study-band-content {
  position: relative; z-index: 2; color: #fff; text-align: center;
  max-width: 640px; padding: 40px 24px;
}
.study-band-content h2 { font-size: 27px; font-weight: 800; margin-bottom: 14px; }
.study-band-content p { font-size: 15.5px; line-height: 1.7; color: #dfe8ee; margin: 0; }

/* -------------------------------------------------------------- explorers */

.explorers {
  padding: 56px 28px; background: var(--sand);
}
.explorers-inner {
  max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center;
}
@media (max-width: 780px) { .explorers-inner { grid-template-columns: 1fr; } }
.explorers-videos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.explorers-videos video {
  width: 100%; height: 260px; object-fit: cover; border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.explorers-quote blockquote {
  margin: 0 0 12px; font-size: 24px; font-weight: 700; color: var(--navy);
  line-height: 1.4; font-style: italic;
}
.explorers-quote cite {
  display: block; font-size: 14px; font-weight: 600; color: var(--muted); font-style: normal;
}
.explorers-quote cite::before { content: "— "; }

.feature { padding: 22px; }
.feature-icon {
  width: 42px; height: 42px; border-radius: 10px; background: var(--accent-light);
  display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 12px;
}
.feature h3 { font-size: 16px; color: var(--navy); margin-bottom: 6px; }
.feature p { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.6; }

.footer { background: var(--navy); color: #a9bccd; padding: 26px; text-align: center; font-size: 13px; margin-top: auto; }

/* ---------------------------------------------------------------- forms */

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14.5px; font-family: inherit; background: #fff; color: var(--text);
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; }

.alert { padding: 12px 15px; border-radius: 9px; font-size: 14px; margin-bottom: 15px; }
.alert-error { background: #fbecea; color: var(--red); border: 1px solid #f0cdc7; }
.alert-ok { background: var(--accent-light); color: var(--accent-dark); border: 1px solid #b9ded1; }
.alert-info { background: var(--amber-bg); color: var(--amber); border: 1px solid #ecd9ac; }

/* consent block — visually distinct because it is a legal act, not a checkbox */
.consent-box {
  border: 1.5px solid var(--accent); background: var(--accent-light);
  border-radius: 10px; padding: 15px; margin: 16px 0;
}
.consent-box h4 { margin: 0 0 8px; font-size: 14px; color: var(--accent-dark); }
.consent-box p { margin: 0 0 12px; font-size: 13px; line-height: 1.65; color: #24443a; }
.consent-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; font-weight: 600; color: var(--accent-dark); }
.consent-check input { margin-top: 3px; flex-shrink: 0; width: 17px; height: 17px; accent-color: var(--accent); }

/* ---------------------------------------------------------------- catalog */

.filters { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filters select { padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; background: #fff; font-family: inherit; }

/* ---------------------------------------------------------------- teach: trimesters & batch classes */

.trimester-block {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg);
}
.trimester-badge {
  width: 24px; height: 24px; border-radius: 999px; background: var(--navy); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.class-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; flex-wrap: wrap;
}
.class-title-input {
  flex: 1; min-width: 160px; border: 1px solid transparent; background: transparent;
  padding: 6px 8px; border-radius: 6px; font-size: 14px; font-family: inherit; color: var(--text);
}
.class-title-input:hover, .class-title-input:focus { border-color: var(--line); background: var(--bg); outline: none; }
.class-date-input {
  border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: 6px;
  font-size: 12.5px; font-family: inherit; color: var(--muted);
}
.class-date-input:hover, .class-date-input:focus { border-color: var(--line); background: var(--bg); outline: none; }

/* ---------------------------------------------------------------- scope calendar (module detail) */

.scope-block {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fff;
}
.scope-block.selectable { cursor: pointer; transition: border-color .15s ease; }
.scope-block.selectable:hover { border-color: var(--accent); }
.scope-block.selected { border-color: var(--accent); background: var(--accent-light); }

.module-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.module-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.module-title { font-weight: 700; font-size: 15.5px; color: var(--text); line-height: 1.4; }
.module-meta { font-size: 13px; color: var(--muted); }
.module-summary { font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.module-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; gap: 10px; }
.price { font-size: 19px; font-weight: 800; color: var(--accent-dark); }
.price small { font-size: 12px; font-weight: 600; color: var(--muted); margin-inline-start: 4px; }

.pill {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.pill-exam { background: #fdf1e3; color: #9a5b00; }
.pill-live { background: #fbecea; color: var(--red); }
.pill-ok { background: var(--accent-light); color: var(--accent-dark); }
.pill-wait { background: var(--amber-bg); color: var(--amber); }
.pill-grey { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

/* ---------------------------------------------------------------- lists / tables */

.list-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-title { font-weight: 600; font-size: 14.5px; }
.list-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: start; background: var(--bg); color: var(--muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .03em; padding: 11px 15px; font-weight: 700;
}
td { padding: 12px 15px; border-top: 1px solid var(--line); }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.stat {
  flex: 1; min-width: 150px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 17px;
}
.stat .n { font-size: 25px; font-weight: 800; color: var(--navy); }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- payment */

.pay-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 560px) { .pay-methods { grid-template-columns: 1fr; } }
.pay-option {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 13px 15px;
  background: #fff; text-align: start; font-size: 14px; font-weight: 600; color: var(--navy);
}
.pay-option.selected { border-color: var(--accent); background: var(--accent-light); }
.pay-option small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 3px; }

.pay-details {
  background: var(--sand); border: 1px dashed #cfc7b5; border-radius: 10px;
  padding: 16px; margin: 16px 0; font-size: 14px; line-height: 1.7;
}
.pay-account { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; font-size: 15px; font-weight: 700; color: var(--navy); direction: ltr; display: inline-block; }

/* ---------------------------------------------------------------- report */

.note-card { border-inline-start: 4px solid var(--accent); background: #fff; border-radius: 0 10px 10px 0; padding: 14px 16px; border: 1px solid var(--line); }
html[dir="rtl"] .note-card { border-radius: 10px 0 0 10px; }
.note-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.stars { color: #d99e00; letter-spacing: 1px; }

.attend-dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; margin-inline-end: 7px; }
.dot-present { background: var(--accent); }
.dot-absent { background: var(--red); }
.dot-late { background: var(--amber); }

/* ---------------------------------------------------------------- modal */

.backdrop {
  position: fixed; inset: 0; background: rgba(12, 28, 46, .5);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 24px; width: 480px; max-width: 100%;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(10, 25, 45, .28);
}

.spinner { text-align: center; padding: 60px; color: var(--muted); }

/* ---------------------------------------------------------------- role picker */

.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 700px) { .role-grid { grid-template-columns: 1fr; } }

.role-card {
  border: 1.5px solid var(--line); border-radius: 11px; padding: 14px 13px;
  background: #fff; text-align: start; display: flex; flex-direction: column; gap: 4px;
}
.role-card.selected { border-color: var(--accent); background: var(--accent-light); }
.role-icon { font-size: 22px; }
.role-title { font-weight: 700; font-size: 14px; color: var(--navy); }
.role-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* explanation panel — used for the sub-account concept at signup */
.explain-box {
  background: var(--sand); border: 1px solid #e4ddcd; border-radius: 11px;
  padding: 14px 16px; margin: 18px 0 14px;
}
.explain-box h4 { margin: 0 0 6px; font-size: 13.5px; color: var(--navy); }
.explain-box p { margin: 0; font-size: 13px; line-height: 1.65; color: #4a4738; }

.child-block {
  border: 1px solid var(--line); border-radius: 11px; padding: 14px;
  margin-bottom: 12px; background: #fcfdfe;
}

/* generated credentials, shown once */
.cred-card {
  border: 1.5px solid var(--accent); border-radius: 11px; padding: 14px 16px;
  margin-bottom: 10px; background: var(--accent-light);
}
.cred-name { font-weight: 700; font-size: 14.5px; color: var(--navy); margin-bottom: 8px; }
.cred-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; padding: 3px 0; }
.cred-row span { color: #24443a; }
.cred-row code {
  font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; font-size: 14px; font-weight: 700;
  background: #fff; border: 1px solid #b9ded1; border-radius: 6px; padding: 3px 9px;
  color: var(--navy); direction: ltr;
}

/* ---------------------------------------------------------------- teacher profile */

.teacher-head { display: flex; gap: 18px; align-items: flex-start; }
@media (max-width: 620px) { .teacher-head { flex-direction: column; } }

.teacher-avatar {
  width: 68px; height: 68px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 800;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
}
.chip.on { border-color: var(--accent); background: var(--accent-light); color: var(--accent-dark); }

.link { color: var(--accent-dark); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- search */

.search-input {
  flex: 1; min-width: 220px; padding: 9px 14px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 14px; font-family: inherit; background: #fff;
}
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------------------------------------------------------------- progress bar */

.progress-track { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
