/* =========================================================================
   Afritech Institute System - Student / Guardian / Instructor Portal (Frontend)
   Mobile-first, bilingual, accessible.
   ========================================================================= */

.afsms-portal,
.afsms-portal * { box-sizing: border-box; }

/* Respect a reduced-motion preference across the whole portal. */
@media (prefers-reduced-motion: reduce) {
  .afsms-portal *,
  .afsms-auth-gate * {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

.afsms-portal {
  --afsms-p-bg:        #f5f7fb;
  --afsms-p-surface:   #ffffff;
  --afsms-p-surface-2: #f8fafc;
  --afsms-p-border:    #e5e9f0;
  --afsms-p-text:      #0f172a;
  --afsms-p-text-mute: #64748b;
  --afsms-p-brand:     #1c3f9e;
  --afsms-p-brand-2:   #0b1f4e;
  --afsms-p-accent:    #f5b40a;
  --afsms-p-success:   #10b981;
  --afsms-p-warning:   #f59e0b;
  --afsms-p-danger:    #ef4444;
  --afsms-p-radius:    14px;
  --afsms-p-radius-sm: 10px;
  /* Softer, layered elevation to match the refreshed admin surfaces. */
  --afsms-p-shadow:    0 2px 4px rgba(15,23,42,.04), 0 12px 28px rgba(15,23,42,.08);
  --afsms-p-shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 2px 6px rgba(15,23,42,.05);

  max-width: 1040px;
  margin: 24px auto;
  padding: 18px 16px 48px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--afsms-p-text);
  background: var(--afsms-p-bg);
  border-radius: var(--afsms-p-radius);
}
.afsms-portal a { color: var(--afsms-p-brand); text-decoration: none; transition: color 160ms ease; }
.afsms-portal a:hover { color: #16327e; text-decoration: underline; }
.afsms-portal h1, .afsms-portal h2, .afsms-portal h3 { letter-spacing: -0.02em; margin: 0; }
.afsms-portal h2 { font-size: 18px; font-weight: 700; color: var(--afsms-p-text); }

/* ---------- Header hero ---------- */
.afsms-portal-header {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 260px at 110% -10%, rgba(245,180,10,.28), transparent 60%),
    radial-gradient(700px 300px at -10% 120%, rgba(255,255,255,.10), transparent 60%),
    linear-gradient(135deg, #0b1f4e 0%, #14307a 50%, #1c3f9e 100%);
  color: #fff;
  padding: 26px 26px;
  border-radius: var(--afsms-p-radius);
  margin-bottom: 18px;
  box-shadow: var(--afsms-p-shadow);
}
.afsms-portal-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}
.afsms-portal-header > * { position: relative; z-index: 1; }
.afsms-portal-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}
.afsms-portal-header .meta {
  color: #dbeafe;
  font-size: 14px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.afsms-portal-header .badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(4px);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
}
.afsms-portal-header .badge.nqd::before { content: "🎓 "; }
.afsms-portal-header .badge.hnd::before { content: "🏆 "; }

/* ---------- Sticky tab nav ---------- */
.afsms-portal-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px;
  /* Frosted, translucent bar so section content scrolls softly beneath it. */
  background: var(--afsms-p-surface);
  background: color-mix(in srgb, var(--afsms-p-surface) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border: 1px solid var(--afsms-p-border);
  border-radius: var(--afsms-p-radius);
  margin-bottom: 14px;
  box-shadow: var(--afsms-p-shadow-sm);
  position: sticky;
  top: 10px;
  z-index: 5;
}
.afsms-portal-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--afsms-p-text-mute);
  border-radius: 8px;
  transition: background 160ms ease, color 160ms ease;
  background: transparent;
}
.afsms-portal-nav a:hover {
  background: var(--afsms-p-surface-2);
  color: var(--afsms-p-text);
  text-decoration: none;
}
.afsms-portal-nav a:target,
.afsms-portal-nav a.active {
  background: var(--afsms-p-text);
  color: #fff;
}

/* ---------- Section card ---------- */
.afsms-portal-section {
  background: var(--afsms-p-surface);
  border: 1px solid var(--afsms-p-border);
  border-radius: var(--afsms-p-radius);
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: var(--afsms-p-shadow-sm);
  scroll-margin-top: 80px;
}
.afsms-portal-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #0b1f4e;
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--afsms-p-border);
}
.afsms-portal-section h2::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--afsms-p-brand), var(--afsms-p-brand-2));
}
.afsms-portal-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--afsms-p-text);
}

/* ---------- Tables ---------- */
.afsms-portal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  border: 1px solid var(--afsms-p-border);
  border-radius: 10px;
  overflow: hidden;
}
.afsms-portal-table thead th {
  background: var(--afsms-p-surface-2);
  color: var(--afsms-p-text-mute);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--afsms-p-border);
}
.afsms-portal-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--afsms-p-border);
  vertical-align: middle;
}
.afsms-portal-table tr:last-child td { border-bottom: 0; }
.afsms-portal-table tr:hover td { background: rgba(28,63,158,.04); }

/* ---------- Stat pills ---------- */
.afsms-portal-stats {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.afsms-portal-stats li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--afsms-p-surface-2);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--afsms-p-border);
  font-size: 13px;
  color: var(--afsms-p-text-mute);
  text-transform: capitalize;
}
.afsms-portal-stats li strong {
  font-size: 18px;
  color: var(--afsms-p-text);
  margin-right: 4px;
  letter-spacing: -0.02em;
}

/* ---------- KPI cards ---------- */
.afsms-portal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.afsms-portal-cards > div {
  position: relative;
  background: linear-gradient(180deg, var(--afsms-p-surface), var(--afsms-p-surface-2));
  padding: 16px 14px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--afsms-p-border);
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.afsms-portal-cards > div:hover {
  transform: translateY(-2px);
  box-shadow: var(--afsms-p-shadow);
  border-color: #d4dbe6;
}
.afsms-portal-cards > div::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--afsms-p-brand), var(--afsms-p-brand-2));
  opacity: .7;
}
.afsms-portal-cards > div span {
  display: block;
  color: var(--afsms-p-text-mute);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 4px;
}
.afsms-portal-cards > div strong {
  display: block;
  font-size: 22px;
  color: var(--afsms-p-text);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---------- Empty state ---------- */
.afsms-portal-section > p:only-of-type,
.afsms-portal > p:only-of-type {
  text-align: center;
  padding: 28px 18px;
  color: var(--afsms-p-text-mute);
  background: var(--afsms-p-surface-2);
  border-radius: 10px;
  margin: 8px 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .afsms-portal { padding: 12px 10px 32px; }
  .afsms-portal-header { padding: 20px 18px; }
  .afsms-portal-header h1 { font-size: 20px; }
  .afsms-portal-section { padding: 16px 14px; }
  .afsms-portal-nav { position: static; overflow-x: auto; flex-wrap: nowrap; }
  .afsms-portal-nav a { white-space: nowrap; }
  .afsms-portal-cards { grid-template-columns: repeat(2, 1fr); }
  .afsms-portal-table { font-size: 13px; }
  .afsms-portal-table th, .afsms-portal-table td { padding: 8px 10px; }
}

/* Custom month picker (portal) */
.afsms-monthpicker-pop {
  background: #fff;
  border: 1px solid #e5e9f0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  width: 280px;
  padding: 0;
  overflow: hidden;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.afsms-mp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #1c3f9e;
  color: #fff;
  margin: 0;
}
.afsms-mp-head .afsms-mp-year { font-weight: 600; font-size: 15px; color: #fff; }
.afsms-mp-head button {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px 10px;
  color: #fff;
  border-radius: 6px;
  opacity: .9;
}
.afsms-mp-head button:hover { background: rgba(255, 255, 255, .18); opacity: 1; }
.afsms-mp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px; }
.afsms-mp-month {
  background: #fff;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 12px 0;
  font-size: 13px;
  cursor: pointer;
  color: #0f172a;
  transition: background .15s, color .15s;
}
.afsms-mp-month:hover { background: #f1f5f9; color: #16327e; }
.afsms-mp-month.is-active { background: #1c3f9e; color: #fff; font-weight: 600; }
.afsms-monthpicker-wrap { position: relative; display: inline-block; }
.afsms-portal .afsms-monthpicker-wrap { width: 100%; }
.afsms-monthpicker-wrap .afsms-monthpicker-display { padding-right: 34px !important; }
.afsms-monthpicker-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: auto;
  cursor: pointer;
  font-size: 14px;
  opacity: .65;
}

/* =========================================================================
   Auth gate - modern login card. Used for the [afritech_sms_login] shortcode
   and as the fallback when a visitor hits a portal without the right role.
   ========================================================================= */
.afsms-auth-gate {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px;
  background:
    radial-gradient(1000px 400px at 90% -10%, rgba(245, 180, 10, .12), transparent 60%),
    radial-gradient(600px 400px at -10% 110%, rgba(28, 63, 158, .10), transparent 60%),
    linear-gradient(180deg, #f5f7fb 0%, #eef2f9 100%);
  min-height: calc(100vh - 120px);
  margin: 0;
  max-width: none;
}
.afsms-auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
  padding: 32px 32px 28px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.afsms-auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 18px;
}
.afsms-auth-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1c3f9e, #0b1f4e);
  box-shadow: 0 0 0 3px rgba(28, 63, 158, 0.12);
}
.afsms-auth-card strong { color: #0f172a; font-weight: 700; letter-spacing: .02em; }

.afsms-auth-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.afsms-auth-intro {
  margin: 0 0 20px;
  font-size: 14px;
  color: #64748b;
  line-height: 1.5;
}
.afsms-auth-meta {
  margin: 0 0 16px;
  font-size: 13px;
  color: #64748b;
}

.afsms-auth-alert {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.06);
  color: #991b1b;
  font-size: 13px;
  line-height: 1.4;
}

.afsms-auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}
.afsms-auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.afsms-auth-field span { color: #334155; font-weight: 600; }
.afsms-auth-field input[type="text"],
.afsms-auth-field input[type="email"],
.afsms-auth-field input[type="password"] {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: #0f172a;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  box-shadow: none;
  width: 100%;
  box-sizing: border-box;
}
.afsms-auth-field input:focus {
  outline: none;
  border-color: #1c3f9e;
  box-shadow: 0 0 0 4px rgba(28, 63, 158, 0.14);
}

.afsms-auth-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: #475569;
}
.afsms-auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.afsms-auth-remember input { accent-color: #1c3f9e; }
.afsms-auth-inline-link {
  color: #1c3f9e;
  text-decoration: none;
  font-weight: 600;
}
.afsms-auth-inline-link:hover { color: #16327e; text-decoration: underline; }

.afsms-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
}
.afsms-auth-btn--primary {
  background: linear-gradient(180deg, #1c3f9e 0%, #16327e 100%);
  color: #fff;
  box-shadow: 0 6px 12px rgba(28, 63, 158, 0.25);
}
.afsms-auth-btn--primary:hover {
  background: linear-gradient(180deg, #16327e 0%, #122a68 100%);
  color: #fff;
}
.afsms-auth-btn--primary:active { transform: translateY(1px); }
.afsms-auth-btn--ghost {
  background: transparent;
  color: #334155;
  border-color: #d6deea;
}
.afsms-auth-btn--ghost:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.afsms-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.afsms-auth-footer {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid #eef2f9;
  font-size: 13px;
  color: #64748b;
  text-align: center;
}
.afsms-auth-footer a {
  color: #1c3f9e;
  font-weight: 600;
  text-decoration: none;
  margin-left: 4px;
}
.afsms-auth-footer a:hover { color: #16327e; text-decoration: underline; }

@media (max-width: 480px) {
  .afsms-auth-gate { padding: 20px 10px; }
  .afsms-auth-card { padding: 22px 20px 20px; border-radius: 12px; }
  .afsms-auth-title { font-size: 20px; }
}

/* ---- Public document verification page ---- */
.afsms-verify { padding: 40px 16px; display: flex; justify-content: center; }
.afsms-verify-card {
  width: 100%; max-width: 560px; background: #fff; border: 1px solid #e6e8ec;
  border-radius: 16px; padding: 30px 28px; box-shadow: 0 10px 30px rgba(16,24,40,.06);
}
.afsms-verify-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: #475467; font-size: 14px; }
.afsms-verify-dot { width: 10px; height: 10px; border-radius: 50%; background: #1c3f9e; display: inline-block; }
.afsms-verify-title { font-size: 24px; margin: 0 0 6px; color: #101828; }
.afsms-verify-intro { color: #667085; font-size: 14px; margin: 0 0 18px; line-height: 1.5; }
.afsms-verify-form { display: flex; gap: 8px; margin-bottom: 8px; }
.afsms-verify-input {
  flex: 1; padding: 12px 14px; border: 1px solid #d0d5dd; border-radius: 10px;
  font-size: 15px; letter-spacing: 1px; text-transform: uppercase; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.afsms-verify-input:focus { outline: none; border-color: #1c3f9e; box-shadow: 0 0 0 3px rgba(28,63,158,.15); }
.afsms-verify-btn {
  padding: 12px 20px; border: 0; border-radius: 10px; background: #1c3f9e; color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.afsms-verify-btn:hover { background: #16327e; }
.afsms-verify-result { margin-top: 22px; padding: 20px; border-radius: 12px; border: 1px solid; text-align: center; }
.afsms-verify-result--good { background: #ecfdf3; border-color: #a6f4c5; }
.afsms-verify-result--warn { background: #fffaeb; border-color: #fedf89; }
.afsms-verify-result--bad  { background: #fef3f2; border-color: #fecdca; }
.afsms-verify-badge { font-size: 34px; line-height: 1; margin-bottom: 8px; }
.afsms-verify-result--good .afsms-verify-badge { color: #12b76a; }
.afsms-verify-result--warn .afsms-verify-badge { color: #f79009; }
.afsms-verify-result--bad  .afsms-verify-badge { color: #f04438; }
.afsms-verify-result h2 { margin: 0 0 6px; font-size: 19px; color: #101828; }
.afsms-verify-result p { margin: 0 auto 14px; color: #475467; font-size: 14px; max-width: 42ch; line-height: 1.5; }
.afsms-verify-meta { display: grid; grid-template-columns: 1fr; gap: 0; text-align: left; max-width: 360px; margin: 0 auto; }
.afsms-verify-meta > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid rgba(16,24,40,.08); font-size: 14px; }
.afsms-verify-meta dt { color: #667085; margin: 0; }
.afsms-verify-meta dd { color: #101828; margin: 0; font-weight: 600; text-align: right; }
@media (max-width: 480px) {
  .afsms-verify { padding: 20px 10px; }
  .afsms-verify-card { padding: 22px 18px; border-radius: 12px; }
  .afsms-verify-form { flex-direction: column; }
}

/* =========================================================================
   Brand typography: Sora for headings, matching the Afritech theme.
   The theme loads the Sora webfont; the stack degrades gracefully without it.
   ========================================================================= */
.afsms-portal h1,
.afsms-portal h2,
.afsms-portal h3,
.afsms-portal-header h1,
.afsms-auth-title,
.afsms-verify-title {
  font-family: "Sora", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
