:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #2c2a26;
  --muted: #6f6a60;
  --line: #e4ded3;
  --brand: #7c6a46;
  --brand-dark: #5f5236;
  --accent: #a98f5d;
  --sage: #8a9a6b;
  --danger: #b4502f;
  --ok: #4f7a4a;
  --warn: #b5862f;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(60, 50, 30, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { width: min(1100px, 92vw); margin: 0 auto; }

/* Top bar */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.nav .container { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--brand-dark); font-size: 1.15rem; }
.brand .om { font-size: 1.5rem; }
.nav-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Hero */
.hero {
  background: linear-gradient(135deg, #efe9dc 0%, #e7ddc8 100%);
  padding: 72px 0 64px;
  text-align: center;
}
.hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); margin: 0 0 14px; color: var(--brand-dark); }
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 640px; margin: 0 auto 26px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 600; cursor: pointer;
  font-size: 0.95rem; transition: filter .15s, background .15s; text-decoration: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--brand-dark); border-color: var(--line); }
.btn.secondary:hover { background: #efe9dc; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.sm { padding: 6px 12px; font-size: 0.85rem; }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Cards & grid */
.section { padding: 48px 0; }
.section h2 { color: var(--brand-dark); margin-top: 0; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; color: var(--brand-dark); }
.price { font-size: 1.35rem; font-weight: 700; color: var(--brand); }
.muted { color: var(--muted); font-size: .9rem; }

/* Badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; letter-spacing: .02em;
}
.badge.pending { background: #fbf0d6; color: var(--warn); }
.badge.approved { background: #e2efdd; color: var(--ok); }
.badge.rejected, .badge.suspended { background: #f6ddd3; color: var(--danger); }
.badge.expired { background: #ece7de; color: var(--muted); }
.badge.open { background: #e2efdd; color: var(--ok); }
.badge.closed { background: #ece7de; color: var(--muted); }
.badge.online { background: #dff0e8; color: var(--ok); }

/* Forms */
.form { display: grid; gap: 14px; }
label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: 4px; color: var(--ink); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-family: inherit; font-size: .95rem; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
.field-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

/* Auth pages */
.auth-wrap { min-height: calc(100vh - 62px); display: grid; place-items: center; padding: 30px 16px; }
.auth-card { width: min(440px, 100%); }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: #efe9dc; padding: 5px; border-radius: 12px; }
.tabs button { flex: 1; padding: 9px; border: none; background: transparent; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tabs button.active { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow); }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 10px; font-size: .9rem; margin: 0; }
.alert.err { background: #f6ddd3; color: var(--danger); }
.alert.ok { background: #e2efdd; color: var(--ok); }
.alert.info { background: #eae4d7; color: var(--brand-dark); }
.hidden { display: none !important; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #faf7f1; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }

/* Admin layout */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 62px); }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; }
.side a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.side a.active, .side a:hover { background: #efe9dc; text-decoration: none; }
.main { padding: 26px; overflow: auto; }
@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; }
  .side { display: flex; gap: 6px; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .side a { white-space: nowrap; margin: 0; }
}
.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-bottom: 24px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .n { font-size: 1.9rem; font-weight: 700; color: var(--brand-dark); }
.stat .l { color: var(--muted); font-size: .85rem; }

/* Multi-select dropdown (tick several batches) */
.multidrop { position: relative; }
.multidrop-toggle {
  width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; cursor: pointer; font-size: .95rem; color: var(--ink);
}
.multidrop-toggle:hover { border-color: var(--accent); }
.multidrop-menu {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 240px; overflow: auto; padding: 6px;
}
.multidrop-menu label {
  display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 8px;
  font-weight: 400; cursor: pointer; margin: 0;
}
.multidrop-menu label:hover { background: #f3eee3; }
.multidrop-menu input[type="checkbox"] { width: auto; margin: 0; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(40,33,20,.45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); padding: 24px; width: min(540px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal h3 { margin-top: 0; color: var(--brand-dark); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Student video player */
.player-wrap { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; }
.player-wrap video { display: block; width: 100%; max-height: 72vh; background: #000; }
.player-wrap iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
/* Moving watermark = visible anti-piracy deterrent with the viewer's own email. */
.watermark {
  position: absolute; pointer-events: none; color: rgba(255,255,255,.28);
  font-size: .8rem; font-weight: 600; letter-spacing: .03em; z-index: 3;
  text-shadow: 0 1px 3px rgba(0,0,0,.6); animation: drift 19s linear infinite;
}
@keyframes drift {
  0%   { top: 8%;  left: 6%; }
  25%  { top: 70%; left: 60%; }
  50%  { top: 40%; left: 20%; }
  75%  { top: 80%; left: 10%; }
  100% { top: 8%;  left: 6%; }
}
.lecture-list { display: grid; gap: 10px; }
.lecture-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.lecture-item:hover { border-color: var(--accent); }
.lecture-item.active { border-color: var(--brand); background: #faf6ee; }
.date-head { font-weight: 700; color: var(--brand-dark); margin: 18px 0 8px; font-size: .95rem; }

/* Payment box on the enroll page */
.pay-box { background: #faf6ee; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.pay-amount { font-size: 1.05rem; margin-bottom: 12px; }
.pay-amount strong { color: var(--brand); font-size: 1.3rem; }
.pay-grid { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: start; }
.pay-qr { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.pay-qr img { width: 100%; display: block; border-radius: 6px; }
.pay-details code { background: #efe9dc; padding: 2px 7px; border-radius: 6px; font-size: .95em; }
.pay-details > div { margin-bottom: 6px; }
@media (max-width: 480px) { .pay-grid { grid-template-columns: 1fr; } .pay-qr { max-width: 220px; margin: 0 auto; } }

footer { text-align: center; padding: 30px; color: var(--muted); font-size: .85rem; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
