/* Mental Health Assessment System - UI Redesign */
/* Based on UI/UX Pro Max Design System: Accessible & Ethical Healthcare */

/* === CSS Custom Properties === */
:root {
  /* Color System - Calming Cyan + Health Green */
  --color-primary: #0891B2;
  --color-primary-dark: #0E7490;
  --color-primary-light: #22D3EE;
  --color-secondary: #22D3EE;
  --color-accent: #059669;
  --color-accent-light: #10B981;

  /* Background & Surface */
  --color-background: #ECFEFF;
  --color-surface: #FFFFFF;
  --color-surface-elevated: #F0FDFA;

  /* Text Colors */
  --color-foreground: #164E63;
  --color-foreground-secondary: #155E75;
  --color-foreground-muted: #67E8F9;
  --color-text: #1E293B;
  --color-text-secondary: #64748B;
  --color-text-muted: #94A3B8;

  /* Status Colors */
  --color-success: #059669;
  --color-warning: #D97706;
  --color-danger: #DC2626;
  --color-info: #0891B2;

  /* Border & Dividers */
  --color-border: #A5F3FC;
  --color-border-light: #CFFAFE;
  --color-divider: #E2E8F0;

  /* Focus & Interaction */
  --color-ring: #0891B2;
  --color-ring-offset: #FFFFFF;

  /* Typography */
  --font-heading: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Font Sizes - 16px base */
  --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.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */

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

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

  /* Spacing - 8px grid */
  --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 */

  /* 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-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Z-index Scale */
  --z-base: 0;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-modal: 30;
  --z-popover: 40;
  --z-toast: 50;

  /* Layout */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
}

/* === Dark Mode === */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #0C1D2E;
    --color-surface: #1A2B3D;
    --color-surface-elevated: #243B50;

    --color-foreground: #ECFEFF;
    --color-foreground-secondary: #A5F3FC;
    --color-foreground-muted: #67E8F9;
    --color-text: #F1F5F9;
    --color-text-secondary: #CBD5E1;
    --color-text-muted: #94A3B8;

    --color-border: #2D4A5E;
    --color-border-light: #3B5B72;
    --color-divider: #334155;

    --color-ring: #22D3EE;
    --color-ring-offset: #0C1D2E;
  }
}

/* === Base Reset === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === Focus Management === */
:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: var(--color-surface);
  padding: var(--space-2) var(--space-4);
  z-index: 100;
  transition: top var(--transition-fast);
  font-weight: var(--font-medium);
}

.skip-link:focus {
  top: 0;
}

/* === Typography === */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--color-foreground);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-4);
  max-width: 65ch; /* Optimal reading length */
}

/* === Accessibility Features === */
@media (prefers-contrast: high) {
  :root {
    --color-primary: #0E7490;
    --color-accent: #047857;
    --color-text: #000000;
    --color-background: #FFFFFF;
    --color-border: #000000;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* === Layout === */
.container {
  width: 100%;
  max-width: var(--container-lg);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-6);
  }
}

/* === Landing Page === */
.hero {
  text-align: center;
  padding: var(--space-16) var(--space-4) var(--space-8);
  max-width: var(--container-md);
  margin: 0 auto;
}

.hero h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-4);
  color: var(--color-foreground);
  letter-spacing: -0.025em;
}

.hero p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
  font-size: var(--text-lg);
  max-width: 50ch;
  margin-left: auto;
  margin-right: auto;
}

.scale-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 560px;
  margin: 0 auto;
}

.scale-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.scale-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.scale-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.scale-card:hover::before {
  transform: scaleX(1);
}

.scale-card:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
}

.scale-card h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
  color: var(--color-foreground);
}

.scale-card .meta {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
  font-weight: var(--font-medium);
}

.scale-card .desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
}

/* === Test Page === */
.test-header {
  position: sticky;
  top: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  z-index: var(--z-sticky);
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.9);
}

@media (prefers-color-scheme: dark) {
  .test-header {
    background: rgba(26, 43, 61, 0.9);
  }
}

.progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: var(--container-md);
  margin: 0 auto;
}

.progress-row progress {
  flex: 1;
  height: 8px;
  border-radius: var(--radius-full);
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-border);
  overflow: hidden;
}

.progress-row progress::-webkit-progress-bar {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

.progress-row progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-row progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-full);
}

#progress-text, #page-info {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
  font-weight: var(--font-medium);
}

.test-body {
  max-width: var(--container-md);
  margin: 0 auto;
  padding: var(--space-5);
  padding-bottom: 120px;
}

.question-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  transition: all var(--transition-fast);
}

.question-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-sm);
}

.question-text {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
  color: var(--color-foreground);
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.option-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  user-select: none;
  background: var(--color-surface);
}

.option-label:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-elevated);
  transform: translateY(-1px);
}

.option-label.selected {
  border-color: var(--color-primary);
  background: rgba(8, 145, 178, 0.1);
  color: var(--color-primary-dark);
  font-weight: var(--font-medium);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.option-label span {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: var(--leading-snug);
}

.option-label strong {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.option-label small {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  font-weight: var(--font-normal);
}

.option-label.selected small {
  color: var(--color-primary-dark);
  opacity: 0.8;
}

.option-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Focus state for radio inputs */
.option-label:focus-within {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
}

/* === Footer === */
.test-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  z-index: var(--z-sticky);
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.9);
}

@media (prefers-color-scheme: dark) {
  .test-footer {
    background: rgba(26, 43, 61, 0.9);
  }
}

.footer-inner {
  max-width: var(--container-md);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
  min-width: 44px;
  text-decoration: none;
  line-height: 1;
}

.btn:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-elevated);
  border-color: var(--color-primary);
}

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

.btn-danger:hover:not(:disabled) {
  background: #B91C1C;
  transform: translateY(-1px);
}

/* === Results Section === */
#result-section {
  max-width: var(--container-lg);
  margin: 0 auto;
  padding: var(--space-5);
}

.result-header {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.result-header.safe {
  background: linear-gradient(135deg, #ECFDF5, #F0FDFA);
  border-color: #A7F3D0;
}

.result-header.alert {
  background: linear-gradient(135deg, #FEF2F2, #FFF1F2);
  border-color: #FECACA;
}

.result-header h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
  color: var(--color-foreground);
}

.status-text {
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
}

.result-header.safe .status-text {
  color: var(--color-success);
}

.result-header.alert .status-text {
  color: var(--color-danger);
}

.result-summary {
  margin-bottom: var(--space-6);
}

.result-summary h3,
.result-factors h3,
.phi-chart h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-foreground);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.summary-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  transition: all var(--transition-fast);
}

.summary-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.summary-item.warn {
  border-color: var(--color-warning);
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
}

.summary-item .label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
  font-weight: var(--font-medium);
}

.summary-item .value {
  display: block;
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-1);
  color: var(--color-foreground);
  font-family: var(--font-heading);
}

.summary-item .value small {
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  color: var(--color-text-muted);
}

.summary-item .threshold {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: var(--font-medium);
}

/* === Factor Table === */
.result-factors {
  margin-bottom: var(--space-6);
}

.factor-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  font-size: var(--text-sm);
}

.factor-table th {
  background: var(--color-surface-elevated);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--font-semibold);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  border-bottom: 2px solid var(--color-border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.factor-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.factor-table tr:last-child td {
  border-bottom: none;
}

.factor-table tr.row-warn {
  background: linear-gradient(90deg, #FFFBEB, transparent);
}

.factor-table tr:hover {
  background: var(--color-surface-elevated);
}

.factor-name {
  font-weight: var(--font-semibold);
  color: var(--color-foreground);
  margin-bottom: var(--space-1);
}

.factor-name-en {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: var(--font-normal);
}

.score-cell {
  min-width: 100px;
}

.score-value {
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  color: var(--color-foreground);
  font-family: var(--font-heading);
}

.score-bar-bg {
  height: 6px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin-top: var(--space-2);
  overflow: hidden;
}

.score-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.row-warn .score-bar {
  background: linear-gradient(90deg, var(--color-warning), #FBBF24);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.safe {
  background: #D1FAE5;
  color: #065F46;
}

.badge.warn {
  background: #FEF3C7;
  color: #92400E;
}

.interpretation {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

/* === PHI Bar Chart === */
.bar-chart {
  margin-bottom: var(--space-6);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.bar-label {
  width: 40px;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-align: right;
  color: var(--color-foreground);
}

.bar-track {
  flex: 1;
  height: 28px;
  background: var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-lg);
  transition: width var(--transition-slow);
  min-width: 4px;
}

.bar-fill.yes {
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
}

.bar-fill.no {
  background: linear-gradient(90deg, var(--color-success), #34D399);
}

.bar-fill.unk {
  background: linear-gradient(90deg, var(--color-warning), #FBBF24);
}

.bar-value {
  width: 50px;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-foreground);
}

/* === Disclaimer === */
.result-disclaimer {
  background: linear-gradient(135deg, #FEFCE8, #FEF3C7);
  border: 1px solid #FDE68A;
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.result-disclaimer strong {
  color: #92400E;
}

.result-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  padding-bottom: var(--space-10);
  flex-wrap: wrap;
}

/* === Mobile Responsiveness === */
@media (max-width: 640px) {
  .hero {
    padding: var(--space-8) var(--space-4) var(--space-6);
  }

  .hero h1 {
    font-size: var(--text-2xl);
  }

  .hero p {
    font-size: var(--text-base);
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .factor-table {
    font-size: var(--text-xs);
  }

  .factor-table th,
  .factor-table td {
    padding: var(--space-2);
  }

  .interpretation {
    font-size: var(--text-xs);
  }

  .options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
  }

  .option-label {
    width: 100%;
    justify-content: center;
    padding: var(--space-2) var(--space-3);
  }

  .option-label:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .footer-inner {
    flex-wrap: wrap;
  }

  .footer-inner .btn {
    flex: 1;
    min-width: calc(50% - var(--space-2));
  }

  .result-header {
    padding: var(--space-5) var(--space-4);
  }

  .result-header h2 {
    font-size: var(--text-xl);
  }

  .status-text {
    font-size: var(--text-base);
  }

  .summary-item .value {
    font-size: var(--text-2xl);
  }

  .bar-label {
    width: 30px;
    font-size: var(--text-xs);
  }

  .bar-track {
    height: 24px;
  }
}

/* === Tablet Responsiveness === */
@media (min-width: 641px) and (max-width: 1024px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}

/* === Print Styles === */
@media print {
  .test-header,
  .test-footer,
  .result-actions,
  .skip-link {
    display: none !important;
  }

  .result-header {
    break-inside: avoid;
  }

  .factor-table {
    break-inside: auto;
  }

  tr {
    break-inside: avoid;
  }

  body {
    background: white;
    font-size: 12px;
    color: black;
  }

  .scale-card,
  .question-card,
  .summary-item {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .result-header.safe,
  .result-header.alert {
    background: white;
    border: 1px solid #ccc;
  }
}

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

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

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

.scale-card {
  animation: slideUp var(--transition-slow) ease-out;
}

.scale-card:nth-child(2) {
  animation-delay: 100ms;
}

/* === Loading States === */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* === Safe Area Padding === */
@supports (padding: max(0px)) {
  .test-header,
  .test-footer {
    padding-left: max(var(--space-4), env(safe-area-inset-left));
    padding-right: max(var(--space-4), env(safe-area-inset-right));
  }

  .test-footer {
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  }
}