/* =============================================
   FINIT — Calculator Enhancements
   Sliders · Insights · Scenarios · Journey
   ============================================= */

/* ── Range Slider ───────────────────────────── */

input[type="range"].calc-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--brand-accent, #0fb9a8) 0%,
    var(--brand-accent, #0fb9a8) var(--progress, 30%),
    #d4eeec var(--progress, 30%),
    #d4eeec 100%
  );
  outline: none;
  cursor: pointer;
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
  border: none;
  display: block;
  padding: 0;
  touch-action: manipulation;
}

/* Webkit thumb */
input[type="range"].calc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand-accent, #0fb9a8);
  box-shadow:
    0 1px 6px rgba(15, 185, 168, 0.28),
    0 1px 2px rgba(0, 0, 0, 0.08);
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  margin-top: -8px;
}

input[type="range"].calc-slider::-webkit-slider-thumb:hover {
  transform: scale(1.08);
  box-shadow:
    0 2px 10px rgba(15, 185, 168, 0.38),
    0 0 0 4px rgba(15, 185, 168, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.08);
}

input[type="range"].calc-slider:active::-webkit-slider-thumb {
  transform: scale(1.04);
  cursor: grabbing;
  box-shadow:
    0 2px 8px rgba(15, 185, 168, 0.42),
    0 0 0 5px rgba(15, 185, 168, 0.13);
  border-color: #089e8f;
}

input[type="range"].calc-slider::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: transparent;
}

/* Firefox thumb */
input[type="range"].calc-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand-accent, #0fb9a8);
  box-shadow:
    0 1px 6px rgba(15, 185, 168, 0.28),
    0 1px 2px rgba(0, 0, 0, 0.08);
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

input[type="range"].calc-slider::-moz-range-thumb:hover {
  transform: scale(1.08);
}

input[type="range"].calc-slider:active::-moz-range-thumb {
  transform: scale(1.04);
  cursor: grabbing;
}

input[type="range"].calc-slider::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: #d4eeec;
}

input[type="range"].calc-slider::-moz-range-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--brand-accent, #0fb9a8);
}

input[type="range"].calc-slider:focus-visible {
  outline: none;
}

input[type="range"].calc-slider:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 1px 6px rgba(15, 185, 168, 0.28),
    0 0 0 3px rgba(15, 185, 168, 0.24);
}

input[type="range"].calc-slider:focus-visible::-moz-range-thumb {
  box-shadow:
    0 1px 6px rgba(15, 185, 168, 0.28),
    0 0 0 3px rgba(15, 185, 168, 0.24);
}

/* ── Result reveal animation ────────────────── */

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

.result-row {
  animation: resultReveal 0.35s ease both;
}

.result-row:nth-child(1) { animation-delay: 0.04s; }
.result-row:nth-child(2) { animation-delay: 0.09s; }
.result-row:nth-child(3) { animation-delay: 0.14s; }
.result-row:nth-child(4) { animation-delay: 0.19s; }
.result-row:nth-child(5) { animation-delay: 0.24s; }
.result-row:nth-child(6) { animation-delay: 0.29s; }

/* ── Insights Panel ─────────────────────────── */

.calc-insights {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.calc-insight-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.55;
  border: 1px solid transparent;
  background: rgba(7, 30, 54, 0.04);
  border-color: rgba(7, 30, 54, 0.08);
  color: var(--text-secondary, #4a5a6a);
  transition: background 0.2s ease;
}

.calc-insight-item.insight-green {
  background: rgba(39, 174, 96, 0.07);
  border-color: rgba(39, 174, 96, 0.22);
  color: #1a6b35;
}

.calc-insight-item.insight-yellow {
  background: rgba(243, 156, 18, 0.07);
  border-color: rgba(243, 156, 18, 0.25);
  color: #7a4f00;
}

.calc-insight-item.insight-red {
  background: rgba(231, 76, 60, 0.07);
  border-color: rgba(231, 76, 60, 0.22);
  color: #9b2418;
}

.insight-icon {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1.55;
}

.insight-text {
  flex: 1;
  min-width: 0;
}

/* ── Scenario Buttons ───────────────────────── */

.calc-scenarios {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  background: rgba(7, 30, 54, 0.025);
  border-radius: 14px;
  border: 1px solid rgba(7, 30, 54, 0.07);
}

.calc-scenarios-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted, #7d9996);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 0.7rem;
}

.calc-scenarios-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.scenario-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(11, 107, 99, 0.25);
  background: rgba(11, 107, 99, 0.05);
  color: var(--brand-teal, #0b6b63);
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--font-body, 'Heebo', sans-serif);
  white-space: nowrap;
  line-height: 1;
}

.scenario-btn:hover {
  background: var(--brand-teal, #0b6b63);
  color: #fff;
  border-color: var(--brand-teal, #0b6b63);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(11, 107, 99, 0.25);
}

.scenario-btn:active,
.scenario-btn--active {
  background: var(--brand-teal, #0b6b63);
  color: #fff;
  transform: scale(0.96);
  box-shadow: none;
}

/* ── Journey Section ────────────────────────── */

.calc-journey {
  margin-top: 1.25rem;
  padding: 1.1rem 1.15rem;
  background: linear-gradient(
    135deg,
    rgba(7, 30, 54, 0.03) 0%,
    rgba(11, 107, 99, 0.05) 100%
  );
  border-radius: 16px;
  border: 1px solid rgba(11, 107, 99, 0.1);
}

.calc-journey-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted, #7d9996);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 0.7rem;
}

.calc-journey-links {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.journey-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(11, 107, 99, 0.1);
  text-decoration: none;
  color: var(--brand-navy, #071e36);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.18s ease;
  line-height: 1.4;
}

.journey-link:hover {
  background: #fff;
  border-color: var(--brand-teal, #0b6b63);
  color: var(--brand-teal, #0b6b63);
  transform: translateX(-3px);
  box-shadow: 0 3px 10px rgba(11, 107, 99, 0.12);
}

.journey-link-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}

.journey-link-arrow {
  margin-right: auto;
  color: var(--brand-teal, #0b6b63);
  font-size: 0.85rem;
  transition: transform 0.18s ease;
}

.journey-link:hover .journey-link-arrow {
  transform: translateX(-3px);
}

/* ── Advanced Options Toggle ────────────────── */

.calc-advanced-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  margin-top: 0.75rem;
  border-radius: 10px;
  border: 1px dashed rgba(11, 107, 99, 0.3);
  background: rgba(11, 107, 99, 0.03);
  cursor: pointer;
  color: var(--brand-teal, #0b6b63);
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-body, 'Heebo', sans-serif);
  user-select: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.calc-advanced-toggle:hover {
  background: rgba(11, 107, 99, 0.07);
  border-color: rgba(11, 107, 99, 0.45);
}

.calc-advanced-toggle[aria-expanded="true"] {
  background: rgba(11, 107, 99, 0.08);
  border-style: solid;
  border-color: rgba(11, 107, 99, 0.35);
}

.adv-toggle-icon {
  font-size: 1rem;
}

.adv-toggle-label {
  flex: 1;
}

.adv-toggle-arrow {
  font-size: 0.8rem;
  transition: transform 0.22s ease;
  display: inline-block;
}

.calc-advanced-toggle[aria-expanded="true"] .adv-toggle-arrow {
  transform: rotate(180deg);
}

.calc-advanced-section {
  display: none;
  overflow: hidden;
  border: 1px solid rgba(11, 107, 99, 0.15);
  border-radius: 0 0 12px 12px;
  border-top: none;
  padding: 1rem 1rem 0.25rem;
  background: rgba(11, 107, 99, 0.03);
  margin-bottom: 0.5rem;
}

.calc-advanced-section.advanced--open {
  display: block;
}

/* ── Simulation Mode Toggle ─────────────────── */

.calc-sim-toggle {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  background: rgba(7, 30, 54, 0.04);
  border-radius: 10px;
  padding: 0.35rem;
  border: 1px solid rgba(7, 30, 54, 0.07);
}

.sim-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #4a5a6a);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-body, 'Heebo', sans-serif);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
}

.sim-btn:hover {
  background: rgba(15, 185, 168, 0.1);
  color: var(--brand-teal, #0b6b63);
}

.sim-btn--active {
  background: var(--brand-accent, #0fb9a8);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 185, 168, 0.35);
}

.sim-btn--active:hover {
  background: var(--brand-accent, #0fb9a8);
  color: #fff;
}

/* ── Fee Impact Row ──────────────────────────── */

.result-row--fee .result-value--muted {
  color: var(--text-muted, #7d9996);
  font-size: 0.92em;
}

/* ── Status Badge (pension-obligation) ──────── */

.calc-status {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  margin: 0.75rem 0;
  border: 1.5px solid transparent;
}

.calc-status--green {
  background: rgba(39, 174, 96, 0.1);
  border-color: rgba(39, 174, 96, 0.3);
  color: #1a6b35;
}

.calc-status--yellow {
  background: rgba(243, 156, 18, 0.1);
  border-color: rgba(243, 156, 18, 0.35);
  color: #7a4f00;
}

.calc-status--red {
  background: rgba(231, 76, 60, 0.1);
  border-color: rgba(231, 76, 60, 0.3);
  color: #9b2418;
}

/* ── Hub card "new" badge ────────────────────── */

.calc-hub-card--new {
  position: relative;
}

.calc-hub-badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  background: var(--brand-accent, #0fb9a8);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.06em;
}

/* ── Smart Lead Box ─────────────────────────── */

.calc-lead-box--dynamic .calc-lead-gap {
  display: inline;
  font-weight: 800;
  color: #c0392b;
}

.calc-lead-box--dynamic .calc-lead-gap.gap-good {
  color: var(--brand-teal, #0b6b63);
}

/* ── Result Flash Animation ─────────────────── */

@keyframes resultPulse {
  0%   { color: inherit; transform: scale(1); }
  20%  { color: var(--brand-accent, #0fb9a8); transform: scale(1.04); }
  100% { color: inherit; transform: scale(1); }
}

.result-value--updated {
  animation: resultPulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  display: inline-block;
}

/* ── Mobile ─────────────────────────────────── */

@media (max-width: 768px) {
  .calc-scenarios {
    padding: 0.9rem 0.95rem;
  }

  .scenario-btn {
    font-size: 0.8rem;
    padding: 0.5rem 0.85rem;
    min-height: 40px;
  }

  .journey-link {
    font-size: 0.85rem;
    padding: 0.65rem 0.85rem;
    min-height: 44px;
  }

  .calc-insight-item {
    font-size: 0.88rem;
    padding: 0.8rem 0.9rem;
  }

  /* Slider — upgrade thumb size for touch */
  input[type="range"].calc-slider {
    height: 6px;
    margin-top: 0.75rem;
    touch-action: manipulation;
  }

  input[type="range"].calc-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -9px;
  }

  input[type="range"].calc-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }

  input[type="range"].calc-slider::-webkit-slider-runnable-track {
    height: 6px;
  }

  input[type="range"].calc-slider::-moz-range-track {
    height: 6px;
  }

  input[type="range"].calc-slider::-moz-range-progress {
    height: 6px;
  }
}

@media (max-width: 480px) {
  /* Even larger thumb for small phones */
  input[type="range"].calc-slider {
    height: 6px;
    touch-action: manipulation;
  }

  input[type="range"].calc-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    margin-top: -11px;
    border-width: 2.5px;
  }

  input[type="range"].calc-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-width: 2.5px;
  }

  .calc-scenarios-btns {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .scenario-btn {
    font-size: 0.82rem;
    padding: 0.55rem 0.85rem;
    min-height: 42px;
    width: 100%;
    justify-content: center;
  }

  .calc-sim-toggle {
    flex-direction: column;
  }

  .sim-btn {
    min-height: 44px;
    font-size: 0.88rem;
  }
}

/* ── Slider Value Bubble ─────────────────────── */

.calc-slider-wrap {
  position: relative;
  display: block;
  padding-top: 26px; /* headroom for bubble — replaces slider's own margin-top */
  margin-top: calc(0.75rem - 26px); /* net: same top gap as the original margin-top on the slider */
}

.calc-slider-wrap input[type="range"].calc-slider {
  margin-top: 0; /* wrap provides the spacing now */
}

.calc-slider-bubble {
  display: none; /* desktop: hidden — shown only on mobile */
  position: absolute;
  top: 0;
  left: clamp(15%, var(--bubble-left, 50%), 85%);
  transform: translateX(-50%);
  background: var(--calc-navy, #071e36);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
  font-family: var(--font-body, 'Heebo', sans-serif);
  letter-spacing: 0.01em;
  line-height: 1.5;
  filter: drop-shadow(0 1px 3px rgba(7, 30, 54, 0.3));
}

.calc-slider-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--calc-navy, #071e36);
}

@media (max-width: 768px) {
  .calc-slider-bubble {
    display: block;
  }

  .calc-slider-wrap.slider--dragging .calc-slider-bubble {
    opacity: 1;
  }
}

/* ── Mobile Calculator Bottom Nav ───────────── */

.calc-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  background: rgba(5, 18, 38, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  direction: rtl;
}

@media (max-width: 768px) {
  .calc-mobile-nav {
    display: flex;
  }
}

.cmn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  font-family: var(--font-body, 'Heebo', sans-serif);
  border-radius: 10px;
  min-height: 44px;
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.88);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.cmn-side {
  background: rgba(255, 255, 255, 0.1);
  min-width: 72px;
  flex-shrink: 0;
}

.cmn-side:hover,
.cmn-side:active {
  background: rgba(255, 255, 255, 0.18);
}

.cmn-hub {
  background: linear-gradient(135deg, #13d4c0 0%, #0a5e57 100%);
  flex: 1;
  font-size: 0.78rem;
  color: #fff;
}

.cmn-hub:hover,
.cmn-hub:active {
  opacity: 0.9;
}

.cmn-disabled {
  opacity: 0.22;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.06);
  min-width: 72px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-family: var(--font-body, 'Heebo', sans-serif);
  color: rgba(255, 255, 255, 0.5);
}
