/* ==========================================================================
   ZimVID Prep — header, footer, page furniture, tables and auth layout
   ========================================================================== */

/* -- Header --------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--header-h);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  flex: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  box-shadow: var(--shadow-sm);
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-size: 1.22rem;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.brand-name em {
  font-style: normal;
  color: var(--brand-red);
}

.brand-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.8rem;
}

.nav-link {
  position: relative;
  padding: 0.5rem 0.75rem;
  border-radius: var(--pill);
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-link.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 0.2rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0.7rem 0.28rem 0.32rem;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 650;
}

.user-chip:hover {
  border-color: var(--brand);
  color: var(--ink);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-bright), var(--brand-strong));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex: none;
}

.avatar-lg {
  width: 46px;
  height: 46px;
  font-size: 1rem;
}

.premium-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--pill);
  background: var(--gold-soft);
  color: var(--gold-strong);
  font-size: 0.74rem;
  font-weight: 750;
  white-space: nowrap;
}

[data-theme="dark"] .premium-dot {
  color: var(--gold);
}

.nav-toggle {
  display: none;
}

.mobile-nav {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  z-index: 88;
  padding: 0.8rem 20px 1.2rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.mobile-nav.is-open {
  display: block;
  animation: flash-in 0.2s var(--ease) both;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0.4rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 650;
}

.mobile-nav-link:last-of-type {
  border-bottom: 0;
}

.mobile-nav-actions {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

body.exam-body .flashes {
  top: calc(var(--header-h) + 82px);
  bottom: auto;
}

/* -- Footer --------------------------------------------------------------- */
.site-footer {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.1fr;
  gap: 2rem;
  padding: clamp(2.2rem, 4vw, 3.2rem) 0 2rem;
}

.footer-brand p {
  max-width: 32ch;
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-col h4 {
  margin: 0 0 0.8rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.footer-col a,
.footer-col p {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--brand);
}

.pay-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.pay-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.pay-chip img {
  display: block;
  width: auto;
  max-width: 92px;
  max-height: 22px;
  object-fit: contain;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1.1rem 0 1.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.footer-bottom-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-bottom-links a {
  color: var(--muted);
}

.footer-bottom-links a:hover {
  color: var(--brand);
}

/* -- Page headings -------------------------------------------------------- */
.page-head {
  padding: clamp(2rem, 4vw, 3.4rem) 0 clamp(1.4rem, 2.5vw, 2rem);
}

.page-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.page-title {
  margin-bottom: 0.5rem;
}

.page-sub {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--brand);
}

/* -- Section headers ------------------------------------------------------ */
.section-head {
  max-width: 680px;
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

.section-head.center {
  margin-inline: auto;
  text-align: center;
}

.section-head.split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  max-width: none;
  flex-wrap: wrap;
}

.section-title {
  margin-bottom: 0.5rem;
}

.section-sub {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.link-arrow .icon {
  transition: transform 0.18s var(--ease);
}

.link-arrow:hover .icon {
  transform: translateX(3px);
}

/* -- Tables --------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 560px;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.table-title {
  font-weight: 650;
  color: var(--ink);
}

.table-meta {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--pill);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.status-paid,
.status-approved,
.status-pass {
  background: var(--green-soft);
  color: var(--green);
}

.status-pending,
.status-new {
  background: var(--gold-soft);
  color: var(--gold-strong);
}

[data-theme="dark"] .status-pending,
[data-theme="dark"] .status-new {
  color: var(--gold);
}

.status-failed,
.status-rejected,
.status-fail {
  background: var(--red-soft);
  color: var(--red);
}

.status-muted {
  background: var(--surface-2);
  color: var(--muted);
}

/* -- Pagination ----------------------------------------------------------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1.8rem;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 650;
}

.page-link:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.page-link.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.page-link.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* -- Empty states --------------------------------------------------------- */
.empty {
  padding: clamp(2rem, 4vw, 3rem) 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  text-align: center;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin-bottom: 0.9rem;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}

.empty h3 {
  margin-bottom: 0.35rem;
}

.empty p {
  max-width: 44ch;
  margin: 0 auto 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* -- Lock panel ----------------------------------------------------------- */
.lock-panel {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid color-mix(in srgb, var(--gold) 42%, var(--line));
  border-radius: var(--radius);
  background: var(--gold-soft);
}

.lock-panel .icon {
  color: var(--gold-strong);
  margin-top: 2px;
}

[data-theme="dark"] .lock-panel .icon {
  color: var(--gold);
}

.lock-panel h4 {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
}

.lock-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

/* -- Auth pages ----------------------------------------------------------- */
.auth-card {
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.auth-card--wide {
  max-width: 720px;
}

.auth-benefits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 1.2rem;
  margin: 0 auto 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-benefits span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.auth-benefits .icon {
  color: var(--brand);
}

.auth-form .btn {
  margin-top: 0.3rem;
}

.auth-form .btn-primary {
  box-shadow: 0 6px 16px rgba(10, 122, 85, 0.16);
}

.auth-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.9rem;
}

.auth-fields-grid .field {
  margin-bottom: 0.85rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.req {
  color: var(--red);
}

.auth-form .checkbox-row {
  margin: 0.2rem 0 1rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.85rem;
}

.auth-form .checkbox-row a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: underline;
}

.auth-foot {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.auth-foot a {
  font-weight: 700;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.86rem;
}

.auth-note {
  margin: 0.7rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .auth-card {
    padding: 1.15rem;
  }

  .auth-fields-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }
}

/* -- Profile -------------------------------------------------------------- */
.profile-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.2rem;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.profile-card h3 {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
}

.profile-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* -- Static content ------------------------------------------------------- */
.prose {
  max-width: 72ch;
  color: var(--ink-soft);
}

.prose h2 {
  margin-top: 2rem;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
}

.prose h3 {
  margin-top: 1.5rem;
}

.prose p,
.prose li {
  color: var(--muted);
  font-size: 0.98rem;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose ul {
  padding-left: 1.15rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.info-card {
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.info-card .icon {
  color: var(--brand);
  margin-bottom: 0.5rem;
}

.info-card h4 {
  margin: 0 0 0.25rem;
}

.info-card p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

/* -- Payment status page -------------------------------------------------- */
.center-card {
  width: min(520px, 100%);
  margin: clamp(2rem, 7vw, 5rem) auto;
  padding: clamp(1.6rem, 4vw, 2.6rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.center-card h1,
.center-card h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 0.5rem;
}

.center-card p {
  color: var(--muted);
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 66px;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}

.status-icon.is-pending {
  background: var(--gold-soft);
  color: var(--gold-strong);
}

.status-icon.is-failed {
  background: var(--red-soft);
  color: var(--red);
}

.pulse {
  animation: pulse 1.8s var(--ease) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.receipt {
  margin: 1.3rem 0;
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-align: left;
  font-size: 0.88rem;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.28rem 0;
}

.receipt-row span:first-child {
  color: var(--muted);
}

.receipt-row span:last-child {
  font-weight: 650;
  text-align: right;
  word-break: break-all;
}

/* -- Split layouts -------------------------------------------------------- */
.split-2 {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr;
  gap: 1.2rem;
  align-items: start;
}

.split-2.is-form {
  grid-template-columns: 1.15fr 0.85fr;
}

.review-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* -- Misc ---------------------------------------------------------------- */
.divider {
  height: 1px;
  background: var(--line);
  margin: 1.4rem 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.alert {
  display: flex;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.alert .icon {
  flex: none;
  margin-top: 2px;
}

.alert-success { border-color: color-mix(in srgb, var(--green) 30%, var(--line)); background: var(--green-soft); }
.alert-warning { border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); background: var(--gold-soft); }
.alert-error { border-color: color-mix(in srgb, var(--red) 30%, var(--line)); background: var(--red-soft); }

.rating {
  display: inline-flex;
  gap: 1px;
  color: var(--gold);
}

/* -- Responsive ----------------------------------------------------------- */
@media (max-width: 980px) {
  .nav {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .header-actions .hide-sm {
    display: none;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .split-2,
  .split-2.is-form,
  .review-cols {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr;
  }

  .footer-grid .footer-col:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 64px;
  }

  .container {
    padding-inline: 16px;
  }

  .brand-sub {
    display: none;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-name {
    font-size: 1.1rem;
  }

  .header-actions .user-chip span.name {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .flashes {
    top: auto;
    bottom: 16px;
    right: 16px;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* -- Brand-coloured footer ------------------------------------------------ */
.site-footer {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 3px solid var(--gold);
  background:
    radial-gradient(700px 320px at 8% 0%, rgba(255, 255, 255, 0.08), transparent 62%),
    linear-gradient(160deg, #006e36 0%, #004a26 82%);
  color: #fff;
}

.site-footer .brand-mark {
  border-radius: 11px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.site-footer .brand-name,
.site-footer .brand:hover {
  color: #fff;
}

.site-footer .brand-name em {
  color: #ffb4b4;
}

.site-footer .brand-sub {
  color: rgba(255, 255, 255, 0.62);
}

.site-footer .footer-brand p {
  color: rgba(255, 255, 255, 0.74);
}

.site-footer .footer-col h4 {
  color: rgba(255, 255, 255, 0.55);
}

.site-footer .footer-col a,
.site-footer .footer-col p {
  color: rgba(255, 255, 255, 0.82);
}

.site-footer .footer-col a:hover {
  color: var(--gold);
}

.site-footer .pay-chip {
  border-color: rgba(255, 255, 255, 0.85);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
}

.site-footer .footer-bottom {
  border-top-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.62);
}

.site-footer .footer-bottom-links a {
  color: rgba(255, 255, 255, 0.62);
}

.site-footer .footer-bottom-links a:hover {
  color: var(--gold);
}
