/* ========================================
   SOLVAYA — Concept C: The Enemy Portrait
   Design System & Custom Styles
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700&display=swap');

/* --- CSS Custom Properties (Light Mode Default) --- */
:root {
  --bg: #FFFFFF;
  --bg-surface: #F8FAFC;
  --bg-elevated: #F1F5F9;
  --text: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-subtle: #F1F5F9;
  --accent: #3B82F6;
  --accent-hover: #2563EB;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  --success: #10B981;
  --success-bg: #ECFDF5;
  --success-border: #A7F3D0;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Inter', sans-serif;
  --receipt-bg: #FFFBEB;
  --receipt-border: #D97706;
  --receipt-text: #92400E;
  --nav-bg: rgba(255,255,255,0.85);
  --nav-border: rgba(226,232,240,0.8);
  --ota-bg: #FEF2F2;
  --solvaya-bg: #ECFDF5;
}

/* --- Dark Mode --- */
.dark {
  --bg: #0A0E17;
  --bg-surface: #141A26;
  --bg-elevated: #1E2738;
  --text: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #64748B;
  --border: #1E293B;
  --border-subtle: #1A2332;
  --accent: #3B82F6;
  --accent-hover: #60A5FA;
  --danger: #EF4444;
  --danger-bg: rgba(239,68,68,0.12);
  --danger-border: rgba(239,68,68,0.3);
  --success: #10B981;
  --success-bg: rgba(16,185,129,0.12);
  --success-border: rgba(16,185,129,0.3);
  --receipt-bg: #1E2738;
  --receipt-border: #D97706;
  --receipt-text: #FCD34D;
  --nav-bg: rgba(10,14,23,0.85);
  --nav-border: rgba(30,41,59,0.8);
  --ota-bg: rgba(239,68,68,0.08);
  --solvaya-bg: rgba(16,185,129,0.08);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- Typography --- */
.font-display {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  line-height: 1.0;
  font-weight: 400;
}

.font-body {
  font-family: var(--font-body);
}

/* --- Navigation --- */
.nav-container {
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--nav-border);
}

.nav-link {
  position: relative;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* --- OTA Card (Enemy Portrait) --- */
.ota-card {
  position: relative;
  overflow: hidden;
  background: var(--ota-bg);
  border: 1px solid var(--danger-border);
  border-radius: 12px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ota-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(239,68,68,0.15);
}

.ota-card .commission-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.5rem;
  padding: 6px 16px;
  border-radius: 8px;
  transform: rotate(6deg);
  box-shadow: 0 4px 12px rgba(239,68,68,0.4);
  z-index: 2;
}

.ota-card .ota-name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--danger);
  text-align: center;
  padding-top: 40px;
}

.ota-card .ota-detail {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0 16px 20px;
}

/* --- Comparison Table --- */
.comparison-table {
  display: grid;
  gap: 0;
}

.comparison-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.comparison-row.visible {
  opacity: 1;
  transform: translateY(0);
}

.comparison-cell {
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.comparison-cell.ota {
  background: var(--ota-bg);
  border-right: 1px solid var(--border);
}

.comparison-cell.solvaya {
  background: var(--solvaya-bg);
}

.comparison-cell .cell-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 2px;
}

.comparison-cell .cell-label {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}

.comparison-cell.ota .cell-label {
  color: var(--danger);
}

.comparison-cell.solvaya .cell-label {
  color: var(--success);
}

.comparison-cell .cell-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.comparison-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 2px solid var(--border);
}

.comparison-header-cell {
  padding: 16px 24px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.06em;
}

.comparison-header-cell.ota-header {
  color: var(--danger);
  background: var(--ota-bg);
  border-right: 1px solid var(--border);
}

.comparison-header-cell.solvaya-header {
  color: var(--success);
  background: var(--solvaya-bg);
}

/* --- Receipt / Savings Statement --- */
.receipt-card {
  background: var(--receipt-bg);
  border: 2px dashed var(--receipt-border);
  border-radius: 4px;
  padding: 24px 28px;
  font-family: 'Courier New', Courier, monospace;
  position: relative;
}

.receipt-card::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--receipt-border) 0,
    var(--receipt-border) 4px,
    transparent 4px,
    transparent 8px
  );
}

.receipt-card::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--receipt-border) 0,
    var(--receipt-border) 4px,
    transparent 4px,
    transparent 8px
  );
}

.receipt-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.875rem;
  color: var(--receipt-text);
}

.receipt-line.divider {
  border-top: 1px dashed var(--receipt-border);
  margin: 8px 0;
}

.receipt-line.highlight {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--success);
  border-top: 2px solid var(--receipt-border);
  padding-top: 8px;
  margin-top: 8px;
}

.receipt-header {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  color: var(--receipt-text);
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--receipt-border);
  margin-bottom: 8px;
}

/* --- Calculator --- */
.calculator-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.calc-input {
  width: 100%;
  padding: 14px 20px;
  font-size: 1.125rem;
  font-weight: 600;
  font-family: var(--font-body);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.calc-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.calc-result {
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  transition: all 0.3s ease;
}

.calc-result.danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
}

.calc-result.success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
}

.calc-result .result-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.calc-result .result-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.calc-result.danger .result-value {
  color: var(--danger);
}

.calc-result.success .result-value {
  color: var(--success);
}

/* --- CTA Button --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  border-radius: 12px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--bg-surface);
}

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--danger), var(--success));
}

.timeline-item {
  position: relative;
  padding-bottom: 40px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -31px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg);
}

.timeline-item .month-label {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 4px;
}

.timeline-bar {
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  margin: 8px 0;
}

.timeline-bar .ota-segment {
  background: var(--danger);
  transition: width 1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  min-width: 0;
  overflow: hidden;
}

.timeline-bar .direct-segment {
  background: var(--success);
  transition: width 1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  min-width: 0;
  overflow: hidden;
}

/* --- Section Divider --- */
.section-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* --- Footer --- */
.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

/* --- Dark Mode Toggle --- */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  color: var(--text-muted);
}

.theme-toggle:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-danger {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.08);
  }
}

@keyframes pulse-success {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.08);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.7s ease forwards;
}

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

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

/* --- Stagger delays --- */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }

/* --- FAQ Accordion --- */
.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-question {
  width: 100%;
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.faq-question svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.faq-answer {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s ease, padding 0.3s ease;
  color: var(--text-secondary);
  line-height: 1.7;
}

.faq-answer.open {
  max-height: 300px;
  padding-bottom: 20px;
}

/* --- Slider Input --- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* --- Mobile Adjustments --- */
@media (max-width: 768px) {
  .comparison-header,
  .comparison-row {
    grid-template-columns: 1fr;
  }

  .comparison-cell.ota {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .comparison-header-cell.ota-header {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .receipt-card {
    padding: 20px 16px;
  }

  .calc-result .result-value {
    font-size: 2rem;
  }

  .calculator-container {
    padding: 20px;
  }
}

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Tabular Nums --- */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* --- Screen reader only --- */
.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;
}
