/* =========================
   BASE FOUNDATION - OPTION C: PREMIUM
   2026 Modern Design
========================= */

:root{
  /* Premium color palette */
  --bg-primary: #0a0a0a;
  --bg-surface: rgba(18, 18, 18, 0.8);
  --bg-elevated: rgba(26, 26, 26, 0.9);
  --bg-glass: rgba(20, 20, 20, 0.7);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* Accent colors - sophisticated blue */
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --accent-light: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.25);

  /* Semantic colors */
  --success: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;

  /* Text - high contrast for readability */
  --text-primary: #fafafa;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;

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

  /* Shadows - premium depth */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.6);

  /* Transitions */
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

body{
  margin: 0;
  padding: 24px;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* Animated mesh gradient background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(16, 185, 129, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  animation: meshMove 25s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes meshMove {
  0%, 100% { 
    opacity: 0.4;
    transform: translate(0, 0) scale(1);
  }
  33% { 
    opacity: 0.6;
    transform: translate(30px, -20px) scale(1.05);
  }
  66% { 
    opacity: 0.5;
    transform: translate(-20px, 30px) scale(0.95);
  }
}

/* Ensure content is above background */
body > * {
  position: relative;
  z-index: 1;
}

h1, h2, h3, h4, h5, h6 { 
  margin: 0 0 16px 0; 
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }

a{ 
  color: var(--accent-light);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover{ 
  color: var(--accent);
}

/* Premium button styling */
button{
  width: 100%;
  padding: 14px 24px;
  margin-top: 12px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
  min-height: 48px;
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

/* Button shimmer effect */
button::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 0.5s;
}

button:hover:not(:disabled)::before {
  left: 100%;
}

button:hover:not(:disabled){
  background: var(--accent-strong);
  transform: translateY(-2px);
  box-shadow: 
    0 8px 24px var(--accent-glow),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

button:active:not(:disabled){
  transform: translateY(0);
}

button:disabled{
  opacity: 0.5;
  cursor: not-allowed;
}

/* Focus visible for accessibility */
*:focus-visible{
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

select,
input[type="number"],
input[type="text"]{
  font-family: inherit;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 12px;
  transition: var(--transition-fast);
}

select:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.positive{ color: var(--success); }
.negative{ color: var(--danger); }

/* Loading spinner */
.spinner{
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* Shake animation for errors */
@keyframes shake{
  0%, 100%{ transform: translateX(0); }
  25%{ transform: translateX(-10px); }
  75%{ transform: translateX(10px); }
}

.shake-error{
  animation: shake 0.4s ease-in-out;
}

/* Smooth scrolling */
html{
  scroll-behavior: smooth;
}

/* Selection styling */
::selection {
  background: var(--accent-glow);
  color: var(--text-primary);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 6px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}
/* Confetti Animation */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: 9999;
  animation: fall 3s linear forwards;
  border-radius: 2px;
}

@keyframes fall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}
#instructions.collapsed {
  display: none;
}

.instructions-toggle:hover {
  background: rgba(255,255,255,0.1);
}
.calculator-steps {
  margin: 12px 0 18px 20px;
  line-height: 1.6;
}

.calculator-steps li {
  margin-bottom: 8px;
}

.calculator-results {
  margin: 10px 0 0 20px;
  line-height: 1.6;
}

.calculator-results li {
  margin-bottom: 6px;
}