/*
  HelixPoint Biomedical Lab — Component Styles
  Buttons, cards, inputs, tables, MCQs, charts, feedback, dialogs
*/

/* =========================================
   BUTTONS
   ========================================= */
button, input, select, textarea {
  font-family: inherit;
}

.btn, .primary, .secondary {
  border-radius: var(--radius-md);
  min-height: 44px;
  padding: 0 18px;
  font-size: 13.5px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn:focus-visible,
.primary:focus-visible,
.secondary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.primary,
.btn.primary {
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--brand), #7E6FF4);
  box-shadow: var(--shadow-purple);
  border: 0;
}

.primary:hover,
.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(108, 92, 231, 0.28);
}

.primary:active,
.btn.primary:active {
  transform: translateY(0);
}

.secondary,
.btn.secondary {
  color: var(--brand-2-dark);
  background: var(--brand-2-soft);
  border-color: var(--brand-2-border);
}

.secondary:hover,
.btn.secondary:hover {
  background: #DCF8F9;
  border-color: #B4EDF0;
  transform: translateY(-1px);
}

.btn.ghost {
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn.ghost:hover {
  background: #F4F6FA;
  color: var(--text-primary);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn.small,
.mini-btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-weight: 750;
}

.mini-btn {
  border: 0;
  background: var(--text-primary);
  color: #FFFFFF;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mini-btn:hover {
  background: var(--brand);
  transform: translateY(-1px);
}

.btn:disabled,
.primary:disabled,
.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* =========================================
   INPUTS & FORMS
   ========================================= */
input[type="text"],
input[type="number"],
input[inputmode="decimal"],
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: all var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #B9B0FF;
  box-shadow: var(--focus);
}

input::placeholder {
  color: var(--text-subtle);
}

/* =========================================
   CARDS & PANELS
   ========================================= */
.card,
.panel {
  border: 1px solid var(--border);
  background: var(--surface-translucent);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin: 24px 2px 14px;
}

.section-head h2 {
  font-size: 21px;
  font-weight: 850;
  letter-spacing: -0.02em;
  margin: 5px 0 0;
  color: var(--text-primary);
}

.section-head p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

/* =========================================
   PATIENT CASE CARDS
   ========================================= */
.patient-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.patient {
  position: relative;
  overflow: hidden;
  min-height: 250px;
  padding: 22px;
  border: 1px solid var(--border);
  background: var(--surface-translucent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

.patient:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.patient.selected {
  border-color: var(--patient-border, #D8D2FF);
  box-shadow: 0 0 0 3.5px var(--patient-soft, rgba(108, 92, 231, 0.12)), var(--shadow-sm);
}

.patient::before {
  content: "";
  position: absolute;
  right: -32px;
  top: -32px;
  width: 115px;
  height: 115px;
  border-radius: 50%;
  background: var(--patient-soft, #F1EFFF);
  pointer-events: none;
}

.patient-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  position: relative;
  z-index: 2;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--patient, #6C5CE7);
  background: var(--patient-soft, #F1EFFF);
  font-weight: 850;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.patient h3 {
  font-size: 17.5px;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
}

.patient .meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.symptoms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}

.chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: #F2F5F8;
  border: 1px solid var(--border);
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
}

.chip.suggested {
  background: var(--green-soft);
  color: var(--green-dark);
  border-color: var(--green-border);
}

.patient-drawer {
  background: #F7FAFC;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: none;
}

.patient-actions {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.patient-open-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--patient-soft, #F0EDFF);
  color: var(--patient, #6C5CE7);
  border: 1px solid var(--patient-border, #D8D2FF);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 6px;
}

.patient-open-btn:hover {
  background: var(--patient, #6C5CE7);
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(108, 92, 231, 0.25);
}

/* =========================================
   INVESTIGATION DASHBOARD CARD
   ========================================= */
.investigation-card {
  padding: 24px;
  border: 1px solid var(--border);
  background: var(--surface-translucent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.dash-header-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.dash-patient-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
}

/* =========================================
   HORIZONTAL PROGRESS TRACK
   ========================================= */
.progress-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 18px 0 22px;
}

.progress-step {
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: #F4F7FA;
  border: 1px solid #E6EDF4;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.progress-step:hover {
  background: #EDF2F7;
  color: var(--text-secondary);
}

.progress-step.done {
  background: var(--green-soft);
  color: var(--green-dark);
  border-color: var(--green-border);
}

.progress-step.current {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-border);
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.12);
}

.progress-step b {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  margin-top: 2px;
}

/* =========================================
   RESEARCH STAGE (WIZARD & ARTICLES)
   ========================================= */
.query-box {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.article-item {
  margin-top: 10px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.article-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.article-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.article-item strong {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.35;
}

.article-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.article-item p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 6px 0 0;
}

.quality-badge {
  display: inline-flex;
  margin-top: 8px;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quality-badge.high {
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid var(--green-border);
}

.quality-badge.good {
  color: var(--brand-2-dark);
  background: var(--brand-2-soft);
  border: 1px solid var(--brand-2-border);
}

.quality-badge.moderate {
  color: var(--amber-dark);
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
}

/* =========================================
   LIVE EVIDENCE FEEDBACK PANEL
   ========================================= */
.feedback-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(223, 231, 239, 0.7);
}

.feedback-stat:last-child {
  border-bottom: 0;
}

.feedback-stat span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.feedback-stat strong {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.feedback-note {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--brand-2-border);
  background: var(--brand-2-soft);
  border-radius: var(--radius-md);
  color: var(--brand-2-dark);
  font-size: 12px;
  line-height: 1.55;
  font-weight: 500;
}

.feedback-note.success {
  border-color: var(--green-border);
  background: var(--green-soft);
  color: var(--green-dark);
}

.feedback-note.warning {
  border-color: var(--amber-border);
  background: var(--amber-soft);
  color: var(--amber-dark);
}

/* =========================================
   TEST ITEM / LABORATORY CONSOLE
   ========================================= */
.test-list {
  display: grid;
  gap: 10px;
}

.test-item {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  transition: all var(--transition-fast);
}

.test-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.method, .hazards {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.method ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.method li {
  margin-bottom: 3px;
}

/* =========================================
   DATA TABLES
   ========================================= */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

th, td {
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 12px;
  font-size: 13px;
}

thead th {
  color: var(--text-muted);
  font-weight: 750;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-3);
}

tbody tr:hover {
  background: rgba(245, 248, 251, 0.8);
}

td {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* =========================================
   SVG CALIBRATION CURVE GRAPH
   ========================================= */
.chart-container {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 10px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
}

.chart-container svg {
  display: block;
}

/* =========================================
   MULTIPLE CHOICE QUESTIONS (MCQ)
   ========================================= */
.mcq {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.mcq .q {
  font-size: 13.5px;
  font-weight: 750;
  color: var(--text-primary);
  line-height: 1.45;
}

.options {
  display: grid;
  gap: 8px;
}

.option {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.option:hover {
  background: #FFFFFF;
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.option input {
  accent-color: var(--brand);
  transform: translateY(1px);
  cursor: pointer;
}

.feedback {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--green-border);
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 600;
  display: none;
}

.feedback.error {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red-dark);
}

.feedback.show {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* =========================================
   DIALOGS & MODALS
   ========================================= */
dialog {
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-primary);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: min(640px, 94vw);
  box-shadow: var(--shadow-lg);
  position: fixed;
  inset: 0;
  margin: auto;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

dialog h3 {
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.checklist-grid {
  display: grid;
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 6px;
  margin: 14px 0;
}

.checklist-group {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.checklist-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.checklist-group-title {
  font-weight: 800;
  font-size: 13.5px;
  margin: 0;
  color: var(--text-primary);
}

.checklist-items {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.checklist-items li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.checklist-items input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--brand);
}

.criteria-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 850;
  font-size: 11px;
  border: 1px solid var(--brand-border);
}

/* =========================================
   UTILITIES
   ========================================= */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
