:root {
  --bg-color: #f4f6f9;
  --panel-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;

  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --success-color: #10b981;
  --success-light: #ecfdf5;
  --warning-color: #f59e0b;
  --warning-light: #fffbeb;
  --danger-color: #ef4444;
  --danger-light: #fef2f2;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px;
  gap: 16px;
}

/* Header Styling */
.app-header {
  background: var(--panel-bg);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
}

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

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.badge {
  background: var(--bg-color);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.control-group select {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: white;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Toggle Switch Styling */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

/* Main Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.3fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.panel {
  background: var(--panel-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.panel h2 {
  font-size: 1.1rem;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.section-help {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Callouts */
.callout {
  padding: 12px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary-color);
  background: #f8fafc;
}

.callout-warning {
  border-left-color: var(--warning-color);
  background: var(--warning-light);
}

.callout strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}

.callout p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Ordered Investigations List */
.ordered-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ordered-item {
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Investigation Menu Items */
.investigations-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.investigation-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  transition: all 0.2s ease;
  background: white;
}

.investigation-card:hover:not(.ordered) {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.investigation-card.ordered {
  opacity: 0.6;
  background: #f8fafc;
}

.investigation-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.investigation-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.investigation-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.symptom-performance-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.perf-tag {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

/* Findings Log */
.findings-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
}

.finding-entry {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #fafafa;
}

.finding-header {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary-color);
  margin-bottom: 6px;
}

.finding-item {
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 6px;
  line-height: 1.3;
}

.status-badge {
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.status-badge.in {
  background: var(--danger-light);
  color: var(--danger-color);
}

.status-badge.out {
  background: var(--success-light);
  color: var(--success-color);
}

/* Differential List */
.differential-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.differential-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.differential-card:hover {
  border-color: var(--primary-color);
}

.differential-card.selected {
  border-color: var(--primary-color);
  background: #eff6ff;
}

.differential-radio {
  accent-color: var(--primary-color);
}

.differential-info {
  flex: 1;
}

.differential-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.prob-bar-container {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}

.prob-bar-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.differential-prob-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-color);
  min-width: 45px;
  text-align: right;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-large {
  padding: 12px 20px;
  font-size: 1rem;
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.empty-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Modal Styling */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  background: white;
  width: 90%;
  max-width: 500px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  color: white;
  background: var(--primary-color);
  text-align: center;
}

.modal-header.correct {
  background: var(--success-color);
}

.modal-header.incorrect {
  background: var(--danger-color);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.score-badge {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  background: #f1f5f9;
  padding: 10px;
  border-radius: var(--radius-sm);
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}
