/* ============================================
   CHROMANALYSIS DESIGN SYSTEM
   "Precision Vitality" - Medical AI Aesthetic
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,400&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Primary Palette */
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;

  /* Accent - Hemoglobin Coral */
  --coral-600: #c1121f;
  --coral-500: #e63946;
  --coral-400: #ef6b6b;
  --coral-300: #f5a3a3;
  --coral-200: #fcd5d5;
  --coral-glow: rgba(230, 57, 70, 0.4);

  /* Health Indicators */
  --health-good: #2d936c;
  --health-warning: #e9c46a;
  --health-alert: #e76f51;

  /* Surfaces */
  --surface-dark: var(--slate-900);
  --surface-card: rgba(255, 255, 255, 0.03);
  --surface-glass: rgba(255, 255, 255, 0.06);
  --surface-light: #ffffff;

  /* Typography */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 60px var(--coral-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
}

/* --- 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;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--slate-100);
  background: var(--slate-950);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1000;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 700; }
h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: 1.25rem; }

p {
  color: var(--slate-400);
  max-width: 65ch;
}

.text-gradient {
  background: linear-gradient(135deg, var(--coral-400), var(--coral-500), var(--coral-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-light { color: var(--slate-100); }
.text-muted { color: var(--slate-500); }
.text-coral { color: var(--coral-500); }

/* --- Layout Containers --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  max-width: 680px;
}

.section {
  padding: var(--space-4xl) 0;
}

/* --- Glass Card Component --- */
.glass-card {
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--duration-normal) var(--ease-out);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

/* --- Solid Card (for forms) --- */
.solid-card {
  background: var(--surface-light);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
  color: var(--slate-800);
}

.solid-card p,
.solid-card label {
  color: var(--slate-600);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--coral-500), var(--coral-600));
  color: white;
  box-shadow: 0 4px 20px var(--coral-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--coral-glow);
}

.btn-secondary {
  background: var(--surface-glass);
  color: var(--slate-100);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--slate-700);
  border: 2px solid var(--slate-300);
}

.btn-outline:hover {
  border-color: var(--coral-500);
  color: var(--coral-500);
}

.btn-lg {
  padding: var(--space-lg) var(--space-2xl);
  font-size: 1.125rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--slate-700);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-input,
.form-select {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--slate-800);
  background: var(--slate-50);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--coral-500);
  box-shadow: 0 0 0 4px var(--coral-200);
}

.form-input::placeholder {
  color: var(--slate-400);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  background-size: 20px;
  padding-right: var(--space-3xl);
}

/* Radio Buttons */
.radio-group {
  display: flex;
  gap: var(--space-md);
}

.radio-option {
  position: relative;
  flex: 1;
}

.radio-option input {
  position: absolute;
  opacity: 0;
}

.radio-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--slate-50);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  color: var(--slate-600);
  transition: all var(--duration-fast);
}

.radio-option input:checked + label {
  background: var(--coral-500);
  border-color: var(--coral-500);
  color: white;
}

.radio-option input:focus + label {
  box-shadow: 0 0 0 4px var(--coral-200);
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-lg) 0;
  transition: all var(--duration-normal);
}

.nav.scrolled {
  background: rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.nav-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--coral-500), var(--coral-600));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--slate-100);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
}

.nav-link {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--slate-400);
  text-decoration: none;
  transition: color var(--duration-fast);
  letter-spacing: 0.01em;
}

.nav-link:hover {
  color: var(--slate-100);
}

.nav-cta {
  padding: var(--space-sm) var(--space-lg);
}

/* Mobile Nav Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--slate-300);
  transition: all var(--duration-fast);
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--slate-900);
    padding: var(--space-lg);
    gap: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--duration-normal);
  }
  .nav-links.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

/* --- Hero Section --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding: var(--space-4xl) 0;
  overflow: hidden;
}

/* Animated background gradient */
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(230, 57, 70, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(230, 57, 70, 0.08), transparent);
  animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.05); }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--surface-glass);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
  color: var(--slate-300);
  margin-bottom: var(--space-xl);
  animation: fadeInUp 0.6s var(--ease-out) both;
}

.hero-badge-dot {
  width: 8px;
  height: 8px;
  background: var(--health-good);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.hero h1 {
  margin-bottom: var(--space-lg);
  animation: fadeInUp 0.6s var(--ease-out) 0.1s both;
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: var(--space-2xl);
  animation: fadeInUp 0.6s var(--ease-out) 0.2s both;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  animation: fadeInUp 0.6s var(--ease-out) 0.3s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Eye Graphic */
.hero-visual {
  position: absolute;
  right: -5%;
  top: 50%;
  transform: translateY(-50%);
  width: 50%;
  aspect-ratio: 1;
  z-index: 1;
}

.eye-graphic {
  width: 100%;
  height: 100%;
  position: relative;
}

.eye-outer {
  position: absolute;
  inset: 10%;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: eyeBlink 4s ease-in-out infinite;
}

.eye-iris {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40%;
  aspect-ratio: 1;
  background: radial-gradient(circle, var(--coral-400) 0%, var(--coral-600) 50%, var(--slate-800) 100%);
  border-radius: 50%;
  box-shadow: 0 0 60px var(--coral-glow), inset 0 0 30px rgba(0,0,0,0.3);
}

.eye-pupil {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 35%;
  aspect-ratio: 1;
  background: var(--slate-950);
  border-radius: 50%;
}

.eye-highlight {
  position: absolute;
  top: 25%;
  left: 30%;
  width: 20%;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  filter: blur(2px);
}

@keyframes eyeBlink {
  0%, 45%, 55%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.1); }
}

@media (max-width: 1024px) {
  .hero-visual {
    display: none;
  }
}

/* --- Features Section --- */
.features {
  background: var(--slate-900);
  position: relative;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}

@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  text-align: center;
  padding: var(--space-2xl);
}

.feature-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-lg);
  background: linear-gradient(135deg, var(--coral-500), var(--coral-600));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px var(--coral-glow);
}

.feature-icon svg {
  width: 32px;
  height: 32px;
  stroke: white;
  stroke-width: 1.5;
  fill: none;
}

.feature-card h3 {
  margin-bottom: var(--space-sm);
}

.feature-card p {
  margin: 0 auto;
  font-size: 0.95rem;
}

/* Step Number */
.feature-step {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--coral-500);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

/* --- About Section --- */
.about {
  background: var(--slate-950);
}

.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4xl);
  align-items: center;
}

@media (max-width: 900px) {
  .about-content {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }
}

.researcher-card {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
  padding: var(--space-xl);
}

.researcher-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.researcher-info h4 {
  color: var(--slate-100);
  margin-bottom: var(--space-xs);
}

.researcher-info p {
  font-size: 0.9rem;
  line-height: 1.7;
}

/* --- Footer --- */
.footer {
  background: var(--slate-900);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: var(--space-2xl) 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.footer-links {
  display: flex;
  gap: var(--space-xl);
}

.footer-link {
  font-size: 0.9rem;
  color: var(--slate-500);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.footer-link:hover {
  color: var(--slate-300);
}

.footer-disclaimer {
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: var(--slate-600);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Page Wrapper (for inner pages) --- */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-4xl) 0;
}

.page-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.page-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: var(--space-sm);
}

.page-header p {
  margin: 0 auto;
}

/* --- Progress Indicator --- */
.progress-steps {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.progress-step {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--slate-500);
  font-size: 0.875rem;
}

.progress-step.active {
  color: var(--coral-500);
}

.progress-step.completed {
  color: var(--health-good);
}

.progress-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
}

.progress-step.active .progress-dot {
  background: var(--coral-500);
  border-color: var(--coral-500);
  color: white;
}

.progress-step.completed .progress-dot {
  background: var(--health-good);
  border-color: var(--health-good);
  color: white;
}

/* --- Upload Zone --- */
.upload-zone {
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius-lg);
  padding: var(--space-3xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal);
  background: var(--slate-50);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--coral-500);
  background: var(--coral-200);
}

.upload-zone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  background: var(--slate-200);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-zone-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--slate-500);
  stroke-width: 1.5;
  fill: none;
}

.upload-zone h4 {
  color: var(--slate-700);
  margin-bottom: var(--space-xs);
}

.upload-zone p {
  color: var(--slate-500);
  font-size: 0.9rem;
}

/* Preview Image */
.preview-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin-top: var(--space-lg);
}

/* --- Results Display --- */
.result-card {
  text-align: center;
}

.result-value {
  font-family: var(--font-display);
  font-size: clamp(4rem, 10vw, 6rem);
  font-weight: 800;
  line-height: 1;
  margin: var(--space-lg) 0;
  letter-spacing: -0.03em;
}

.result-value.status-good { color: var(--health-good); }
.result-value.status-warning { color: var(--health-warning); }
.result-value.status-alert { color: var(--health-alert); }

.result-label {
  font-size: 1.25rem;
  color: var(--slate-600);
  margin-bottom: var(--space-xl);
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  font-weight: 500;
}

.result-status.status-good {
  background: rgba(45, 147, 108, 0.15);
  color: var(--health-good);
}

.result-status.status-warning {
  background: rgba(233, 196, 106, 0.15);
  color: var(--health-warning);
}

.result-status.status-alert {
  background: rgba(231, 111, 81, 0.15);
  color: var(--health-alert);
}

/* --- Loading Spinner --- */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4xl);
}

.loader-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--coral-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader p {
  margin-top: var(--space-lg);
  color: var(--slate-600);
}

/* --- Info Box --- */
.info-box {
  background: var(--slate-50);
  border-left: 4px solid var(--coral-500);
  border-radius: var(--radius-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.info-box h5 {
  color: var(--slate-800);
  margin-bottom: var(--space-sm);
  font-size: 0.95rem;
}

.info-box ol, .info-box ul {
  margin: 0;
  padding-left: var(--space-lg);
  color: var(--slate-600);
  font-size: 0.9rem;
}

.info-box li {
  margin-bottom: var(--space-xs);
}

/* --- Utilities --- */
.text-center { text-align: center; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.hidden { display: none !important; }
