/* ===== AssessLearn · ORTHO_TRAUMA_Centre · UI Kit ===== */

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #1f2937;
  background: #f4f7fb;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root {
  /* ABHS teal palette */
  --primary:   #1f6f63;
  --accent:    #2f8f82;
  --secondary: #e7f3f1;
  --danger:    #c0392b;
  --success:   #2e8b57;
  --border:    #d7e6e3;
  --ink:       #0f172a;
  --muted:     #6b7280;
  --surface:   #ffffff;
  --line:      rgba(15, 23, 42, 0.08);
}

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ---- Header ---- */
.header {
  background: #fff;
  border-bottom: 2px solid var(--secondary);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}
.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 44px;
  height: 44px;
  background: var(--secondary);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.brand-title { display: flex; flex-direction: column; }
.brand-title .product { font-size: 18px; font-weight: 800; letter-spacing: 0.2px; }
.brand-title .sub { color: var(--muted); font-size: 13px; }

/* ---- Footer ---- */
.footer {
  margin-top: 40px;
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: #fff;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  width: 100%;
}

/* ---- Typography ---- */
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 12px; }

a { color: var(--accent); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

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

/* ---- Section Titles ---- */
.section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--secondary);
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
th, td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
  font-size: 14px;
}
th {
  background: var(--secondary);
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
}
tr:nth-child(even) { background: #fafbfd; }
td { word-break: break-word; }

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}
.table-responsive table { min-width: 600px; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(0.92); }
.btn-secondary { background: #eef2f7; border-color: var(--border); color: #111827; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- Forms ---- */
label { font-weight: 700; display: block; margin-bottom: 6px; font-size: 14px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
  background: #fff;
  font-size: 15px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 143, 130, 0.15);
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.badge-pass { background: #e7f6ec; color: var(--success); }
.badge-fail { background: #fdecea; color: var(--danger); }
.badge-warn { background: #fff4e5; color: #8a5a00; }
.badge-pending { background: #fff4e5; color: #8a5a00; }
.badge-submitted { background: #e7f6ec; color: var(--success); }

/* ---- Status Chips ---- */
.status-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.status-setup  { background: #e0f2fe; color: #0369a1; }
.status-open   { background: #e7f6ec; color: #15803d; }
.status-closed { background: #fdecea; color: #b91c1c; }

/* ---- Utilities ---- */
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }

/* ---- Nav Grid (Dashboard) ---- */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.nav-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.nav-card:hover {
  box-shadow: 0 4px 16px rgba(31, 111, 99, 0.12);
  border-color: var(--accent);
  text-decoration: none;
}
.nav-card .nav-icon {
  font-size: 26px;
  line-height: 1;
}
.nav-card .nav-label {
  font-weight: 700;
  font-size: 15px;
}
.nav-card .nav-desc {
  font-size: 13px;
  color: var(--muted);
}

/* ---- Stat Cards ---- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin: 14px 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ---- Progress Bars ---- */
.progress-bar-outer {
  background: #e5e7eb;
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-bar-inner {
  height: 100%;
  border-radius: 8px;
  background: var(--primary);
  transition: width 0.4s ease;
}

/* ---- Print ---- */
@media print {
  body { background: #fff; font-size: 11pt; }
  .header, .footer, .no-print { display: none !important; }
  .container { padding: 0; max-width: none; }
  .card { border: none; box-shadow: none; padding: 0; margin: 0; }
  table { page-break-inside: avoid; }
  .table-responsive { overflow: visible; }
  .table-responsive table { min-width: 0; }
}

/* ---- Responsive: Tablet ---- */
@media (max-width: 768px) {
  .container { padding: 16px 12px; }
  .card { padding: 16px; }
  .header-inner { padding: 12px 16px; }
  .nav-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .row > * { min-width: 160px; }
  input, select { font-size: 16px; }
  .btn { width: 100%; text-align: center; margin-bottom: 6px; }
}

/* ---- Responsive: Phone ---- */
@media (max-width: 480px) {
  .header-inner { padding: 10px 12px; }
  .logo { width: 36px; height: 36px; }
  .brand-title .product { font-size: 16px; }
  .container { padding: 10px 8px; }
  .nav-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  h2 { font-size: 18px; }
}
