/* Modern Triage CSS Framework */
/* Mobile-First Responsive Design */
/* Works with existing JavaScript logic but provides modern UI */

:root {
  /* Brand Colors - Configurable via branding system */
  /* These will be overridden by inline styles in CustomTriageMaster.cshtml */
  --brand-primary: #2563eb;
  --brand-secondary: #1d4ed8;
  --brand-accent: #3b82f6;
  
  /* Colors - Derived from brand colors */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: var(--brand-accent);
  --primary-600: var(--brand-primary);
  --primary-700: var(--brand-secondary);
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* Grays */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Success/Warning/Error */
  --success-50: #ecfdf5;
  --success-500: #10b981;
  --success-600: #059669;
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --error-50: #fef2f2;
  --error-500: #ef4444;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Typography */
  --font-inter: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Brand-specific classes (styled via JavaScript) */
.brand-icon-bg {
  /* Background gradient applied via JS */
}

.brand-progress-dot {
  /* Background color applied via JS */
}

.brand-progress-bar {
  /* Background gradient applied via JS */
}

.brand-link {
  /* Hover color applied via JS */
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-inter);
  line-height: 1.6;
  color: var(--gray-800);
  background: linear-gradient(135deg, var(--primary-50) 0%, #ffffff 50%, var(--primary-50) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Utility Classes */
.font-inter { font-family: var(--font-inter); }
.min-h-screen { min-height: 100vh; }
.min-h-full { min-height: 100%; }
.h-full { height: 100%; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.space-x-1 > * + * { margin-left: var(--space-1); }
.space-x-2 > * + * { margin-left: var(--space-2); }
.space-x-3 > * + * { margin-left: var(--space-3); }
.space-x-4 > * + * { margin-left: var(--space-4); }
.space-y-2 > * + * { margin-top: var(--space-2); }
.space-y-3 > * + * { margin-top: var(--space-3); }
.space-y-4 > * + * { margin-top: var(--space-4); }
.space-y-6 > * + * { margin-top: var(--space-6); }

/* Layout */
.max-w-4xl { max-width: 56rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.ml-2 { margin-left: var(--space-2); }

/* Background & Colors */
.bg-white { background-color: #ffffff; }
.bg-white\/80 { background-color: rgb(255 255 255 / 0.8); }
.bg-white\/50 { background-color: rgb(255 255 255 / 0.5); }
.bg-gray-50 { background-color: var(--gray-50); }
.bg-gray-100 { background-color: var(--gray-100); }
.bg-gray-200 { background-color: var(--gray-200); }
.bg-gray-300 { background-color: var(--gray-300); }
.bg-blue-600 { background-color: var(--primary-600); }
.bg-gradient-to-r { background-image: linear-gradient(to right, var(--tw-gradient-stops)); }
.bg-gradient-to-br { background-image: linear-gradient(to bottom right, var(--tw-gradient-stops)); }
.from-blue-50 { --tw-gradient-from: var(--primary-50); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(239 246 255 / 0)); }
.from-blue-600 { --tw-gradient-from: var(--primary-600); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgb(37 99 235 / 0)); }
.to-indigo-50 { --tw-gradient-to: #eef2ff; }
.to-indigo-600 { --tw-gradient-to: #4f46e5; }
.via-white { --tw-gradient-stops: var(--tw-gradient-from), #ffffff, var(--tw-gradient-to, rgb(255 255 255 / 0)); }

/* Text Colors */
.text-white { color: #ffffff; }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.text-gray-800 { color: var(--gray-800); }
.text-gray-900 { color: var(--gray-900); }
.text-blue-600 { color: var(--primary-600); }
.text-success-600 { color: var(--success-600); }
.text-error-500 { color: var(--error-500); }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Borders */
.border { border-width: 1px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-gray-200 { border-color: var(--gray-200); }
.border-gray-300 { border-color: var(--gray-300); }
.border-blue-300 { border-color: var(--primary-300); }
.border-success-300 { border-color: #86efac; }
.border-error-300 { border-color: #fca5a5; }

/* Border Radius */
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: 9999px; }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* Effects */
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.transition-all { transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1); }
.transition-colors { transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.15s cubic-bezier(0.4, 0, 0.2, 1); }
.duration-300 { transition-duration: 300ms; }
.duration-500 { transition-duration: 500ms; }
.ease-out { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); }

/* Positioning */
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-50 { z-index: 50; }
.relative { position: relative; }
.absolute { position: absolute; }

/* Sizing */
.w-2 { width: var(--space-2); }
.w-10 { width: 2.5rem; }
.w-full { width: 100%; }
.h-1\.5 { height: 0.375rem; }
.h-2 { height: var(--space-2); }
.h-10 { height: 2.5rem; }

/* Hover Effects */
.hover\:text-blue-600:hover { color: var(--primary-600); }
.hover\:bg-blue-50:hover { background-color: var(--primary-50); }
.hover\:bg-gray-50:hover { background-color: var(--gray-50); }
.hover\:shadow-md:hover { box-shadow: var(--shadow-md); }
.hover\:scale-105:hover { transform: scale(1.05); }

/* Focus States */
.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px var(--primary-200); }
.focus\:ring-blue-200:focus { box-shadow: 0 0 0 2px var(--primary-200); }
.focus\:border-blue-500:focus { border-color: var(--primary-500); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Question Card Styles */
.question-card {
  background: white;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
  border: 1px solid var(--gray-200);
  transition: all 0.3s ease;
  transform: translateY(0);
}

.question-card.entering {
  transform: translateX(100%);
  opacity: 0;
}

.question-card.entered {
  transform: translateX(0);
  opacity: 1;
}

.question-card.exiting {
  transform: translateX(-100%);
  opacity: 0;
}

.question-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

/* Question Types */
.question-header {
  margin-bottom: var(--space-6);
}

.question-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--space-3);
  line-height: 1.4;
}

.question-description {
  color: var(--gray-600);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.question-required {
  display: inline-flex;
  align-items: center;
  color: var(--error-500);
  font-size: 0.875rem;
  margin-top: var(--space-2);
}

.question-required i {
  margin-right: var(--space-1);
}

/* Answer Options */
.answer-options {
  margin-bottom: var(--space-6);
}

.answer-option {
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.answer-option:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.answer-option.selected {
  background: var(--primary-50);
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-200);
}

.answer-option.selected::after {
  content: '✓';
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  color: var(--primary-600);
  font-weight: bold;
  font-size: 1.1rem;
}

.answer-option input[type="radio"],
.answer-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.answer-option-label {
  display: block;
  font-weight: 500;
  color: var(--gray-800);
  cursor: pointer;
}

/* Text Input */
.text-input {
  width: 100%;
  padding: var(--space-4);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  transition: all 0.2s ease;
  background: white;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-200);
}

.text-input.error {
  border-color: var(--error-500);
  box-shadow: 0 0 0 3px var(--error-50);
}

/* Slider */
.slider-container {
  padding: var(--space-4) 0;
}

.slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--gray-200);
  outline: none;
  -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-600);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
  background: var(--primary-700);
  transform: scale(1.1);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: 0.875rem;
  color: var(--gray-600);
}

/* Navigation Buttons */
.navigation-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--gray-200);
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn i {
  margin-right: var(--space-2);
}

.btn-secondary i {
  margin-right: 0;
  margin-left: var(--space-2);
}

/* Validation Messages */
.validation-message {
  display: flex;
  align-items: center;
  color: var(--error-500);
  font-size: 0.875rem;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--error-50);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--error-500);
}

.validation-message i {
  margin-right: var(--space-2);
}

.validation-message.success {
  color: var(--success-600);
  background: var(--success-50);
  border-left-color: var(--success-600);
}

/* Progress Tracking */
.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-8);
}

.progress-step {
  display: flex;
  align-items: center;
  color: var(--gray-400);
  font-size: 0.875rem;
}

.progress-step.active {
  color: var(--primary-600);
}

.progress-step.completed {
  color: var(--success-600);
}

.progress-step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: var(--space-2);
  font-weight: 600;
  transition: all 0.3s ease;
}

.progress-step.active .progress-step-circle {
  background: var(--primary-600);
  color: white;
}

.progress-step.completed .progress-step-circle {
  background: var(--success-600);
  color: white;
}

.progress-connector {
  width: 60px;
  height: 2px;
  background: var(--gray-200);
  margin: 0 var(--space-4);
}

.progress-step.completed + .progress-step .progress-connector {
  background: var(--success-600);
}

/* Loading States */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  border-top-color: var(--primary-600);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .px-4 { padding-left: var(--space-3); padding-right: var(--space-3); }
  .question-card { padding: var(--space-6); }
  .question-title { font-size: 1.125rem; }
  .navigation-controls { flex-direction: column-reverse; gap: var(--space-4); }
  .btn { width: 100%; justify-content: center; }
  .progress-steps { display: none; }
  .hidden.md\:flex { display: none !important; }
}

@media (min-width: 768px) {
  .md\:flex { display: flex; }
  .md\:block { display: block; }
}

/* Animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutLeft {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.animate-slide-in-right {
  animation: slideInRight 0.4s ease-out forwards;
}

.animate-slide-in-left {
  animation: slideInLeft 0.4s ease-out forwards;
}

.animate-slide-out-left {
  animation: slideOutLeft 0.4s ease-out forwards;
}

.animate-slide-out-right {
  animation: slideOutRight 0.4s ease-out forwards;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard navigation */
.btn:focus-visible,
.answer-option:focus-visible,
.text-input:focus-visible {
  outline: 2px solid var(--primary-600);
  outline-offset: 2px;
}

/* Questionnaire Selection Styles */
.questionnaire-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .questionnaire-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .questionnaire-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.questionnaire-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: var(--radius-xl);
}

.questionnaire-option:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-400);
}

.questionnaire-info {
  flex: 1;
}

.questionnaire-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.questionnaire-description {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin: 0;
}

.questionnaire-option i {
  color: var(--primary-600);
  font-size: 1.25rem;
  margin-left: var(--space-4);
  transition: transform 0.2s ease;
}

.questionnaire-option:hover i {
  transform: translateX(4px);
}

.no-questionnaires {
  text-align: center;
  padding: var(--space-12);
  color: var(--gray-600);
}

.no-questionnaires i {
  display: block;
  margin-bottom: var(--space-4);
}

/* Previously hid original lists; removed to allow server-rendered selection */


/* Allow search inputs */

/* Allow questionnaire links */

/* Allow default containers */

/* Ensure links are visible */
.questionnaires-list a,
.questionnaire-list a,
ul.questionnaires a,
ol.questionnaires a {
  display: initial;
}

/* Remove text-based hiding */

/* Remove text-based hiding */

/* Modern Triage Interface Styles */
/* Designed to work with existing JavaScript but provide modern UI */

.modern-triage-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Welcome Section */
.welcome-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 2rem 0;
}

.welcome-card {
  background: white;
  border-radius: 24px;
  padding: 3rem 2rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  text-align: center;
  max-width: 600px;
  width: 100%;
  border: 1px solid var(--gray-200);
}

.welcome-header {
  margin-bottom: 2rem;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

.welcome-icon i {
  font-size: 2rem;
  color: white;
}

.welcome-card h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.welcome-subtitle {
  color: var(--gray-600);
  font-size: 1.125rem;
  margin-bottom: 0;
}

.welcome-content {
  margin-top: 2rem;
}

.welcome-description {
  color: var(--gray-700);
  font-size: 1.125rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.welcome-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.info-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--primary-50);
  border-radius: 12px;
  border: 1px solid var(--primary-100);
}

.info-item i {
  color: var(--primary-600);
  font-size: 1.25rem;
}

.info-item span {
  color: var(--primary-800);
  font-weight: 500;
}

.start-btn {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: white;
  border: none;
  border-radius: 16px;
  padding: 1.25rem 2.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.3s ease;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(37, 99, 235, 0.4);
}

.start-btn:active {
  transform: translateY(0);
}

/* Startup Questions Section */
.startup-container {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--gray-200);
  margin-top: 2rem;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: between;
  margin-bottom: 2rem;
  gap: 1rem;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-600), var(--primary-500));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-text {
  color: var(--gray-600);
  font-weight: 500;
  white-space: nowrap;
}

.startup-form h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.form-description {
  color: var(--gray-600);
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

.form-grid {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  padding: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.radio-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.75rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  transition: all 0.3s ease;
  background: white;
  flex: 1;
  min-width: 140px;
}

.radio-option:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
}

.radio-option input[type="radio"] {
  display: none;
}

.radio-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  position: relative;
  transition: all 0.3s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
  border-color: var(--primary-500);
  background: var(--primary-500);
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
  content: '';
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.radio-option input[type="radio"]:checked ~ span {
  color: var(--primary-700);
  font-weight: 600;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}

.btn-primary, .btn-secondary {
  padding: 1rem 2rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

/* Questions Container */
.questions-container {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--gray-200);
  margin-top: 2rem;
  min-height: 400px;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--gray-600);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top: 3px solid var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Questionnaire Selection Styles */
.questionnaire-selection {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--gray-200);
  margin-top: 2rem;
}

.questionnaire-header {
  margin-bottom: 2rem;
}

.questionnaire-title-section {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.back-to-welcome {
  background: none;
  border: 2px solid var(--gray-300);
  color: var(--gray-700);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.back-to-welcome:hover {
  border-color: var(--primary-400);
  background: var(--primary-50);
  color: var(--primary-700);
  transform: translateX(-2px);
}

.back-to-welcome i {
  font-size: 0.875rem;
}

.title-content {
  flex: 1;
}

.questionnaire-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.search-container {
  margin-top: 1.5rem;
}

.search-input-wrapper {
  position: relative;
  max-width: none;
  width: 100%;
}

.search-input-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 1rem;
}

.modern-search {
  width: 100%;
  padding: 1rem 1rem 1rem 2.5rem;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

.modern-search:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.questionnaire-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.questionnaire-card {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: 16px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.questionnaire-card:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

.questionnaire-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.questionnaire-card p {
  color: var(--gray-600);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
}

.questionnaire-card .card-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-100);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.questionnaire-card .card-icon i {
  color: var(--primary-600);
  font-size: 1.25rem;
}

/* Fallback questionnaire card - full width and distinct styling */
.questionnaire-card--fallback {
  grid-column: 1 / -1; /* span full width across grid */
  border-color: var(--primary-500);
  background: linear-gradient(180deg, var(--primary-50) 0%, #ffffff 100%);
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.12);
}

.questionnaire-card--fallback .card-icon {
  background: var(--primary-600);
}

.questionnaire-card--fallback .card-icon i {
  color: #ffffff;
}

.questionnaire-card--fallback:hover {
  border-color: var(--primary-600);
  background: linear-gradient(180deg, var(--primary-50) 0%, #f9fbff 100%);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(59, 130, 246, 0.18);
}

/* Modern Question Flow Styles - Matching questionnaire selection style */
.questions-container {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--gray-200);
  margin-top: 0;
  min-height: 500px;
}

.questionnaire-title-display {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--gray-100);
}

.questionnaire-title-display h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

/* Improved Question Card Aesthetics */
.question-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: 0 10px 20px rgba(20, 35, 90, 0.06);
}

.question-card h3 {
  font-size: 1.35rem;
  line-height: 1.35;
  margin: 0 0 0.75rem 0;
  color: var(--gray-900);
}

.question-card .ExtraInfo {
  color: var(--gray-600);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* Options - cleaner, modern, touch-friendly */
.question-options {
  display: grid;
  gap: 0.75rem;
}

.question-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.question-option:hover {
  border-color: var(--primary-300);
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.08);
}

.question-option.selected {
  border-color: var(--primary-400);
  background: linear-gradient(180deg, #f5faff 0%, #ffffff 100%);
}

.question-option input[type="radio"],
.question-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary-600);
}

.question-option label {
  font-size: 1rem;
  color: var(--gray-800);
}

/* Navigation - better alignment and spacing */
.question-navigation {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.question-navigation .next-question {
  margin-left: auto;
}

.question-actions .btn-outline {
  border-color: var(--gray-300);
}

/* Progress header tweaks */
.progress-header .progress-text {
  color: var(--gray-600);
  font-weight: 500;
}

@media (max-width: 640px) {
  .question-card {
    padding: 1.25rem;
  }
  .question-option {
    padding: 0.85rem 0.9rem;
  }
  .question-navigation {
    gap: 0.5rem;
  }
}

.loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-spinner-large {
  animation: spin 1s linear infinite;
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.question-header .progress-header {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.question-header .progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.question-header .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
  transition: width 0.5s ease;
  border-radius: 4px;
}

.question-header .progress-text {
  font-size: 0.875rem;
  color: var(--gray-600);
  font-weight: 500;
}

.back-to-selection {
  background: none;
  border: 2px solid var(--gray-300);
  color: var(--gray-700);
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.back-to-selection:hover {
  border-color: var(--primary-400);
  background: var(--primary-50);
  color: var(--primary-700);
  transform: translateX(-2px);
}

.current-question {
  margin-bottom: 2rem;
  min-height: 300px;
}

.question-card {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.question-card h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.question-card .ExtraInfo {
  background: var(--blue-50);
  border: 1px solid var(--blue-200);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--blue-800);
  line-height: 1.5;
}

.question-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.question-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
}

.question-option:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
}

.question-option.selected {
  border-color: var(--primary-500);
  background: var(--primary-50);
}

.question-option input[type="radio"],
.question-option input[type="checkbox"] {
  display: none;
}

.question-option .option-indicator {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.question-option input[type="checkbox"] + .option-indicator {
  border-radius: 4px;
}

.question-option.selected .option-indicator {
  border-color: var(--primary-500);
  background: var(--primary-500);
}

.question-option.selected .option-indicator::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

.question-option input[type="checkbox"] + .option-indicator.selected::after {
  width: 6px;
  height: 3px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  border-radius: 0;
  transform: translate(-50%, -70%) rotate(-45deg);
}

.question-option label {
  flex: 1;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-700);
  line-height: 1.4;
}

.question-option.selected label {
  color: var(--primary-700);
  font-weight: 600;
}

/* Text Input and Textarea Styles */
.question-textarea {
  width: 100%;
  min-height: 120px;
  padding: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: all 0.3s ease;
}

.question-textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Slider Styles */
.question-slider {
  margin: 1.5rem 0;
}

.slider-container {
  position: relative;
  margin: 2rem 0;
}

.slider-input {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--gray-200);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.slider-input::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-500);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.slider-input::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-500);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.slider-value {
  display: inline-block;
  background: var(--primary-500);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  margin-left: 1rem;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-600);
}

/* Question Navigation */
.question-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.question-navigation .btn-primary {
  order: 3; /* Next button - left */
}

.question-actions {
  order: 2; /* Middle - IDK button */
  display: flex;
  gap: 1rem;
  flex: 0 0 auto;
}

.question-navigation .btn-secondary {
  order: 1; /* Previous button - right */
}

.btn-outline {
  background: white;
  color: var(--gray-600);
  border: 2px solid var(--gray-300);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-outline:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

/* Results Screen */
.triage-results-container {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--gray-200);
  margin-top: 2rem;
}

.results-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.results-content {
  margin-top: 2rem;
}

.results-actions {
  margin-top: 2rem;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .modern-triage-container {
    padding: 0.5rem;
  }
  
  .welcome-card {
    padding: 2rem 1.5rem;
    border-radius: 16px;
  }
  
  .welcome-card h1 {
    font-size: 2rem;
  }
  
  .startup-container,
  .questionnaire-selection,
  .questions-container,
  .triage-results-container {
    padding: 1.5rem;
    border-radius: 16px;
  }
  
  .form-actions,
  .question-navigation {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .btn-primary, .btn-secondary, .btn-outline {
    justify-content: center;
    flex: 1 1 45%; /* Take up about half width on mobile */
    min-width: 120px;
  }
  
  .question-actions {
    flex: 1 1 100%; /* IDK button takes full width on mobile */
    order: 0; /* Show IDK button first on mobile */
  }
  
  .radio-group {
    flex-direction: column;
  }
  
  .radio-option {
    min-width: auto;
  }
  
  .info-item {
    justify-content: flex-start;
  }
  
  .questionnaire-grid {
    grid-template-columns: 1fr;
  }
  
  .question-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-input-wrapper {
    max-width: none;
    width: 100%;
  }
  
  .questionnaire-title-section {
    flex-direction: column;
    gap: 1rem;
  }
  
  .back-to-welcome {
    align-self: flex-start;
  }
}

/* Screen Management - Ensure proper hiding */
.hidden {
  display: none !important;
  visibility: hidden !important;
}

/* Hide original data containers (used only for JavaScript processing) */
#original-data,
#original-questionnaire-data {
  display: none !important;
  visibility: hidden !important;
}

#welcome-screen,
#progress-steps,
#startup-questions,
#main-questionnaires,
#question-template,
#results-screen,
#emergency-modal {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Only show welcome screen initially */
#progress-steps.hidden,
#startup-questions.hidden,
#main-questionnaires.hidden,
#question-template,
#results-screen,
#emergency-modal {
  display: none !important;
  visibility: hidden !important;
}

/* Ensure question cards don't interfere with each other */
.question-card + .question-card {
  margin-top: 0;
}

[id^="question-"] {
  position: relative;
  z-index: 10;
}

[id^="question-"].hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0;
  pointer-events: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .question-card {
    border: 2px solid var(--gray-800);
  }
  
  .answer-option {
    border-width: 2px;
  }
  
  .answer-option.selected {
    border-width: 3px;
  }
  
  .questionnaire-option {
    border: 2px solid var(--gray-800);
  }
}

/* Image Upload Styling */
.image-upload-container {
  margin-top: 1.5rem;
}

.image-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--primary-50);
  border: 2px dashed var(--primary-300);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  color: var(--primary-700);
  font-weight: 500;
}

.image-upload-label:hover {
  background: var(--primary-100);
  border-color: var(--primary-500);
  transform: translateY(-2px);
}

.image-upload-label i {
  font-size: 1.5rem;
  color: var(--primary-600);
}

.image-upload-input {
  display: none;
}

.image-preview {
  margin-top: 1rem;
}

.uploaded-file {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.uploaded-file:hover {
  background: var(--primary-100);
}

.uploaded-file > i {
  font-size: 1.5rem;
  color: var(--primary-600);
  flex-shrink: 0;
}

.uploaded-file .file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.uploaded-file .file-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploaded-file .file-size {
  font-size: 0.85rem;
  color: var(--gray-600);
}

.uploaded-file .remove-image {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: transparent;
  color: var(--gray-500);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.2s ease;
}

.uploaded-file .remove-image:hover {
  background: var(--error-50);
  color: var(--error-500);
}

.uploaded-file .remove-image i {
  pointer-events: none;
}
