/* ============================================
   Neurlyn - Polished Minimal Design System
   Version: 2.0.0
   
   Sophisticated, minimal, and refined
   ============================================ */

/* ============================================
   1. DESIGN TOKENS
   ============================================ */
:root {
  /* ========== RESPONSIVE BREAKPOINTS ========== */
  --bp-xs: 320px;
  --bp-sm: 480px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;
  --bp-2xl: 1536px;

  /* Enhanced Color Palette */
  --white: #ffffff;
  --off-white: #fafbfc;
  --canvas: #f8fafb;

  /* Sophisticated Grays with Blue Undertones */
  --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;

  /* Refined Accent - Sage with depth */
  --sage-50: #f3f7f4;
  --sage-100: #e6efe9;
  --sage-200: #c8ddd0;
  --sage-300: #a9cbb6;
  --sage-400: #8bb69d;
  --sage-500: #6c9e83;
  --sage-600: #548069;
  --sage-700: #426352;
  --sage-800: #35473b;
  --sage-900: #283328;

  /* Supporting Accents */
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --warm-100: #fef7f1;
  --warm-200: #f5e6d3;

  /* Functional States */
  --success: var(--sage-500);
  --warning: #f59e0b;
  --error: #ef4444;
  --info: var(--slate-500);

  /* Typography Scale - Golden Ratio */
  --text-xs: 0.75rem; /* 12px */
  --text-sm: 0.875rem; /* 14px */
  --text-base: 1rem; /* 16px */
  --text-lg: 1.125rem; /* 18px */
  --text-xl: 1.25rem; /* 20px */
  --text-2xl: 1.618rem; /* 26px - Golden */
  --text-3xl: 2.618rem; /* 42px - Golden */
  --text-4xl: 4.236rem; /* 68px - Golden */

  /* Enhanced Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Font Weights */
  --font-light: 300;
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Letter Spacing */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* Refined Spacing Scale */
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem; /* 2px */
  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem; /* 8px */
  --space-3: 0.75rem; /* 12px */
  --space-4: 1rem; /* 16px */
  --space-5: 1.25rem; /* 20px */
  --space-6: 1.5rem; /* 24px */
  --space-8: 2rem; /* 32px */
  --space-10: 2.5rem; /* 40px */
  --space-12: 3rem; /* 48px */
  --space-16: 4rem; /* 64px */
  --space-20: 5rem; /* 80px */
  --space-24: 6rem; /* 96px */

  /* Border Radius */
  --radius-sm: 0.25rem; /* 4px */
  --radius-md: 0.375rem; /* 6px */
  --radius-lg: 0.5rem; /* 8px */
  --radius-xl: 0.75rem; /* 12px */
  --radius-2xl: 1rem; /* 16px */
  --radius-3xl: 1.5rem; /* 24px */
  --radius-full: 9999px;

  /* Sophisticated Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.03);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.04), 0 1px 2px -1px rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.06), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.15);
  --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.04);

  /* Elevation Shadows for depth */
  --elevation-1: 0 2px 4px rgba(0, 0, 0, 0.04);
  --elevation-2: 0 4px 8px rgba(0, 0, 0, 0.06);
  --elevation-3: 0 8px 16px rgba(0, 0, 0, 0.08);
  --elevation-4: 0 16px 32px rgba(0, 0, 0, 0.1);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Easing Functions */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   2. RESET & BASE
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  line-height: var(--leading-relaxed);
  color: var(--gray-800);
  background: linear-gradient(180deg, var(--white) 0%, var(--canvas) 100%);
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height */
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Subtle background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 50%, var(--sage-50) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, var(--warm-100) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, var(--gray-50) 0%, transparent 50%);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

/* ============================================
   3. TYPOGRAPHY
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--gray-900);
  margin-bottom: var(--space-4);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--sage-700) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-semibold);
}

h3 {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
}

h4 {
  font-size: var(--text-xl);
  font-weight: var(--font-medium);
}

p {
  color: var(--gray-600);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
}

/* Enhanced Links */
a {
  color: var(--sage-600);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-base);
}

a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--sage-500);
  transition: width var(--transition-base);
}

a:hover {
  color: var(--sage-700);
}

a:hover::after {
  width: 100%;
}

/* ============================================
   4. LAYOUT COMPONENTS
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
}

/* Polished Header */
.header {
  text-align: center;
  padding: var(--space-12) 0 var(--space-8);
  position: relative;
}

.brand {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-2);
  position: relative;
  display: inline-block;
}

.brand::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--sage-400), transparent);
  border-radius: var(--radius-full);
}

.tagline {
  font-size: var(--text-lg);
  color: var(--gray-500);
  font-weight: var(--font-light);
  letter-spacing: var(--tracking-wide);
  margin: var(--space-4) 0 0;
}

/* ============================================
   5. CARDS - Refined Design
   ============================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px rgba(0, 0, 0, 0.01);
  transition: all var(--transition-base);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--sage-400),
    var(--sage-500),
    var(--sage-400),
    transparent
  );
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(0, 0, 0, 0.02);
}

.card:hover::before {
  opacity: 1;
}

/* ============================================
   6. BUTTONS - Sophisticated States
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
  text-transform: none;
  white-space: nowrap;
  user-select: none;
}

/* Primary Button - Refined */
.btn-primary {
  background: linear-gradient(135deg, var(--sage-500) 0%, var(--sage-600) 100%);
  color: var(--white);
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left var(--transition-slower);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow:
    var(--shadow-xs),
    inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Secondary Button */
.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: none;
  background: var(--gray-100);
}

/* Disabled State */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ============================================
   7. FORM ELEMENTS - Polished
   ============================================ */
input,
textarea,
select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  color: var(--gray-800);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--sage-400);
  box-shadow:
    0 0 0 3px rgba(108, 158, 131, 0.1),
    var(--shadow-sm);
}

/* ============================================
   8. ASSESSMENT COMPONENTS
   ============================================ */

/* Mode Selection - Enhanced */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin: var(--space-8) 0;
}

.mode-option {
  padding: var(--space-6);
  background: var(--white);
  border: 2px solid var(--gray-100);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.mode-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sage-400), var(--sage-500));
  transform: scaleX(0);
  transition: transform var(--transition-slow);
}

.mode-option:hover {
  border-color: var(--sage-200);
  background: var(--sage-50);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mode-option.selected {
  border-color: var(--sage-400);
  background: linear-gradient(135deg, var(--sage-50) 0%, var(--white) 100%);
  box-shadow:
    var(--shadow-md),
    inset 0 0 0 1px rgba(108, 158, 131, 0.1);
}

.mode-option.selected::before {
  transform: scaleX(1);
}

.mode-icon {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-3);
  filter: grayscale(0.3);
  transition: filter var(--transition-base);
}

.mode-option:hover .mode-icon,
.mode-option.selected .mode-icon {
  filter: grayscale(0);
}

/* Progress Bar - Refined */
.progress-container {
  margin-bottom: var(--space-6);
  padding: var(--space-4);
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.progress-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage-400), var(--sage-500));
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--gray-500);
}

/* Likert Scale - Polished */
.likert-scale {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  margin: var(--space-8) 0;
}

.likert-option {
  flex: 1;
  padding: var(--space-4);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.likert-option::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0;
  background: linear-gradient(180deg, transparent, var(--sage-100));
  transition: height var(--transition-base);
}

.likert-option:hover {
  border-color: var(--sage-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.likert-option:hover::before {
  height: 100%;
}

.likert-option.selected {
  background: linear-gradient(135deg, var(--sage-500) 0%, var(--sage-600) 100%);
  color: var(--white) !important;
  border-color: var(--sage-600);
  box-shadow: var(--shadow-lg);
  transform: scale(1.05);
}

.likert-option.selected * {
  color: var(--white) !important;
}

.likert-label {
  position: relative;
  z-index: 1;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

/* Question Navigation */
.question-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-8);
}

/* Loading Spinner - Sophisticated */
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--sage-500);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  margin: 0 auto var(--space-4);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-container {
  text-align: center;
  padding: var(--space-16) 0;
}

.loading-container p {
  color: var(--gray-500);
  font-size: var(--text-lg);
  margin-top: var(--space-4);
}

/* Results - Enhanced */
.results-grid {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-8) 0;
}

.result-item {
  padding: var(--space-4);
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.result-item h4 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.result-bar {
  height: 32px;
  background: var(--white);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: var(--shadow-inner);
  position: relative;
}

.result-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage-400), var(--sage-500));
  border-radius: var(--radius-full);
  transition: width var(--transition-slower) var(--ease-out);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: var(--space-3);
}

.result-percentage {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--gray-700);
  z-index: 1;
}

/* Footer - Minimal */
.footer {
  margin-top: auto;
  padding: var(--space-8) 0;
  border-top: 1px solid var(--gray-100);
  text-align: center;
  color: var(--gray-500);
  font-size: var(--text-sm);
  flex-shrink: 0;
  background: var(--white);
  position: relative;
  z-index: 1;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-top: var(--space-4);
}

.footer-links a {
  color: var(--gray-500);
  font-weight: var(--font-medium);
}

/* ============================================
   9. UTILITIES
   ============================================ */
.hidden {
  display: none !important;
}

.screen {
  animation: fadeIn var(--transition-slow) var(--ease-out);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--sage-600);
  color: var(--white);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  border-radius: var(--radius-md);
  z-index: 100;
}

.skip-link:focus {
  top: var(--space-2);
}

/* ========== RESPONSIVE FOUNDATION ========== */
/* All mobile and responsive styles are handled in neurlyn-mobile.css */
/* This ensures a single source of truth for responsive behavior */
