/* ============================================================
   SIP CALCULATOR — sip-calculator.css
   Design system matched to EMI Calculator / Revenue Forecaster
   Toolspot by Tradesala
   ============================================================ */

/* ── Page Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 100px;
  position: relative;
  z-index: 1;

  /* Palette Overrides */
  --tool-red: #fb7185;
  --tool-red-soft: rgba(251, 113, 133, 0.12);
}

/* ── Tool Header ── */
.tool-header {
  padding: 56px 0 40px;
  animation: fadeUp 0.6s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
  max-width: 760px;
}

/* ── Main Two-Column Grid ── */
.main-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  align-items: start;
  animation: fadeUp 0.6s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Mode Toggle ── */
.mode-toggle {
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 28px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mode-btn {
  background: transparent;
  border: none;
  padding: 8px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.mode-btn.active {
  background: var(--tool-red);
  color: #fff;
  box-shadow: 0 4px 12px rgba(244, 18, 18, 0.2);
}

.right-col {
  position: sticky;
  top: 80px;
}

/* ── Panel — matches reference ── */
.panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  padding: 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

/* Top specular line */
.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.08) 20%, 
    rgba(255, 255, 255, 0.15) 50%, 
    rgba(255, 255, 255, 0.08) 80%, 
    transparent 100%
  );
  z-index: 2;
}

.panel-title {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.08), transparent);
}

/* ── Input Groups ── */
.input-group {
  margin-bottom: 28px;
}

.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.input-header label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Info Icon & Tooltip ── */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.2px solid var(--text-3);
  color: var(--text-3);
  font-size: 9px;
  font-weight: 700;
  cursor: help;
  transition: all 0.2s;
  position: relative;
}

.info-icon:hover {
  border-color: var(--tool-red);
  color: var(--tool-red);
  background: var(--tool-red-soft);
}

.info-icon[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  width: 180px;
  padding: 10px 12px;
  background: rgba(20, 20, 30, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  text-transform: none;
  letter-spacing: normal;
}

.info-icon:hover[data-tooltip]::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

body.light .info-icon[data-tooltip]::after {
  background: rgba(255, 255, 255, 0.98);
  color: #111;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ── Value Badge ── */
.value-badge {
  background: var(--tool-red-soft);
  color: var(--tool-red);
  border: 1px solid rgba(251, 113, 133, 0.25);
  padding: 5px 13px;
  border-radius: 20px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 80px;
  text-align: center;
}

/* ── Range Slider ── */
.slider-wrap {
  position: relative;
  padding-bottom: 4px;
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right, var(--tool-red) 0%, var(--tool-red) var(--fill, 40%), 
    rgba(255, 255, 255, 0.1) var(--fill, 40%), rgba(255, 255, 255, 0.1) 100%);
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: #fff;
  border: 3px solid var(--tool-red);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15), 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: #fff;
  border: 3px solid var(--tool-red);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.5px;
}

/* ── Toggle Panel ── */
.toggle-group.panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 20px;
}

.toggle-label {
  display: flex;
  flex-direction: column;
}

.toggle-title {
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
}

.toggle-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ── Toggle Switch ── */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border: 1px solid rgba(255,255,255,0.1);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider { background-color: var(--tool-red); }
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

.inflation-input-wrap {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  opacity: 0;
}

.inflation-input-wrap.visible {
  max-height: 140px;
  opacity: 1;
}

/* ── KPI Grid ── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Fallback */
  gap: 16px;
}

.kpi-grid.elite {
  grid-template-columns: repeat(3, 1fr);
}

.kpi-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 20px;
  position: relative;
  transition: transform 0.3s ease, background 0.3s ease;
  overflow: hidden;
}

.kpi-card:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 20px 20px 0 0;
}

.kpi-card.red::before     { background: linear-gradient(90deg, #f41212, #ff6060); }
.kpi-card.rose::before    { background: linear-gradient(90deg, #fb7185, #fecdd3); }
.kpi-card.crimson::before { background: linear-gradient(90deg, #991b1b, #ef4444); }
.kpi-card.purple::before  { background: linear-gradient(90deg, #a78bfa, #c4b5fd); }
.kpi-card.blue::before    { background: linear-gradient(90deg, #60a5fa, #93c5fd); }
.kpi-card.gold::before    { background: linear-gradient(90deg, #facc15, #fde047); }

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.kpi-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.kpi-card.hero .kpi-val {
  font-size: 1.5rem;
  color: var(--tool-red);
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-3);
}

/* ── Chart ── */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: 16px;
  overflow: hidden;
}

.chart-legend {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

/* ── Growth Table ── */
.schedule-section {
  margin-top: 56px;
  animation: fadeUp 0.6s 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.schedule-sub {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 20px;
  line-height: 1.6;
}

.table-wrapper {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.schedule-table thead th {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-2);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--glass-border);
}

.schedule-table tbody td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.schedule-table tbody tr:last-child td { border-bottom: none; }
.schedule-table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

.year-col    { font-weight: 700; color: var(--text); }
.invested-col{ color: var(--text-2); }
.gains-col   { color: #fb7185; font-weight: 600; }
.total-col   { font-weight: 700; color: var(--text); }

/* ── Insight Card ── */
.insight-card {
  padding: 20px;
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.05), rgba(255, 255, 255, 0.02));
  border-left: 4px solid var(--tool-red);
}

.insight-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--tool-red);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.insight-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}

/* ── Delay Card ── */
.delay-card {
  border-left-color: #f87171;
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.05), transparent);
}

/* ── Milestones ── */
.milestone-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.milestone-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.milestone-label { color: var(--text-2); font-weight: 600; }
.milestone-year  { color: var(--text); font-weight: 700; }

/* ── Comparison Grid ── */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.comp-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
}

.comp-meta { display: flex; flex-direction: column; gap: 2px; }
.comp-name { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; }
.comp-rate { font-size: 10px; color: var(--text-3); }
.comp-val  { font-size: 14px; font-weight: 700; color: var(--text); font-family: 'Outfit', sans-serif; }

.breadcrumb a {
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover { color: var(--text); }

/* ── FAQ ── */
#tool-faq { margin-top: 80px; }

/* ── Light Mode Overrides ── */
body.light .panel {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

body.light .panel::before {
  background: linear-gradient(90deg, transparent, rgba(244, 18, 18, 0.15), transparent);
}

body.light .panel-title { color: rgba(0, 0, 0, 0.68); }
body.light .title-line  { background: rgba(0, 0, 0, 0.10); }

body.light .input-header label { color: #333; }

body.light .range-slider {
  background: linear-gradient(to right, var(--tool-red) 0%, var(--tool-red) var(--fill, 40%), 
    rgba(0, 0, 0, 0.08) var(--fill, 40%), rgba(0, 0, 0, 0.08) 100%);
}

body.light .kpi-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.05);
}

body.light .kpi-val { color: #000; }
body.light .legend-item { color: #444; }

body.light .breadcrumb, 
body.light .breadcrumb a,
body.light .kpi-label,
body.light .kpi-sub { 
  color: #555; 
}

body.light .toggle-group.panel {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}

body.light .toggle-title { color: #000; }

body.light .slider {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.1);
}

body.light .slider:before {
  background-color: #666;
}

body.light input:checked + .slider:before {
  background-color: #fff;
}

/* Growth Table Light Mode */
body.light .table-wrapper {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

body.light .schedule-table thead th {
  background: rgba(0, 0, 0, 0.02);
  color: #333;
  border-bottom-color: rgba(0, 0, 0, 0.10);
}

body.light .schedule-table tbody tr:hover td { background: rgba(0, 0, 0, 0.015); }
body.light .year-col     { color: #000; }
body.light .gains-col    { color: #b91c1c; }

body.light .insight-card {
  background: rgba(251, 113, 133, 0.05);
}

body.light .mode-toggle {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
}

body.light .mode-btn { color: #666; }
body.light .mode-btn.active { color: #fff; }

body.light .milestone-item,
body.light .comp-item {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.05);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .right-col { position: static; }
}

@media (max-width: 640px) {
  .kpi-grid.elite {
    grid-template-columns: 1fr;
  }
  .kpi-card.hero .kpi-val { font-size: 1.3rem; }
  .mode-toggle { grid-template-columns: 1fr; }
  .tool-header h1 { font-size: 2.2rem; }
}