/* ═══════════════════════════════════════════════════════
   TIER 1 CALCULATORS — SHARED STYLESHEET (scoped, not global)
   Used by: Old vs New Tax Regime, HRA Exemption*, Gratuity,
   Loan Prepayment, Home Loan Affordability, Goal-Based SIP,
   Rent vs Buy
   Pattern matches existing hra.css exactly for continuity.
   * HRA already has its own hra.css — kept separate on purpose.
   ═══════════════════════════════════════════════════════ */

.page-title {
  font-size: 32px;
  margin-bottom: 10px;
  font-weight: 700;
  background: linear-gradient(135deg, #9200C5 0%, #A020D0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  color: #555;
  margin-bottom: 25px;
  font-size: 16px;
  font-weight: 400;
}

/* CARD */
.calc-card {
  background: #fff;
  border: 1px solid #E8E4EC;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.calc-card:hover {
  border-color: #40E0D0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* GRID */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

/* INPUTS */
.input-group {
  margin-bottom: 25px;
}

.input-group label {
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #333;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-row input[type="number"],
.input-row input[type="text"] {
  width: 120px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #E8E4EC;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  background: #fff;
}

.input-row input[type="number"]:focus,
.input-row input[type="text"]:focus {
  outline: none;
  border-color: #40E0D0;
  box-shadow: 0 0 0 3px rgba(64, 224, 208, 0.15);
}

.input-row input[type="number"]:hover,
.input-row input[type="text"]:hover {
  border-color: #40E0D0;
}

/* ===== Premium Slider ===== */
.input-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: #E8E4EC;
  outline: none;
  cursor: pointer;
}

.input-row input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    #40E0D0 0%,
    #40E0D0 calc((var(--val) - var(--min)) / (var(--max) - var(--min)) * 100%),
    #E8E4EC calc((var(--val) - var(--min)) / (var(--max) - var(--min)) * 100%),
    #E8E4EC 100%
  );
}

.input-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #40E0D0 0%, #48D4C4 100%);
  border-radius: 50%;
  cursor: pointer;
  margin-top: -7px;
  box-shadow: 0 2px 6px rgba(64, 224, 208, 0.3);
  transition: all 0.2s ease;
}

.input-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(64, 224, 208, 0.5);
}

.input-row input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 4px;
  background: #E8E4EC;
}

.input-row input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 4px;
  background: #40E0D0;
}

.input-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #40E0D0 0%, #48D4C4 100%);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(64, 224, 208, 0.3);
  transition: all 0.2s ease;
}

.input-row input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(64, 224, 208, 0.5);
}

/* RESULTS - 4 boxes in 2x2 grid */
.result-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.result-box {
  background: #f9f9f9;
  padding: 16px 12px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid #E8E4EC;
  transition: all 0.2s ease;
}

.result-box:hover {
  border-color: #40E0D0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.result-box span {
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

.result-box strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #9200C5 0%, #A020D0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-box.highlight {
  background: linear-gradient(135deg, rgba(64, 224, 208, 0.1) 0%, rgba(72, 212, 196, 0.15) 100%);
  border-color: #40E0D0;
  grid-column: span 2;
}

.result-box.highlight strong {
  background: linear-gradient(135deg, #40E0D0 0%, #48D4C4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 24px;
}

/* CALCULATION BREAKDOWN */
.calculation-breakdown {
  background: linear-gradient(135deg, rgba(146, 0, 197, 0.05) 0%, rgba(160, 32, 208, 0.08) 100%);
  border: 1px solid #E8E4EC;
  border-radius: 10px;
  padding: 20px;
  margin-top: 20px;
}

.calculation-breakdown h4 {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 600;
  color: #9200C5;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #E8E4EC;
}

.breakdown-item:last-of-type {
  border-bottom: none;
}

.breakdown-item span {
  font-size: 14px;
  color: #555;
  font-weight: 500;
}

.breakdown-item strong {
  font-size: 15px;
  color: #9200C5;
  font-weight: 600;
}

.breakdown-note {
  margin-top: 15px;
  padding: 12px;
  background: rgba(64, 224, 208, 0.1);
  border-radius: 6px;
  border-left: 3px solid #40E0D0;
}

.breakdown-note p {
  margin: 0;
  font-size: 13px;
  color: #333;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   NEW — SIDE-BY-SIDE COMPARISON CARDS
   (Old vs New Regime, Buy vs Rent, Snowball vs Avalanche, etc.)
   ═══════════════════════════════════════════════════════ */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}

.comparison-card {
  background: #f9f9f9;
  border: 1.5px solid #E8E4EC;
  border-radius: 12px;
  padding: 20px;
  position: relative;
  transition: all 0.25s ease;
}

.comparison-card h4 {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin: 0 0 14px 0;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.comparison-card .comp-total {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, #9200C5 0%, #A020D0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
  display: block;
}

.comparison-card.winner {
  border-color: #40E0D0;
  background: linear-gradient(135deg, rgba(64, 224, 208, 0.08) 0%, rgba(72, 212, 196, 0.12) 100%);
  box-shadow: 0 4px 16px rgba(64, 224, 208, 0.18);
}

.comparison-card.winner .comp-total {
  background: linear-gradient(135deg, #40E0D0 0%, #48D4C4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge-winner {
  position: absolute;
  top: -12px;
  right: 16px;
  background: linear-gradient(135deg, #40E0D0 0%, #48D4C4 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(64, 224, 208, 0.4);
}

.comp-line {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 13px;
  color: #555;
  border-bottom: 1px dashed #E8E4EC;
}

.comp-line:last-child {
  border-bottom: none;
}

.comp-line strong {
  color: #333;
  font-weight: 600;
}

.savings-banner {
  text-align: center;
  background: linear-gradient(135deg, rgba(64, 224, 208, 0.12) 0%, rgba(146, 0, 197, 0.08) 100%);
  border: 1.5px solid #40E0D0;
  border-radius: 12px;
  padding: 18px;
  margin: 20px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.savings-banner strong {
  font-size: 22px;
  display: block;
  margin-top: 4px;
  background: linear-gradient(135deg, #9200C5 0%, #40E0D0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══════════════════════════════════════════════════════
   NEW — DATA TABLES (slab breakdowns, amortization previews,
   scheme comparisons)
   ═══════════════════════════════════════════════════════ */
.data-table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border-radius: 10px;
  border: 1px solid #E8E4EC;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}

table.data-table thead th {
  background: linear-gradient(135deg, rgba(146, 0, 197, 0.08) 0%, rgba(160, 32, 208, 0.1) 100%);
  color: #9200C5;
  font-weight: 700;
  text-align: left;
  padding: 12px 14px;
  font-size: 13px;
  white-space: nowrap;
}

table.data-table tbody td {
  padding: 10px 14px;
  border-top: 1px solid #F0EDF3;
  color: #444;
}

table.data-table tbody tr:hover {
  background: #FAFAFC;
}

table.data-table tbody tr.row-highlight {
  background: rgba(64, 224, 208, 0.08);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   NEW — FORMULA / INFO CALLOUTS
   ═══════════════════════════════════════════════════════ */
.formula-box {
  background: #F9F7FB;
  border-left: 3px solid #9200C5;
  border-radius: 6px;
  padding: 14px 18px;
  margin: 16px 0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #333;
  overflow-x: auto;
}

.info-note {
  background: rgba(64, 224, 208, 0.08);
  border-left: 3px solid #40E0D0;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 14px;
  color: #333;
}

.info-note strong {
  color: #9200C5;
}

/* ═══════════════════════════════════════════════════════
   NEW — TAB TOGGLE (used where a calculator needs a mode
   switch, e.g. Home Loan Affordability: Income-based / EMI-based)
   ═══════════════════════════════════════════════════════ */
.tab-group {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: #F5F3F7;
  padding: 5px;
  border-radius: 10px;
}

.tab-btn {
  flex: 1;
  padding: 10px 14px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: #fff;
  color: #9200C5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* SEO */
section {
  margin-top: 40px;
  line-height: 1.7;
}

section h2 {
  font-size: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  background: linear-gradient(135deg, #9200C5 0%, #A020D0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

section h3 {
  font-size: 18px;
  margin: 20px 0 10px 0;
  font-weight: 600;
  color: #333;
}

section p {
  color: #444;
  margin-bottom: 14px;
}

section ul {
  margin-left: 20px;
  color: #444;
}

section ul li {
  margin-bottom: 10px;
}

/* FAQ */
.faq-section {
  margin-top: 40px;
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #E8E4EC;
}

.faq-section h2 {
  font-size: 24px;
  margin-bottom: 20px;
  font-weight: 600;
  background: linear-gradient(135deg, #9200C5 0%, #A020D0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* FAQ styling intentionally left to the global stylesheet (.faq-item,
   .faq-item h3, .faq-item p) — do not override here. HRA and every other
   calculator rely on that single global rule for the divider line, the
   18px spacing, and the +/- icon animation. Duplicating any part of it
   here causes double borders and doubled spacing. */

/* MOBILE */
@media (max-width: 768px) {
  .page-title { font-size: 28px; }
  .calc-grid { grid-template-columns: 1fr; }
  .result-cards { grid-template-columns: 1fr; }
  .result-box.highlight { grid-column: span 1; }
  .calc-card { padding: 20px; }
  .faq-section { padding: 20px; }
  section { margin-top: 30px; }
  .calculation-breakdown { padding: 15px; }
  .comparison-grid { grid-template-columns: 1fr; }
  .tab-group { flex-direction: column; }
}

/* Smooth animations */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════
   PREMIUM SELECT / DROPDOWN — theme-matched
   ═══════════════════════════════════════════════════════ */
.input-row select,
select.input-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  padding: 10px 40px 10px 14px;
  border-radius: 10px;
  border: 1.5px solid #E8E4EC;
  font-size: 14px;
  font-weight: 500;
  color: #222;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239200C5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  line-height: 1.5;
}

.input-row select:hover,
select.input-select:hover {
  border-color: #40E0D0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2340E0D0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.input-row select:focus,
select.input-select:focus {
  outline: none;
  border-color: #40E0D0;
  box-shadow: 0 0 0 3px rgba(64, 224, 208, 0.15);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2340E0D0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.input-row select option,
select.input-select option {
  background: #fff;
  color: #222;
  font-weight: 500;
  padding: 8px 12px;
}

.input-row select option:checked,
select.input-select option:checked {
  background: linear-gradient(135deg, rgba(146, 0, 197, 0.12) 0%, rgba(160, 32, 208, 0.12) 100%);
  color: #9200C5;
  font-weight: 600;
}