/* ====================================================================
   Medical-Tracker-Hub — Medical Theme
   Primary: medical teal · Accents: status colours · Soft white background
   ==================================================================== */

:root {
  /* Primary palette */
  --mth-primary:        #0E9F8F;
  --mth-primary-dark:   #0A7A6E;
  --mth-primary-light:  #6FD3C6;
  --mth-primary-50:     #E6F7F5;

  /* Surfaces */
  --mth-bg:             #F7FAFB;
  --mth-surface:        #FFFFFF;
  --mth-border:         #E2E8F0;
  --mth-border-strong:  #CBD5E1;

  /* Text */
  --mth-text:           #1E293B;
  --mth-text-muted:     #64748B;
  --mth-text-soft:      #94A3B8;

  /* Status / flags */
  --mth-red:    #E5484D;     /* urgent / Red flag */
  --mth-amber:  #F5A524;     /* follow-up / Yellow flag */
  --mth-blue:   #3B82F6;     /* awaiting party / Blue flag */
  --mth-green:  #16A34A;     /* completed / paid */
  --mth-purple: #8B5CF6;
  --mth-slate:  #64748B;

  --mth-shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --mth-shadow:    0 2px 8px rgba(15,23,42,0.06);
  --mth-shadow-lg: 0 8px 24px rgba(15,23,42,0.10);

  --mth-radius:    10px;
  --mth-radius-lg: 16px;
}

/* ---------- Base ---------- */
html, body {
  background: var(--mth-bg);
  color: var(--mth-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

a { color: var(--mth-primary-dark); text-decoration: none; }
a:hover { color: var(--mth-primary); text-decoration: underline; }

/* ---------- Override Bootstrap primary ---------- */
.btn-primary {
  background: var(--mth-primary);
  border-color: var(--mth-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--mth-primary-dark);
  border-color: var(--mth-primary-dark);
}
.btn-outline-primary {
  color: var(--mth-primary-dark);
  border-color: var(--mth-primary);
}
.btn-outline-primary:hover {
  background: var(--mth-primary);
  border-color: var(--mth-primary);
  color: #fff;
}
.text-primary { color: var(--mth-primary-dark) !important; }
.bg-primary { background-color: var(--mth-primary) !important; }
.border-primary { border-color: var(--mth-primary) !important; }

/* ---------- Layout shell ---------- */
.mth-shell {
  display: flex;
  min-height: 100vh;
}
.mth-sidebar {
  width: 256px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--mth-primary-dark) 0%, var(--mth-primary) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.mth-sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.mth-sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.18);
  border-radius: var(--mth-radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.mth-sidebar-brand .brand-name { font-weight: 600; font-size: 1.05rem; line-height: 1.1; }
.mth-sidebar-brand .brand-tag  { font-size: 0.72rem; opacity: 0.78; }

.mth-sidebar-nav { padding: 0.75rem 0.5rem; flex: 1; }
.mth-sidebar-nav .nav-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  padding: 0.75rem 0.75rem 0.4rem;
}
.mth-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: rgba(255,255,255,0.88);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.92rem;
  margin-bottom: 2px;
  transition: background 120ms;
}
.mth-sidebar-nav a:hover {
  background: rgba(255,255,255,0.10);
  color: #fff;
  text-decoration: none;
}
.mth-sidebar-nav a.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-weight: 500;
}
.mth-sidebar-nav a i { width: 18px; text-align: center; opacity: 0.9; }

.mth-sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.78rem;
  opacity: 0.85;
}

.mth-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.mth-topbar {
  background: var(--mth-surface);
  border-bottom: 1px solid var(--mth-border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--mth-shadow-sm);
}
.mth-topbar .topbar-search {
  flex: 1; max-width: 480px;
}
.mth-topbar .topbar-search input {
  border: 1px solid var(--mth-border);
  border-radius: 999px;
  padding: 0.4rem 1rem 0.4rem 2.25rem;
  background: var(--mth-bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 0.7rem center;
  width: 100%;
  font-size: 0.92rem;
}
.mth-topbar .topbar-search input:focus {
  outline: none;
  border-color: var(--mth-primary);
  background-color: #fff;
  box-shadow: 0 0 0 3px var(--mth-primary-50);
}

.mth-topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.mth-topbar-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--mth-text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
}
.mth-topbar-icon:hover { background: var(--mth-bg); color: var(--mth-primary-dark); }
.mth-topbar-icon .badge-dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px;
  background: var(--mth-red);
  border-radius: 50%;
  border: 2px solid #fff;
}

.mth-user-chip {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.3rem 0.75rem 0.3rem 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--mth-border);
  cursor: pointer;
}
.mth-user-chip:hover { background: var(--mth-bg); }
.mth-avatar {
  width: 32px; height: 32px;
  background: var(--mth-primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.82rem;
}
.mth-user-chip .name { font-size: 0.88rem; line-height: 1.1; }
.mth-user-chip .role { font-size: 0.72rem; color: var(--mth-text-muted); }

.mth-content { padding: 1.5rem; flex: 1; }

/* ---------- Cards ---------- */
.mth-card {
  background: var(--mth-surface);
  border-radius: var(--mth-radius);
  border: 1px solid var(--mth-border);
  box-shadow: var(--mth-shadow-sm);
}
.mth-card-header {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--mth-border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem;
}
.mth-card-header h2,
.mth-card-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.mth-card-body { padding: 1.1rem; }

/* ---------- Stats / KPI ---------- */
.mth-stat {
  background: var(--mth-surface);
  border: 1px solid var(--mth-border);
  border-radius: var(--mth-radius);
  padding: 1.1rem 1.2rem;
  position: relative;
  overflow: hidden;
}
.mth-stat .stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mth-text-muted);
  margin-bottom: 0.35rem;
}
.mth-stat .stat-value { font-size: 1.85rem; font-weight: 600; color: var(--mth-text); }
.mth-stat .stat-meta { font-size: 0.78rem; color: var(--mth-text-muted); margin-top: 0.25rem; }
.mth-stat .stat-icon {
  position: absolute; top: 1rem; right: 1rem;
  width: 38px; height: 38px;
  background: var(--mth-primary-50);
  color: var(--mth-primary-dark);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Status flags / badges ---------- */
.mth-flag { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.mth-flag-red    { background: var(--mth-red); }
.mth-flag-amber  { background: var(--mth-amber); }
.mth-flag-blue   { background: var(--mth-blue); }
.mth-flag-green  { background: var(--mth-green); }

.mth-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  background: var(--mth-primary-50);
  color: var(--mth-primary-dark);
}
.mth-badge.red    { background: #FEE2E2; color: #991B1B; }
.mth-badge.amber  { background: #FEF3C7; color: #92400E; }
.mth-badge.blue   { background: #DBEAFE; color: #1E40AF; }
.mth-badge.green  { background: #DCFCE7; color: #166534; }
.mth-badge.slate  { background: #F1F5F9; color: #334155; }

/* ---------- Login page ---------- */
.mth-login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--mth-primary) 0%, var(--mth-primary-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.mth-login-card {
  background: var(--mth-surface);
  border-radius: var(--mth-radius-lg);
  box-shadow: var(--mth-shadow-lg);
  width: 100%; max-width: 420px;
  padding: 2.25rem 2rem;
}
.mth-login-brand { text-align: center; margin-bottom: 1.5rem; }
.mth-login-brand .brand-icon {
  width: 64px; height: 64px;
  background: var(--mth-primary-50);
  color: var(--mth-primary-dark);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}
.mth-login-brand h1 { font-size: 1.4rem; font-weight: 600; margin: 0; color: var(--mth-text); }
.mth-login-brand p  { font-size: 0.85rem; color: var(--mth-text-muted); margin: 0.25rem 0 0; }

/* ---------- Tables ---------- */
.mth-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.mth-table th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mth-text-muted);
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--mth-border);
  background: var(--mth-bg);
  font-weight: 600;
}
.mth-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--mth-border);
  font-size: 0.92rem;
}
.mth-table tbody tr:hover td { background: var(--mth-primary-50); }

/* ---------- Forms ---------- */
.form-control:focus, .form-select:focus {
  border-color: var(--mth-primary);
  box-shadow: 0 0 0 3px var(--mth-primary-50);
}

/* ---------- Bilingual hint (Afrikaans secondary) ---------- */
.af-label {
  display: block;
  font-size: 0.72rem;
  color: var(--mth-text-muted);
  font-style: italic;
  font-weight: 400;
  margin-top: 1px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .mth-sidebar { display: none; }
  .mth-content { padding: 1rem; }
}
