/* Anaphylaxis Calculator - Page-specific styles */

/* Inline error display */
.error-inline {
  display: block;
  margin-top: var(--s-2);
  color: #dc2626;
  font-size: var(--text-sm);
  font-weight: 500;
}

/* Mode Tabs */
.mode-tabs {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
  border-bottom: 1px solid var(--c-border-light);
}

.mode-tab {
  padding: var(--s-3) var(--s-4);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--c-text-secondary);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.mode-tab:hover {
  color: var(--c-text-primary);
}

.mode-tab.active {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
}

/* Mode panels */
.mode-panel {
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

/* Result grid responsive */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}

.result-item {
  padding: var(--s-4);
  background: var(--c-bg-secondary);
  border-radius: var(--r-md);
  text-align: center;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: var(--s-1);
  word-break: break-word;
}

.result-label {
  font-size: var(--text-sm);
  color: var(--c-text-secondary);
}

.result-note {
  padding: var(--s-3) var(--s-4);
  background: var(--c-amber-soft);
  border-left: 4px solid var(--c-amber);
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  color: var(--c-text-primary);
}

.result-actions {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

/* Broselow zone color badges (inline display in results) */
.zone-badge {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  margin: 0 var(--s-2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  vertical-align: middle;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .mode-tabs {
    flex-wrap: wrap;
    gap: var(--s-1);
  }

  /* CEO-6: meet 40px tap-target floor on mobile. */
  .mode-tab {
    padding: var(--s-2) var(--s-3);
    font-size: var(--text-sm);
    min-height: var(--tap-min);
  }

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

  .result-item {
    padding: var(--s-3);
  }

  .result-value {
    font-size: 1.25rem;
  }
}

@media print {
  .mode-tabs {
    display: none;
  }

  .result-grid {
    break-inside: avoid;
  }
}

/* ── Stale-result guard ───────────────────────────────────────────
   A rendered result must never sit beside inputs that have changed
   since it was computed (a dose read next to a stale weight is a
   patient-safety problem). `.is-stale` dims the card body and the
   #staleNotice banner tells the clinician to recalculate. */
#resultsCard.is-stale > *:not(.stale-notice) {
  opacity: 0.3;
  filter: grayscale(0.7);
}

.stale-notice {
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-left: 4px solid #d97706;
  border-radius: var(--r-md, 8px);
  font-size: var(--text-sm, 0.875rem);
  font-weight: 600;
}

/* ── Risk banner ─────────────────────────────────────────────────
   AGENTS.md contract: .risk-banner.level-<ok|warn|risk-high|critical>.
   JS passes the unprefixed level name. */
.risk-banner {
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--s-4);
  text-align: center;
}

.risk-banner.level-ok {
  background: var(--c-green-soft);
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.risk-banner.level-warn {
  background: var(--c-amber-soft);
  color: #92400e;
  border: 1px solid #fde68a;
}

.risk-banner.level-risk-high {
  background: var(--c-red-soft);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.risk-banner.level-critical {
  background: #991b1b;
  color: #fff;
  border: 1px solid #7f1d1d;
}

/* Product prose lives here, not in the 24 px .result-value slot. */
.result-item .result-detail {
  margin-top: var(--s-2);
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--c-text-secondary);
}
