/* ============================================================
   SC2 — Siyakhula Cohort 2 | Internal Research Platform
   Design System — AHRI Brand Edition
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ── AHRI Brand Tokens ──────────────────────────────────── */
:root {
  /* AHRI Core Palette */
  --ahri-blue:        #1B5FAD;
  --ahri-blue-dark:   #134A8A;
  --ahri-blue-deeper: #0D2F5E;
  --ahri-orange:      #F5821F;
  --ahri-orange-dark: #D9701A;

  /* UI Surfaces */
  --clr-bg:         #F0F4F8;
  --clr-surface:    #FFFFFF;
  --clr-surface-2:  #F7FAFC;
  --clr-border:     #DDE3EC;
  --clr-border-hover:#B8C5D9;

  /* Text */
  --clr-text-primary:   #0D2040;
  --clr-text-secondary: #4A5F7A;
  --clr-text-muted:     #8A9BB5;
  --clr-text-inverse:   #FFFFFF;

  /* Semantic */
  --clr-success:  #16A34A;
  --clr-warning:  #D97706;
  --clr-error:    #DC2626;
  --clr-info:     #2563EB;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(13, 32, 64, 0.06);
  --shadow-sm:  0 1px 3px rgba(13, 32, 64, 0.08), 0 1px 2px rgba(13, 32, 64, 0.05);
  --shadow-md:  0 4px 6px rgba(13, 32, 64, 0.07), 0 2px 4px rgba(13, 32, 64, 0.06);
  --shadow-lg:  0 10px 15px rgba(13, 32, 64, 0.08), 0 4px 6px rgba(13, 32, 64, 0.05);
  --shadow-xl:  0 20px 25px rgba(13, 32, 64, 0.1), 0 8px 10px rgba(13, 32, 64, 0.06);

  /* Radii */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background-color: var(--clr-bg);
  color: var(--clr-text-primary);
  min-height: 100vh;
}

/* ── Top Navigation ─────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

/* AHRI-style logo mark */
.nav-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--ahri-blue);
  position: relative;
  flex-shrink: 0;
}

.nav-logo::after {
  content: '';
  position: absolute;
  top: -5px;
  right: -5px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ahri-orange);
  border: 2px solid var(--clr-surface);
}

.nav-logo span {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
  letter-spacing: -0.03em;
}

.nav-brand-text {}

.nav-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--clr-text-primary);
  line-height: 1.2;
}

.nav-sub {
  font-size: 0.7rem;
  color: var(--clr-text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--clr-text-secondary);
  text-decoration: none;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.nav-links a:hover { color: var(--ahri-blue); background: #EBF2FC; }
.nav-links a.active { color: var(--ahri-blue); background: #EBF2FC; font-weight: 600; }

.nav-links .nav-logout {
  margin-left: 10px;
  color: var(--clr-error) !important;
  border-color: #FECACA !important;
}
.nav-links .nav-logout:hover { background: #FEF2F2 !important; }

/* ── Page layout ────────────────────────────────────────── */
.container    { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 640px;  margin: 0 auto; padding: 0 24px; }
.page-body    { padding-top: 88px; padding-bottom: 60px; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--clr-border-hover);
}

.card-body { padding: 24px; }
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Typography ─────────────────────────────────────────── */
.page-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--clr-text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--clr-text-primary);
}

.eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ahri-blue);
}

.text-muted { color: var(--clr-text-muted); font-size: 0.85rem; }
.text-secondary { color: var(--clr-text-secondary); }

/* ── Stat Cards ─────────────────────────────────────────── */
.stat-card { padding: 20px 22px; }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ahri-blue);
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--clr-text-secondary);
  margin-top: 4px;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-top: 8px;
  background: #EBF5F0;
  color: var(--clr-success);
}

.stat-top-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-text-muted);
  margin-bottom: 8px;
}

/* ── Divider line accent ────────────────────────────────── */
.accent-bar {
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--ahri-blue), var(--ahri-orange));
  margin-bottom: 16px;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-blue    { background: #EBF2FC; color: var(--ahri-blue);  border-color: #C3D8F5; }
.badge-orange  { background: #FEF3E8; color: var(--ahri-orange); border-color: #FAD4A8; }
.badge-green   { background: #ECFDF5; color: var(--clr-success); border-color: #A7F3D0; }
.badge-muted   { background: var(--clr-bg); color: var(--clr-text-muted); border-color: var(--clr-border); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--ahri-blue);
  color: white;
  border-color: var(--ahri-blue);
  box-shadow: 0 1px 3px rgba(27, 95, 173, 0.25);
}
.btn-primary:hover {
  background: var(--ahri-blue-dark);
  border-color: var(--ahri-blue-dark);
  box-shadow: 0 4px 8px rgba(27, 95, 173, 0.3);
  transform: translateY(-1px);
}

.btn-orange {
  background: var(--ahri-orange);
  color: white;
  border-color: var(--ahri-orange);
  box-shadow: 0 1px 3px rgba(245, 130, 31, 0.25);
}
.btn-orange:hover {
  background: var(--ahri-orange-dark);
  border-color: var(--ahri-orange-dark);
  box-shadow: 0 4px 8px rgba(245, 130, 31, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--clr-surface);
  color: var(--clr-text-primary);
  border-color: var(--clr-border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  border-color: var(--ahri-blue);
  color: var(--ahri-blue);
  background: #EBF2FC;
}

.btn-lg { padding: 13px 28px; font-size: 0.95rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 6px 14px;  font-size: 0.78rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Form elements ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clr-text-secondary);
}
.form-label .required { color: var(--ahri-orange); margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  color: var(--clr-text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem;
  outline: none;
  -webkit-appearance: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--clr-text-muted); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--ahri-blue);
  box-shadow: 0 0 0 3px rgba(27, 95, 173, 0.12);
}

.form-hint { font-size: 0.73rem; color: var(--clr-text-muted); }

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A9BB5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

/* ── Access Type selector ───────────────────────────────── */
.access-type-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.access-type-option { position: relative; }
.access-type-option input[type="radio"] { position: absolute; opacity: 0; width: 0; }

.access-type-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 10px;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--clr-surface);
  transition: all var(--transition);
  text-align: center;
}

.access-type-label .icon { font-size: 1.3rem; }
.access-type-label .name { font-size: 0.78rem; font-weight: 700; color: var(--clr-text-primary); }
.access-type-label .desc { font-size: 0.67rem; color: var(--clr-text-muted); }

.access-type-option input:checked + .access-type-label {
  border-color: var(--ahri-blue);
  background: #EBF2FC;
}
.access-type-option input:checked + .access-type-label .name { color: var(--ahri-blue); }
.access-type-option input:checked + .access-type-label .icon { filter: none; }

/* ── Alert / Notice ─────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
}
.alert-info    { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.alert-success { background: #F0FDF4; border: 1px solid #BBF7D0; color: #166534; }
.alert-warning { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.alert-error   { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }

/* ── Tag ────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-secondary);
}

/* ── Divider ─────────────────────────────────────────────── */
hr.divider { height: 1px; background: var(--clr-border); border: none; }

/* ── Spinner ─────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

/* ── Person row ─────────────────────────────────────────── */
.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--clr-border);
}
.person-row:last-child { border-bottom: none; }
.person-name { font-weight: 600; font-size: 0.9rem; }
.person-role { font-size: 0.73rem; color: var(--clr-text-muted); }

/* ── Doc item ────────────────────────────────────────────── */
.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  background: var(--clr-bg);
  text-decoration: none;
  color: var(--clr-text-primary);
  transition: all var(--transition);
}
.doc-item:hover { border-color: var(--ahri-blue); background: #EBF2FC; }
.doc-name { font-size: 0.88rem; font-weight: 600; }
.doc-type { font-size: 0.7rem; color: var(--clr-text-muted); font-weight: 500; }

/* ── Grid utilities ─────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

/* ── Flex utilities ─────────────────────────────────────── */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-4  { gap: 4px; }  .gap-8  { gap: 8px; }  .gap-12 { gap: 12px; }
.gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

/* ── Spacing ─────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }  .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; } .mt-40 { margin-top: 40px; }

/* ── Fade in ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp 0.35s ease forwards; }
.delay-1 { animation-delay: 0.08s; opacity: 0; }
.delay-2 { animation-delay: 0.16s; opacity: 0; }
.delay-3 { animation-delay: 0.24s; opacity: 0; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .topnav { padding: 0 16px; }
  .nav-links { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .access-type-group { grid-template-columns: 1fr; }
  .container, .container-sm { padding: 0 16px; }
  .page-body { padding-top: 80px; }
}
