/* ============================================================
   Tariff Price Shock Calculator - Styles
   Dark theme with red/amber warning palette
   ============================================================ */

:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #161616;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;

  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --red-glow: rgba(239, 68, 68, 0.25);

  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-glow: rgba(251, 191, 36, 0.2);

  --text-primary: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-muted: #6b6b6b;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-red: rgba(239, 68, 68, 0.3);

  --font-body: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Reset & Base ---- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---- Screen Transitions ---- */

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  opacity: 0;
  visibility: hidden;
  transform: translateX(40px);
  transition: opacity var(--transition-slow), transform var(--transition-slow), visibility 0s linear 400ms;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  overflow-y: auto;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  transition: opacity var(--transition-slow), transform var(--transition-slow), visibility 0s;
  position: relative;
}

.screen.exit-left {
  opacity: 0;
  transform: translateX(-40px);
}

/* ---- Buttons ---- */

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--red-600), var(--red-700));
  color: #fff;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  box-shadow: 0 4px 20px var(--red-glow);
  -webkit-user-select: none;
  user-select: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--red-glow);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 2px 12px var(--red-glow);
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
}

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

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1.2rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.btn-back:active {
  background: var(--bg-card-hover);
}

.btn-icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* ============================================================
   Screen 1: Intro
   ============================================================ */

.intro-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 48px);
  min-height: calc(100dvh - 48px);
  text-align: center;
  padding: 20px 0;
}

.warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--border-red);
  border-radius: 100px;
  margin-bottom: 24px;
  animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(239, 68, 68, 0.3); }
  50% { border-color: rgba(239, 68, 68, 0.6); }
}

.warning-icon {
  font-size: 1rem;
  color: var(--red-500);
}

.warning-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--red-500);
  text-transform: uppercase;
}

.intro-emoji {
  font-size: 3.5rem;
  margin-bottom: 20px;
  line-height: 1.2;
}

.intro-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--amber-400) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.intro-tagline {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

.intro-tagline em {
  color: var(--red-500);
  font-style: italic;
}

.intro-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  justify-content: center;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-width: 95px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--red-500);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.intro-disclaimer {
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   Screen 2: Spending Input
   ============================================================ */

.input-container {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 140px;
}

.input-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.input-title {
  font-size: 1.35rem;
  font-weight: 700;
}

.input-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
  padding-left: 54px;
}

.sliders-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.slider-group {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px 14px;
  transition: border-color var(--transition-fast);
}

.slider-group:focus-within {
  border-color: rgba(239, 68, 68, 0.25);
}

.slider-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.slider-emoji {
  font-size: 1.4rem;
  line-height: 1;
}

.slider-label {
  font-size: 0.95rem;
  font-weight: 600;
  flex: 1;
}

.slider-tariff {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--red-500);
  background: rgba(239, 68, 68, 0.1);
  padding: 3px 8px;
  border-radius: 100px;
}

/* Custom Range Slider */

.slider-track-wrapper {
  position: relative;
  padding: 4px 0;
}

.custom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 100px;
  outline: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--red-500), var(--red-700));
  border: 3px solid var(--bg-primary);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.custom-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 3px 14px rgba(239, 68, 68, 0.5);
}

.custom-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--red-500), var(--red-700));
  border: 3px solid var(--bg-primary);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.custom-slider::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
}

.custom-slider::-moz-range-track {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 100px;
  border: none;
}

.slider-values {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.slider-min,
.slider-max {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.slider-current {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--amber-400);
  background: rgba(251, 191, 36, 0.08);
  padding: 2px 12px;
  border-radius: 100px;
}

/* Input Footer (sticky calculate) */

.input-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 20px calc(14px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg-primary) 80%, transparent);
  z-index: 10;
}

.monthly-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.monthly-total-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.monthly-total-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   Screen 3: Results
   ============================================================ */

.results-container {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.results-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.results-title {
  font-size: 1.35rem;
  font-weight: 700;
}

/* Big Number Card */

.big-number-card {
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.12) 0%, rgba(185, 28, 28, 0.06) 100%);
  border: 1px solid var(--border-red);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.big-number-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(239, 68, 68, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.big-number-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  position: relative;
}

.big-number {
  font-family: var(--font-mono);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--red-500);
  line-height: 1.1;
  margin-bottom: 10px;
  position: relative;
  text-shadow: 0 0 40px var(--red-glow);
}

.big-number-daily {
  font-size: 0.88rem;
  color: var(--amber-400);
  position: relative;
}

/* Breakdown Chart */

.breakdown-section {
  margin-bottom: 28px;
}

.section-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.8rem;
}

.chart-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-row-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
}

.chart-row-label .emoji {
  font-size: 1.1rem;
}

.chart-row-amount {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--red-500);
}

.chart-bar-container {
  position: relative;
  height: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.chart-bar-original {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  transition: width 800ms cubic-bezier(0.16, 1, 0.3, 1);
  width: 0;
}

.chart-bar-tariff {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--red-700), var(--red-500));
  border-radius: var(--radius-sm);
  transition: width 1000ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 200ms;
  width: 0;
  opacity: 0.85;
}

.chart-legend {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  padding-top: 8px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-swatch.original {
  background: rgba(255, 255, 255, 0.1);
}

.legend-swatch.tariff {
  background: var(--red-500);
}

/* Equivalents */

.equivalents-section {
  margin-bottom: 32px;
}

.equivalents-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.equivalent-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  text-align: center;
  transition: transform var(--transition-fast);
}

.equivalent-card:active {
  transform: scale(0.97);
}

.equivalent-emoji {
  font-size: 1.8rem;
  margin-bottom: 6px;
  display: block;
}

.equivalent-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--amber-400);
  display: block;
}

.equivalent-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
  display: block;
}

/* Results Actions */

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ============================================================
   Animations
   ============================================================ */

@keyframes count-up-glow {
  0% { text-shadow: 0 0 20px var(--red-glow); }
  50% { text-shadow: 0 0 60px rgba(239, 68, 68, 0.5); }
  100% { text-shadow: 0 0 40px var(--red-glow); }
}

.counting .big-number {
  animation: count-up-glow 1.5s ease-in-out;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fade-in-up 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.delay-1 { animation-delay: 100ms; }
.delay-2 { animation-delay: 200ms; }
.delay-3 { animation-delay: 300ms; }
.delay-4 { animation-delay: 400ms; }
.delay-5 { animation-delay: 500ms; }
.delay-6 { animation-delay: 600ms; }

/* ============================================================
   Scrollbar
   ============================================================ */

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 100px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 360px) {
  .intro-title {
    font-size: 1.65rem;
  }

  .big-number {
    font-size: 2.6rem;
  }

  .stat-pill {
    min-width: 80px;
    padding: 10px 12px;
  }

  .equivalents-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

@media (min-width: 400px) {
  .intro-title {
    font-size: 2.2rem;
  }

  .big-number {
    font-size: 3.6rem;
  }
}

/* ============================================================
   Utility
   ============================================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
