/* ==========================================================================
   BASIRAH Akademie – Design System
   Brand: forest green + ink, elegant serif headings, gold accent.
   Re-skin the whole platform by editing the :root variables.
   ========================================================================== */

:root {
  --green: #2e7d34;
  --green-600: #246628;
  --green-700: #1c5220;
  --green-50: #eef5ee;
  --green-100: #d9ebda;
  --ink: #16241c;
  --ink-700: #0f1a13;
  --gold: #b07d1a;
  --gold-bg: #f7edd4;
  --bg: #f4f7f3;
  --card: #ffffff;
  --text: #233028;
  --muted: #647067;
  --border: #e2e8e2;
  --success: #15803d;
  --success-bg: #dcfce7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --warning: #92400e;
  --warning-bg: #fef3c7;
  --info: #1e40af;
  --info-bg: #dbeafe;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(22, 36, 28, 0.07), 0 1px 2px rgba(22, 36, 28, 0.05);
  --shadow-md: 0 4px 14px rgba(22, 36, 28, 0.10);
  --shadow-lg: 0 12px 30px rgba(22, 36, 28, 0.14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", "Noto Serif", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--ink);
  line-height: 1.22;
  margin: 0 0 0.5em;
  letter-spacing: 0.1px;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.stack > * + * { margin-top: 16px; }

/* ----- Navbar (light, with green underline echoing the logo) ------------ */
.navbar {
  background: #fff;
  border-bottom: 3px solid var(--green);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.navbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 66px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 42px; width: auto; display: block; }
.brand-sub {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--green-700);
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.nav-toggle { display: none; }
.nav-burger {
  display: none; cursor: pointer; font-size: 1.5rem;
  color: var(--ink); padding: 4px 10px; border-radius: var(--radius-sm);
}

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a.navlink {
  color: var(--ink); padding: 8px 13px; border-radius: var(--radius-sm); font-weight: 500;
}
.nav-links a.navlink:hover { background: var(--green-50); color: var(--green-700); text-decoration: none; }
.nav-links a.navlink.active { background: var(--green-50); color: var(--green-700); font-weight: 600; }
.nav-admin { border: 1px solid var(--green); color: var(--green-700) !important; }
.nav-admin:hover { background: var(--green) !important; color: #fff !important; }

/* User dropdown (native <details>, no JS) */
.user-menu { position: relative; }
.user-menu > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 999px; background: var(--green-50); color: var(--ink);
}
.user-menu > summary::-webkit-details-marker { display: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 0.82rem; font-weight: 700;
}
.user-menu[open] > summary { background: var(--green-100); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 10px); background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  min-width: 210px; padding: 6px; z-index: 60;
}
.menu-panel a, .menu-panel button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px;
  color: var(--text); background: none; border: 0; font: inherit; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--green-50); text-decoration: none; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }

/* ----- Layout ----------------------------------------------------------- */
main { padding: 30px 0 64px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin-bottom: 4px; }

/* ----- Cards ------------------------------------------------------------ */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.card + .card { margin-top: 16px; }
.card-title { margin-top: 0; }

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

/* ----- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px;
  border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit;
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-600); color: #fff; box-shadow: var(--shadow-md); }
.btn-navy, .btn-ink { background: var(--ink); color: #fff; }
.btn-navy:hover, .btn-ink:hover { background: var(--ink-700); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: var(--green-50); border-color: var(--green-100); }
.btn-ghost { background: transparent; color: var(--green-600); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 0.9rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* ----- Progress --------------------------------------------------------- */
.progress { background: #e6ece6; border-radius: 999px; height: 10px; overflow: hidden; flex: 1; }
.progress > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--green-600)); transition: width .4s ease;
}
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-row .pct { font-weight: 700; color: var(--ink); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* ----- Badges ----------------------------------------------------------- */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-teal { background: var(--green-100); color: var(--green-700); }
.badge-gold { background: var(--gold-bg); color: var(--gold); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-muted { background: #eef1ee; color: var(--muted); }

/* ----- Course cards (dashboard) ----------------------------------------- */
.course-card { display: grid; grid-template-columns: 230px 1fr; overflow: hidden; padding: 0; transition: box-shadow .15s ease, transform .12s ease; }
.course-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.course-thumb {
  background: linear-gradient(135deg, var(--ink), var(--green)); display: grid; place-items: center;
  color: #fff; min-height: 156px; position: relative;
}
.course-thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.course-thumb .ph { font-size: 2.6rem; opacity: .92; }
.course-body { padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.course-body h3 { margin: 0; }
.course-meta { color: var(--muted); font-size: 0.9rem; }
.course-actions { margin-top: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ----- Lesson list ------------------------------------------------------ */
.module-block { margin-bottom: 24px; }
.module-block > h3 { padding-bottom: 8px; border-bottom: 2px solid var(--green-100); }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-item {
  display: flex; align-items: center; gap: 14px; padding: 13px 15px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px; background: #fff; transition: border-color .12s ease, background .12s ease;
}
.lesson-item:hover { border-color: var(--green); background: var(--green-50); }
.lesson-check {
  width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 2px solid var(--border); color: transparent; font-size: 0.85rem;
}
.lesson-check.done { background: var(--green); border-color: var(--green); color: #fff; }
.lesson-item .title { font-weight: 500; flex: 1; }
.lesson-item a { color: var(--ink); }

/* ----- Forms ------------------------------------------------------------ */
.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=file], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(46, 125, 52, 0.16);
}
textarea { min-height: 120px; resize: vertical; }
.help { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: 6px 0; font-size: 0.9rem; }

/* ----- Quiz options ----------------------------------------------------- */
.option {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; transition: border-color .12s, background .12s;
}
.option:hover { border-color: var(--green); background: var(--green-50); }
.option input { width: auto; margin-top: 3px; }
.option.correct { border-color: var(--success); background: var(--success-bg); }
.option.wrong { border-color: var(--danger); background: var(--danger-bg); }

/* ----- Alerts ----------------------------------------------------------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 12px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #bbf7d0; }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: #fecaca; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #fde68a; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: #bfdbfe; }

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

/* ----- Tables ----------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table tbody tr:hover { background: var(--green-50); }

/* ----- Auth card -------------------------------------------------------- */
.auth-wrap { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 28px 20px; }
.auth-card { width: 100%; max-width: 420px; box-shadow: var(--shadow-md); }
.auth-card .brand-lg { text-align: center; margin-bottom: 18px; }
.auth-logo { height: 64px; width: auto; display: block; margin: 0 auto 14px; }

/* ----- Footer ----------------------------------------------------------- */
.footer { background: var(--ink); color: #b9c7bd; padding: 28px 0; font-size: 0.9rem; margin-top: 44px; }
.footer a { color: #dce6df; }

/* ----- Misc ------------------------------------------------------------- */
.list-reset { list-style: none; margin: 0; padding: 0; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.flex { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.tag-attempt { font-variant-numeric: tabular-nums; }

/* ----- Responsive ------------------------------------------------------- */
@media (max-width: 760px) {
  h1 { font-size: 1.7rem; }
  .brand-sub { display: none; }
  .nav-burger { display: block; order: 3; margin-left: auto; }
  .brand { margin-right: 0; }
  .nav-links {
    order: 4; flex-basis: 100%; flex-direction: column; align-items: stretch;
    gap: 4px; display: none; padding-bottom: 12px;
  }
  .nav-toggle:checked ~ .nav-links { display: flex; }
  .nav-links a.navlink { padding: 12px; }
  .user-menu { width: 100%; }
  .user-menu > summary { justify-content: flex-start; }
  .menu-panel { position: static; box-shadow: none; border: 0; padding: 0; background: transparent; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .course-card { grid-template-columns: 1fr; }
  .course-thumb { min-height: 120px; }
}

/* ----- Footer links ----------------------------------------------------- */
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: #dce6df; }

/* ----- Legal pages ------------------------------------------------------ */
.legal { max-width: 820px; }
.legal .card { line-height: 1.7; }
.legal h2 { font-size: 1.12rem; margin-top: 1.5rem; }
.legal h2:first-child { margin-top: 0; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 4px; }
.legal .note { background: var(--green-50); border-left: 3px solid var(--green); padding: 12px 16px; border-radius: 0 8px 8px 0; font-size: 0.9rem; }
