:root {
  --navy: #702877;
  --navy-dark: #5A2060;
  --red: #FF0C38;
  --gold: #F7941D;
  --light-bg: #F5F0F7;
  --white: #FFFFFF;
  --text: #222222;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Jost', Arial, Helvetica, sans-serif;
  background: var(--light-bg);
  color: var(--text);
}

header.site-header {
  background: var(--white);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--navy);
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

header.site-header .brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

header.site-header img.logo {
  height: 46px;
  display: block;
}

header.site-header .brand-text .title {
  font-size: 17px;
  font-weight: bold;
  color: var(--navy);
  line-height: 1.2;
}

header.site-header .brand-text .subtitle {
  font-size: 12px;
  color: #888;
  line-height: 1.2;
}

.hero-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: white;
  padding: 40px 24px;
  text-align: center;
  border-bottom: 4px solid var(--gold);
}
.hero-banner h1 {
  margin: 0 0 8px 0;
  font-size: 26px;
}
.hero-banner p {
  margin: 0;
  opacity: 0.9;
  font-size: 15px;
}

footer.site-footer {
  text-align: center;
  padding: 24px 16px;
  color: #888;
  font-size: 12px;
  width: 100%;
  box-sizing: border-box;
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 24px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  font-size: 15px;
}

.btn-primary {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-dark); }

.btn-outline {
  background: var(--white);
  color: var(--red);
  border-color: var(--red);
}
.btn-outline:hover { background: #fff0f2; }

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 24px;
}

.login-page-wrap {
  min-height: calc(100vh - 76px - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--light-bg) 0%, #dde3ee 100%);
  padding: 40px 20px;
  box-sizing: border-box;
}

.login-card {
  max-width: 440px;
  width: 100%;
  background: var(--white);
  border-radius: 16px;
  padding: 44px 40px;
  box-shadow: 0 8px 30px rgba(19,64,116,0.15);
  text-align: center;
  border-top: 5px solid var(--gold);
}

.login-card .icon-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px auto;
  font-size: 28px;
}

.login-card h1 {
  color: var(--navy);
  font-size: 22px;
  margin-bottom: 8px;
}

.login-card p.subtitle {
  color: #666;
  margin-bottom: 28px;
  font-size: 14px;
  line-height: 1.5;
}

.login-card .fine-print {
  margin-top: 24px;
  font-size: 12px;
  color: #999;
  line-height: 1.5;
}

input[type="email"], input[type="text"], input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 16px;
}

/* Math captcha (login-link security check) */
.captcha-box {
  border: 1px solid #d8deeb;
  background: var(--light-bg);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  text-align: left;
}
.captcha-box .captcha-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.captcha-box label {
  font-size: 13px;
  color: var(--navy);
  font-weight: 600;
}
.captcha-box .captcha-row a {
  color: var(--navy);
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.captcha-box .captcha-row a:hover {
  background: #d8deeb;
}
.captcha-box input[type="text"] {
  margin-bottom: 0;
  background: var(--white);
}

.progress-summary {
  background: var(--white);
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 5px solid var(--navy);
  box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}

.progress-summary h2 {
  color: var(--navy);
  margin: 0 0 4px 0;
  font-size: 20px;
}

.progress-summary .progress-pct {
  font-size: 32px;
  font-weight: bold;
  color: var(--gold);
  min-width: 90px;
  text-align: right;
}

.progress-bar-track {
  width: 100%;
  height: 10px;
  background: var(--light-bg);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #FF9F29);
  transition: width 0.4s ease;
}

.section-heading {
  color: var(--navy);
  font-size: 20px;
  margin: 0 0 18px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.video-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 8px rgba(0,0,0,0.09);
  cursor: pointer;
  position: relative;
  transition: transform 0.18s, box-shadow 0.18s;
}
.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(19,64,116,0.18);
}

.video-card.completed {
  border: 2px solid #2ecc71;
}
.video-card.completed .video-card-body {
  background: #f4fbf7;
}

.video-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 32px;
  position: relative;
  overflow: hidden;
}

.video-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.15s;
}
.video-card:hover .video-thumb::after {
  background: rgba(0,0,0,0.15);
}

.video-thumb .play-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  backdrop-filter: blur(2px);
}

.video-thumb .watched-ribbon {
  position: absolute;
  top: 10px;
  right: -32px;
  background: #2ecc71;
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 4px 36px;
  transform: rotate(35deg);
  z-index: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.video-card-body { padding: 16px 18px; }
.video-card-body h3 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: var(--text);
  line-height: 1.35;
}
.video-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.video-card-body .video-status {
  font-size: 12px;
  color: #999;
}
.video-card-body .video-status.done {
  color: #2ecc71;
  font-weight: bold;
}
.video-card-body .video-duration {
  font-size: 12px;
  color: #888;
  background: var(--light-bg);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.category-section {
  margin-bottom: 36px;
}

.completion-banner {
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
  color: white;
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 32px;
  text-align: center;
}
.completion-banner strong {
  font-size: 18px;
  display: block;
  margin-bottom: 8px;
}
.completion-banner p {
  margin: 0 0 16px 0;
  opacity: 0.95;
  font-size: 14px;
}
.completion-banner .btn-primary {
  background: white;
  color: #27ae60;
  border-color: white;
}
.completion-banner .btn-primary:hover {
  background: #f0f0f0;
}

.checkmark-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #2ecc71;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.error-msg { color: var(--red); font-size: 13px; margin-bottom: 12px; }
.success-msg { color: #2ecc71; font-size: 14px; margin-bottom: 12px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-content {
  background: black; border-radius: 8px; max-width: 90vw; max-height: 90vh;
  position: relative;
}
.modal-close {
  position: absolute; top: -40px; right: 0; color: white; font-size: 28px;
  cursor: pointer; background: none; border: none;
}
video { max-width: 90vw; max-height: 80vh; display: block; }

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
}
table.admin-table th, table.admin-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}
table.admin-table th { background: var(--navy); color: white; }

/* ---------- Mobile responsiveness ---------- */
@media (max-width: 768px) {
  header.site-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  header.site-header img.logo { height: 36px; }
  header.site-header .brand-text .title { font-size: 15px; }
  header.site-header .brand-text .subtitle { font-size: 11px; }

  .hero-banner {
    padding: 28px 16px;
  }
  .hero-banner h1 { font-size: 20px; }
  .hero-banner p { font-size: 13px; }

  .container {
    padding: 24px 14px;
  }

  .login-card {
    padding: 32px 24px;
  }

  .progress-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
  }
  .progress-summary .progress-pct {
    text-align: left;
    font-size: 26px;
  }
  .progress-bar-track { width: 100%; }

  .video-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .section-heading { font-size: 17px; }

  table.admin-table { font-size: 12px; }
  table.admin-table th, table.admin-table td { padding: 8px 10px; }

  .modal-content { max-width: 96vw; }
  video { max-width: 96vw; }

  .completion-banner { padding: 20px; }
  .completion-banner strong { font-size: 16px; }
}

@media (max-width: 420px) {
  header.site-header .brand-text .subtitle { display: none; }
  .btn { padding: 10px 20px; font-size: 14px; }
}
