/* API RP 754 Triage Tool - Modern Theme */
:root {
  /* Colors */
  --primary-hue: 205;
  /* Corporate Blue */
  --primary: hsl(var(--primary-hue), 85%, 35%);
  --primary-light: hsl(var(--primary-hue), 75%, 55%);
  --primary-dark: hsl(var(--primary-hue), 90%, 20%);

  --bg-page: #f8fafc;
  --bg-panel: rgba(255, 255, 255, 0.95);

  --text-main: #0f172a;
  --text-secondary: #475569;

  --border: rgba(148, 163, 184, 0.4);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  /* Triage Status Colors */
  --tier1-color: #dc2626;
  /* Red 600 */
  --tier2-color: #ea580c;
  /* Orange 600 */
  --tier3-color: #16a34a;
  /* Green 600 */
  --occupational-color: #2563eb;
  /* Blue 600 */
}

/* Base */
html {
  box-sizing: border-box;
  font-size: 16px;
  scroll-behavior: smooth;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family: 'Inter', 'Noto Sans TC', sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1440px;
  /* Increased width for split layout */
  margin: 0 auto;
  padding: 16px;
  gap: 24px;
}

@media (min-width: 1024px) {
  .app-container {
    flex-direction: row;
    /* Main Content Left, Sidebar Right */
    align-items: flex-start;
    padding: 32px;
  }
}

/* Main Content Area */
.main-content {
  flex: 1;
  width: 100%;
}

.brand {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  color: var(--primary);
}

.brand h1 {
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin: 0;
}

.brand .subtitle {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Sidebar (Sticky) */
.result-sidebar {
  width: 100%;
  z-index: 50;
}

@media (min-width: 1024px) {
  .result-sidebar {
    width: 320px;
    position: sticky;
    top: 32px;
    margin-left: 24px;
    flex-shrink: 0;
  }
}

/* Cards & Panels */
.glass-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.15rem;
  color: var(--primary-dark);
  font-weight: 700;
}

.step-num {
  background: var(--primary);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
}

/* -------------------------------------------
   Split Layout (Side-by-Side Question | Info) 
   ------------------------------------------- */
.criteria-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.criteria-item.split-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Desktop Grid Layout */
@media (min-width: 768px) {
  .criteria-item.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 50/50 Split */
    gap: 32px;
    align-items: start;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 32px;
  }

  .criteria-item.split-layout:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
}

/* Question Column Styles */
.criteria-question h4 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--text-main);
  font-weight: 600;
}

.help-text {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Info Column Styles (Static Card) */
.info-card {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 16px;
  font-size: 0.85rem;
}

.info-card h5 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--primary-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Info Lists & Content */
.info-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
}

.info-list li {
  margin-bottom: 6px;
}

.info-list.compact li {
  margin-bottom: 4px;
}

.txt-green {
  color: #166534;
}

.txt-red {
  color: #991b1b;
}

.desc-text {
  margin: 0 0 10px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.divider {
  border: 0;
  border-top: 1px solid #cbd5e1;
  margin: 12px 0;
}

.note-text {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 0.8rem;
  font-style: italic;
}

/* Info Table */
.info-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.8rem;
}

.info-table th,
.info-table td {
  border: 1px solid #e2e8f0;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.info-table th {
  background: #e2e8f0;
  color: var(--text-secondary);
  font-weight: 600;
}

.info-table.dense td {
  padding: 4px 6px;
}

/* Radio Cards */
.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-group.vertical {
  flex-direction: column;
}

.radio-card {
  position: relative;
  cursor: pointer;
  flex: 1;
  min-width: 120px;
}

.radio-card input {
  position: absolute;
  opacity: 0;
}

.card-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  transition: all 0.2s;
}

/* Checked State Styles */
.radio-card input:checked+.card-content {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(var(--primary-hue), 85%, 35%, 0.15);
}

.label-text {
  font-weight: 500;
  font-size: 0.95rem;
}

.radio-card input:checked+.card-content .label-text {
  color: var(--primary-dark);
  font-weight: 700;
}

/* Danger Variants */
.radio-card.danger input:checked+.card-content {
  border-color: var(--tier1-color);
  background: #fef2f2;
}

.radio-card.danger input:checked+.card-content .label-text {
  color: #991b1b;
}

/* Result Card */
.result-card {
  border-top: 8px solid var(--border);
  transition: border-color 0.3s;
}

.result-card.tier1 {
  border-top-color: var(--tier1-color);
}

.result-card.tier2 {
  border-top-color: var(--tier2-color);
}

.result-card.tier3 {
  border-top-color: var(--tier3-color);
}

.result-card.occupational {
  border-top-color: var(--occupational-color);
}

.badge {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #e2e8f0;
  color: var(--text-secondary);
}

.tier1 .badge {
  background: var(--tier1-color);
  color: white;
}

.tier2 .badge {
  background: var(--tier2-color);
  color: white;
}

.tier3 .badge {
  background: var(--tier3-color);
  color: white;
}

.occupational .badge {
  background: var(--occupational-color);
  color: white;
}

.result-title {
  margin: 12px 0 8px;
  font-size: 1.25rem;
  line-height: 1.2;
}

.result-summary {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Tags */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.tag {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  background: #f1f5f9;
  color: var(--text-secondary);
  font-weight: 600;
}

.tier1 .tag {
  background: #fee2e2;
  color: #991b1b;
}

.tier2 .tag {
  background: #ffedd5;
  color: #9a3412;
}

/* Buttons */
.action-buttons {
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.app-footer {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 20px;
}