/* ==========================================================================
   QUEENSLAND HEALTH / AUSTRALIAN CLINICAL DOCUMENT DESIGN SYSTEM
   ENT Specialist Outpatient Intake & EMR Note Generator
   Color Palette: Deep Teal (#004b6e), Maroon (#741334), Slate (#2c3e50), Off-White (#f4f7f9)
   ========================================================================== */

:root {
  /* Clinical Theme Tokens */
  --qld-teal: #004b6e;
  --qld-teal-light: #e6f0f5;
  --qld-teal-hover: #003650;
  --qld-maroon: #741334;
  --qld-maroon-light: #f9ecef;
  
  --bg-page: #f4f7f9;
  --bg-card: #ffffff;
  --border-card: #d1dbe3;
  --border-focus: #004b6e;
  
  --text-primary: #1a252c;
  --text-secondary: #4a5c68;
  --text-muted: #70818e;
  
  --accent-rose: #c0392b;
  --accent-amber: #d35400;
  --accent-emerald: #1e8449;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-heading: 'Outfit', 'Inter', -apple-system, sans-serif;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

/* Base Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Banner */
header {
  background-color: var(--qld-teal);
  color: #ffffff;
  padding: 1rem 2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 4px solid var(--qld-maroon);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-badge-logo {
  background: var(--qld-maroon);
  color: #ffffff;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 1px;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.2);
}

.brand-title-group h1 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
  font-weight: 300;
}

/* Mode Switcher Tabs */
.mode-tabs {
  display: flex;
  background: rgba(0,0,0,0.2);
  padding: 4px;
  border-radius: var(--radius-md);
}

.mode-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.8);
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mode-btn.active {
  background: #ffffff;
  color: var(--qld-teal);
  box-shadow: var(--shadow-sm);
}

/* Clinical Preset Toolbar */
.preset-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-card);
  padding: 0.6rem 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
}

.preset-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--qld-maroon);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.preset-chip {
  background: var(--bg-page);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 50px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.preset-chip:hover {
  background: var(--qld-teal-light);
  color: var(--qld-teal);
  border-color: var(--qld-teal);
}

/* Main Container Layout */
.main-container {
  max-width: 1280px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  width: 100%;
  flex: 1;
}

.view-section {
  display: none;
}

.view-section.active-view {
  display: block;
}

/* Glass / Card Container */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--qld-teal);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Section Header Bar */
.section-header-bar {
  background: var(--qld-teal-light);
  color: var(--qld-teal);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.6rem 1rem;
  border-left: 4px solid var(--qld-teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5rem 0 1rem 0;
}

/* Form Controls & Layouts */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-input, .form-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 75, 110, 0.15);
}

/* Checkbox & Pill Selection Grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.6rem;
}

.checkbox-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #ffffff;
  border: 1px solid var(--border-card);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.checkbox-pill:hover {
  background: var(--bg-page);
  border-color: var(--qld-teal);
}

.checkbox-pill input[type="checkbox"] {
  accent-color: var(--qld-teal);
  width: 16px;
  height: 16px;
}

/* Region Selector Cards (SVG Vector Icons) */
.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.region-card {
  background: #ffffff;
  border: 2px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.region-card:hover {
  border-color: var(--qld-teal);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.region-card.selected {
  border-color: var(--qld-teal);
  background: var(--qld-teal-light);
}

.region-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.75rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: 50%;
  color: var(--qld-teal);
  transition: all 0.25s ease;
}

.region-card.selected .region-icon {
  background: var(--qld-teal);
  border-color: var(--qld-teal);
  color: #ffffff;
}

.region-icon svg {
  width: 28px;
  height: 28px;
}

.region-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--qld-teal);
  margin-bottom: 0.25rem;
}

.region-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.region-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border-card);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: transparent;
}

.region-card.selected .region-check {
  background: var(--qld-teal);
  border-color: var(--qld-teal);
  color: #ffffff;
}

/* Option Pill Buttons */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.option-pill {
  background: #ffffff;
  border: 1px solid var(--border-card);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-pill:hover {
  border-color: var(--qld-teal);
  background: var(--qld-teal-light);
}

.option-pill.active {
  background: var(--qld-teal);
  color: #ffffff;
  border-color: var(--qld-teal);
}

/* Progress Step Indicator */
.kiosk-progress-container {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.kiosk-progress-bar {
  height: 6px;
  background: var(--border-card);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.kiosk-progress-fill {
  height: 100%;
  background: var(--qld-teal);
  width: 20%;
  transition: width 0.3s ease;
}

.kiosk-steps {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.step-item.active {
  color: var(--qld-teal);
}

.step-item.completed {
  color: var(--accent-emerald);
}

/* Button UI Elements */
.btn-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-card);
}

.btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--qld-teal);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--qld-teal-hover);
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-card);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-page);
}

.btn-success {
  background: var(--accent-emerald);
  color: #ffffff;
}

.btn-success:hover {
  background: #145a32;
}

/* Red Flag Warning Box */
.red-flag-box {
  background: #fdf2f2;
  border: 1px solid #f8b4b4;
  border-left: 5px solid var(--accent-rose);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.red-flag-icon {
  font-size: 1.5rem;
}

.red-flag-content h4 {
  color: var(--accent-rose);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.red-flag-content p {
  font-size: 0.85rem;
  color: #7f1d1d;
}

/* Clinician EMR Dashboard Layout */
.doctor-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
}

@media (max-width: 992px) {
  .doctor-layout {
    grid-template-columns: 1fr;
  }
}

.emr-text-box {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1e293b;
  min-height: 480px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

.emr-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
}

/* Summary Panel Items */
.summary-item {
  border-bottom: 1px solid var(--border-card);
  padding: 0.75rem 0;
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-val {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--qld-teal);
  margin-top: 0.2rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--qld-teal);
  color: #ffffff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Print Styles */
@media print {
  header, .preset-bar, .mode-tabs, .emr-actions, .btn-group {
    display: none !important;
  }
  body {
    background: #ffffff;
  }
  .main-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
  .emr-text-box {
    border: none;
    padding: 0;
    font-size: 10pt;
  }
}
