:root {
  --brand: #1a237e;
  --brand-2: #311b92;
  --accent: #4fc3f7;
  --ink: #0f172a;
  --muted: #64748b;
  --surface: #ffffff;
  --soft: #f4f7fb;
  --line: #dbe3ef;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 20px 55px rgba(15, 23, 42, .12);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--soft);
  line-height: 1.55;
}
body.auth-bg {
  background:
    radial-gradient(circle at 10% 10%, rgba(79,195,247,.22), transparent 34rem),
    linear-gradient(145deg, var(--brand), var(--brand-2));
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(26, 35, 126, .96);
  border-bottom: 2px solid var(--accent);
  backdrop-filter: blur(12px);
}
.nav {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--brand);
  background: var(--accent);
  box-shadow: 0 0 20px rgba(79,195,247,.35);
}
.brand strong { display: block; font-size: 1.25rem; line-height: 1.1; }
.brand small { display: block; color: var(--accent); font-size: .68rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.nav-links { display: flex; align-items: center; gap: 10px; color: #fff; }
.nav-link {
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: .9rem;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.12); }
.nav-user { font-size: .82rem; color: #dbeafe; }
.mobile-menu { display: none; color: #fff; border: 0; background: transparent; font-size: 1.3rem; }

.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.page { padding: 36px 0 64px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { color: var(--brand); font-weight: 800; text-transform: uppercase; letter-spacing: .09em; font-size: .75rem; }
.page-title { color: var(--brand); font-size: clamp(1.65rem, 4vw, 2.5rem); line-height: 1.15; margin-top: 4px; }
.page-subtitle { color: var(--muted); margin-top: 8px; max-width: 680px; }

.hero-auth {
  width: min(1120px, calc(100% - 32px));
  margin: 42px auto;
  min-height: calc(100vh - 84px);
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  align-items: center;
  gap: 42px;
}
.auth-intro { color: #fff; padding: 24px; }
.auth-intro h1 { font-size: clamp(2.2rem, 5vw, 4.4rem); line-height: 1.03; letter-spacing: -.05em; }
.auth-intro h1 span { color: var(--accent); }
.auth-intro p { margin: 22px 0; max-width: 540px; color: #dbeafe; font-size: 1.05rem; }
.feature-list { list-style: none; display: grid; gap: 12px; }
.feature-list li { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.feature-list i { color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth-card { padding: clamp(24px, 5vw, 42px); }
.card-title { color: var(--brand); font-size: 1.65rem; line-height: 1.2; }
.card-copy { color: var(--muted); margin: 8px 0 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; align-content: start; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--brand); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.control {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--line);
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px 13px;
  color: var(--ink);
  transition: .2s;
}
textarea.control { min-height: 100px; resize: vertical; }
.control:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(79,195,247,.16); }
.hint { color: var(--muted); font-size: .78rem; }
.form-actions { margin-top: 22px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.btn {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-decoration: none;
  font-weight: 800;
  transition: transform .2s, box-shadow .2s, opacity .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 10px 25px rgba(26,35,126,.2); }
.btn-accent { color: var(--brand); background: var(--accent); }
.btn-soft { color: var(--brand); background: #eef2ff; }
.btn-danger { color: #fff; background: var(--danger); }
.btn-block { width: 100%; }

.notice { display: none; margin-bottom: 18px; padding: 12px 14px; border-radius: 12px; font-size: .9rem; font-weight: 700; }
.notice.show { display: block; }
.notice.info { color: #1e40af; background: #dbeafe; }
.notice.success { color: #065f46; background: #d1fae5; }
.notice.error { color: #991b1b; background: #fee2e2; }
.notice.warning { color: #92400e; background: #fef3c7; }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search { position: relative; min-width: min(340px, 100%); flex: 1; }
.search i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .control { padding-left: 42px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 26px; }
.filter-btn { border: 1px solid var(--line); background: #fff; color: var(--brand); border-radius: 999px; padding: 8px 14px; font-weight: 800; }
.filter-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.course-card { display: flex; flex-direction: column; overflow: hidden; min-height: 320px; }
.course-cover {
  min-height: 126px;
  padding: 22px;
  display: flex;
  align-items: flex-end;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  position: relative;
}
.course-cover::after { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; right: -32px; top: -44px; border: 20px solid rgba(79,195,247,.22); }
.course-cover i { font-size: 2rem; color: var(--accent); }
.course-body { padding: 20px; display: flex; flex: 1; flex-direction: column; }
.course-category { color: var(--brand-2); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.course-title { color: var(--brand); font-size: 1.1rem; margin: 6px 0 8px; }
.course-desc { color: var(--muted); font-size: .88rem; flex: 1; }
.course-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 10px; }
.price { color: var(--brand); font-weight: 900; font-size: 1.12rem; }
.cart-pill { position: relative; }
.cart-count { position: absolute; right: -7px; top: -8px; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: var(--brand); font-size: .68rem; font-weight: 900; }

.checkout-layout { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.checkout-list, .checkout-summary { padding: 24px; }
.checkout-summary { position: sticky; top: 104px; }
.cart-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.cart-row:last-child { border-bottom: 0; }
.cart-row h3 { color: var(--brand); font-size: .98rem; }
.cart-row p { color: var(--muted); font-size: .8rem; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 0; display: grid; place-items: center; color: var(--danger); background: #fee2e2; }
.total-line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; }
.total-line.grand { border-top: 2px solid var(--line); margin-top: 8px; padding-top: 18px; font-size: 1.15rem; color: var(--brand); font-weight: 900; }
.payment-options { display: grid; gap: 10px; margin: 18px 0; }
.payment-option { border: 2px solid var(--line); border-radius: 12px; padding: 13px; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.payment-option:has(input:checked) { border-color: var(--brand); background: #eef2ff; }
.secure-note { color: var(--muted); font-size: .76rem; text-align: center; margin-top: 12px; }

.payment-gateway { margin: 18px 0; padding: 18px; border: 2px solid #bae6fd; border-radius: 14px; background: #f0f9ff; }
.payment-gateway-heading { display: flex; align-items: center; gap: 12px; color: var(--brand); margin-bottom: 14px; }
.payment-gateway-heading > i { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: #009ee3; font-size: 1.15rem; }
.payment-gateway-heading strong, .payment-gateway-heading small { display: block; }
.payment-gateway-heading small { color: var(--muted); }
.payment-methods { display: flex; gap: 8px; margin-bottom: 12px; }
.payment-methods span { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; color: #075985; background: #e0f2fe; font-size: .8rem; font-weight: 800; }
.payment-gateway p { color: var(--muted); font-size: .8rem; }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.stat { padding: 22px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.stat i { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--brand); background: #e0f2fe; }
.stat strong { display: block; color: var(--brand); font-size: 1.55rem; }
.stat span { color: var(--muted); font-size: .8rem; }
.section-card { padding: 24px; margin-top: 22px; }
.section-title { color: var(--brand); margin-bottom: 16px; }
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty i { display: block; color: var(--line); font-size: 3rem; margin-bottom: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--line); font-size: .84rem; }
th { color: var(--brand); background: #f8fafc; text-transform: uppercase; letter-spacing: .04em; font-size: .72rem; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: .7rem; font-weight: 900; }
.badge.success { color: #065f46; background: #d1fae5; }
.badge.pending { color: #92400e; background: #fef3c7; }
.badge.inactive { color: #991b1b; background: #fee2e2; }

.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { border: 0; background: transparent; color: var(--muted); font-weight: 800; padding: 11px 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: var(--brand); border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 20px; background: rgba(15,23,42,.64); }
.modal.open { display: grid; }
.modal-card { width: min(620px, 100%); max-height: 90vh; overflow-y: auto; background: #fff; border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 20px; }
.modal-close { border: 0; background: #eef2ff; color: var(--brand); width: 38px; height: 38px; border-radius: 10px; }
.access-modal-card { width: min(760px, 100%); }
.access-list { display: grid; gap: 12px; }
.access-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.access-row h3 { color: var(--brand); font-size: .95rem; }
.access-row p { color: var(--muted); font-size: .78rem; margin-top: 4px; }
.access-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.access-actions .btn { min-height: 38px; padding: 8px 11px; font-size: .76rem; }
.course-modal-card { width: min(980px, 100%); }
.check-label { min-height: 48px; display: flex; align-items: center; gap: 9px; }
.course-content-editor { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.editor-heading h3, .student-courses h3 { color: var(--brand); }
.editor-heading p { color: var(--muted); font-size: .82rem; }
.modules-editor { display: grid; gap: 14px; scroll-margin-top: 20px; }
.module-editor { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.module-editor-head { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.lesson-editor-list { display: grid; gap: 10px; margin: 16px 0 12px; }
.lesson-editor-row { display: grid; grid-template-columns: 1fr 150px 1.4fr auto; gap: 10px; align-items: end; padding-top: 12px; border-top: 1px solid var(--line); }
.lesson-editor-row .icon-btn, .module-editor-head .icon-btn { margin-bottom: 5px; }
.add-lesson { min-height: 38px; padding: 8px 12px; font-size: .78rem; }
.empty.compact { padding: 24px; border: 1px dashed var(--line); border-radius: 14px; }
.empty.compact i { font-size: 1.6rem; }
.student-modal-card { width: min(760px, 100%); }
.student-record-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.student-record-grid > div { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.student-record-grid .full { grid-column: 1 / -1; }
.student-record-grid small, .student-record-grid strong { display: block; overflow-wrap: anywhere; }
.student-record-grid small { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.student-record-grid strong { color: var(--brand); margin-top: 4px; }
.student-courses { margin-top: 22px; }
.student-courses ul { list-style: none; display: grid; gap: 8px; margin-top: 10px; }
.student-courses li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; }

.lesson-layout { display: grid; grid-template-columns: 300px 1fr; gap: 22px; }
.lesson-menu, .lesson-view { padding: 22px; }
.module-title { color: var(--brand); font-size: .9rem; margin: 14px 0 8px; }
.lesson-btn { width: 100%; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; padding: 10px; display: flex; gap: 9px; align-items: center; }
.lesson-btn:hover, .lesson-btn.active { background: #eef2ff; color: var(--brand); }
.video-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 14px; background: var(--ink); }
.video-fallback { margin-top: 10px; color: var(--muted); font-size: .82rem; text-align: center; }
.video-fallback a { color: var(--brand); font-weight: 800; }
.pdf-box { min-height: 260px; border: 2px dashed var(--line); border-radius: 14px; display: grid; place-items: center; text-align: center; padding: 28px; }

.footer { padding: 26px 0; color: #cbd5e1; background: var(--brand); text-align: center; font-size: .82rem; }
.loading { opacity: .55; pointer-events: none; }
.hidden { display: none !important; }

@media (max-width: 940px) {
  .hero-auth, .checkout-layout, .lesson-layout { grid-template-columns: 1fr; }
  .hero-auth { margin-top: 18px; }
  .auth-intro { text-align: center; }
  .feature-list { width: fit-content; margin: 0 auto; text-align: left; }
  .checkout-summary { position: static; }
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .nav { min-height: 68px; }
  .mobile-menu { display: block; }
  .nav-links { display: none; position: absolute; left: 16px; right: 16px; top: 70px; flex-direction: column; align-items: stretch; padding: 12px; border-radius: 14px; background: var(--brand); box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
  .nav-user { display: none; }
  .hero-auth { width: min(100% - 22px, 600px); }
  .auth-intro { padding: 10px 6px; }
  .auth-intro h1 { font-size: 2.25rem; }
  .auth-card { padding: 22px 18px; }
  .form-grid, .course-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .page { padding-top: 24px; }
  .page-head { align-items: start; flex-direction: column; }
  .cart-row { grid-template-columns: 1fr auto; }
  .cart-row .price { grid-column: 1; }
  .form-actions .btn { width: 100%; }
  .access-row { grid-template-columns: 1fr; }
  .access-actions { justify-content: flex-start; }
  .editor-heading { align-items: stretch; flex-direction: column; }
  .lesson-editor-row { grid-template-columns: 1fr; }
  .lesson-editor-row .icon-btn, .module-editor-head .icon-btn { margin-bottom: 0; }
  .student-record-grid { grid-template-columns: 1fr; }
  .student-record-grid .full { grid-column: auto; }
}
