/* === SUPLEX CALCULATOR FRAMEWORK === */
/* Typography: Poppins + JetBrains Mono + Outfit */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@700;800&display=swap');

:root {
  --suplex-green: #228B22;
  --suplex-green-light: #2ECC40;
  --suplex-green-dark: #1B6B1B;
  --suplex-yellow: #FFE135;
  --suplex-yellow-dark: #E6C830;
  --bg-primary: #FAFBFC;
  --bg-card: #FFFFFF;
  --bg-input: #F5F7FA;
  --text-primary: #1A1A2E;
  --text-secondary: #64748B;
  --border-light: #E2E8F0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* === OPTICAL KERNING FOR HEADLINES === */
.optical-kern {
  display: inline-block;
  letter-spacing: -0.02em;
}

.optical-kern .char {
  display: inline-block;
  position: relative;
}

/* Slight adjustments for even "sand flow" through words */
.optical-kern .char:first-child {
  margin-left: 0;
}

.optical-kern.sand-flow {
  letter-spacing: -0.01em;
}

/* === LAYOUT === */
.calculator-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* === HEADER === */
.calc-header {
  text-align: center;
  margin-bottom: 48px;
  padding: 0 16px;
}

.calc-header h1 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.2;
}

.calc-header .subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* === CALCULATOR CONTAINER === */
.calculator-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 48px;
}

@media (max-width: 900px) {
  .calculator-container {
    grid-template-columns: 1fr;
  }
}

/* === INPUT PANEL === */
.input-panel {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.input-group {
  margin-bottom: 24px;
}

.input-group:last-child {
  margin-bottom: 0;
}

.input-label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* === INPUT FIELDS === */
input[type="number"],
input[type="range"],
select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

input[type="number"]:focus,
input[type="range"]:focus,
select:focus {
  outline: none;
  border-color: var(--suplex-green);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px rgba(34, 139, 34, 0.1);
}

/* === RANGE SLIDER === */
.range-container {
  position: relative;
  margin-top: 8px;
}

input[type="range"] {
  -webkit-appearance: none;
  height: 8px;
  padding: 0;
  background: linear-gradient(to right, var(--suplex-green) var(--progress, 50%), var(--border-light) var(--progress, 50%));
  border-radius: 4px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: var(--suplex-yellow);
  border: 3px solid var(--suplex-yellow-dark);
  border-radius: 50%;
  cursor: grab;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

input[type="range"]::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.range-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--suplex-green);
}

/* === RESULTS PANEL === */
.results-panel {
  background: linear-gradient(135deg, var(--bg-card) 0%, #F8FFFE 100%);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.results-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--suplex-green), var(--suplex-yellow));
}

.results-panel.hidden {
  filter: blur(8px);
  user-select: none;
  pointer-events: none;
}

.results-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  z-index: 10;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.results-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.reveal-btn {
  background: var(--suplex-yellow);
  color: var(--text-primary);
  border: none;
  padding: 16px 32px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 225, 53, 0.4);
  transition: all 0.2s ease;
}

.reveal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 225, 53, 0.5);
}

.reveal-btn:active {
  transform: translateY(0);
}

/* === METRIC CARDS === */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  border: 1px solid var(--border-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.metric-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.75rem;
  color: var(--suplex-green);
  line-height: 1.2;
  margin-bottom: 4px;
}

.metric-value.large {
  font-size: 2.5rem;
}

.metric-value.highlight {
  background: linear-gradient(135deg, var(--suplex-green) 0%, var(--suplex-green-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* === PRIMARY RESULT === */
.primary-result {
  background: linear-gradient(135deg, var(--suplex-green) 0%, var(--suplex-green-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  color: white;
  margin-bottom: 24px;
}

.primary-result-label {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-bottom: 8px;
  font-weight: 500;
}

.primary-result-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 3rem;
  line-height: 1.1;
}

.primary-result-sublabel {
  font-size: 0.875rem;
  opacity: 0.85;
  margin-top: 8px;
}

/* === SAVINGS BREAKDOWN === */
.breakdown-section {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.breakdown-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}

.breakdown-row:last-child {
  border-bottom: none;
  font-weight: 600;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 2px solid var(--border-light);
}

.breakdown-label {
  color: var(--text-secondary);
}

.breakdown-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-primary);
}

.breakdown-row:last-child .breakdown-value {
  color: var(--suplex-green);
  font-size: 1.1rem;
}

/* === CTA SECTION === */
.cta-section {
  text-align: center;
  margin-top: 24px;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--suplex-yellow);
  color: var(--text-primary);
  text-decoration: none;
  padding: 16px 32px;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(255, 225, 53, 0.4);
  transition: all 0.2s ease;
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 225, 53, 0.5);
}

.cta-btn.secondary {
  background: transparent;
  border: 2px solid var(--suplex-green);
  color: var(--suplex-green);
  box-shadow: none;
}

.cta-btn.secondary:hover {
  background: var(--suplex-green);
  color: white;
}

/* === CHECKLIST === */
.checklist {
  list-style: none;
  padding: 0;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.checklist li::before {
  content: '✓';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--suplex-green);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: 2px;
}

/* === FEATURE CARDS === */
.features-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 48px;
}

.feature-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.feature-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === FOOTER === */
.calc-footer {
  text-align: center;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

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

.animate-count {
  animation: countUp 0.5s ease forwards;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 139, 34, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(34, 139, 34, 0);
  }
}

.pulse-animation {
  animation: pulse 2s ease-in-out infinite;
}

/* === TOOLTIP === */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 100;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  bottom: calc(100% + 8px);
}

/* === SLIDER VALUE DISPLAY === */
.slider-value-display {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--suplex-green);
  text-align: right;
  margin-top: 4px;
}

/* === PROGRESS BAR === */
.progress-bar {
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--suplex-green), var(--suplex-green-light));
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* === COMPARISON ROWS === */
.comparison-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.comparison-label {
  font-weight: 500;
  font-size: 0.875rem;
}

.comparison-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
}

.comparison-value.positive {
  color: var(--suplex-green);
}

.comparison-value.negative {
  color: #DC2626;
}

/* === INSIGHT BOX === */
.insight-box {
  background: linear-gradient(135deg, rgba(34, 139, 34, 0.08) 0%, rgba(255, 225, 53, 0.08) 100%);
  border-left: 4px solid var(--suplex-green);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-top: 20px;
}

.insight-box p {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* === NAVIGATION === */
.calc-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  justify-content: center;
}

.calc-nav a {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.calc-nav a:hover {
  border-color: var(--suplex-green);
  color: var(--suplex-green);
}

.calc-nav a.active {
  background: var(--suplex-green);
  border-color: var(--suplex-green);
  color: white;
}

/* === LOADING STATE === */
.loading-shimmer {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
