/* ============================================================
   HOME LOAN CALCULATOR — home-loan-calculator.css
   Toolspot by Tradesala Premium Design Language
   ============================================================ */

/* ── Container Override & Color Tokens ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 100px;
  position: relative;
  z-index: 1;

  /* Theme tokens */
  --tool-indigo: #6366f1;
  --tool-indigo-soft: rgba(99, 102, 241, 0.12);
  --tool-emerald: #10b981;
  --tool-emerald-soft: rgba(16, 185, 129, 0.12);
  --tool-amber: #f59e0b;
  --tool-amber-soft: rgba(245, 158, 11, 0.12);
  --tool-red: #f43f5e;
  --tool-red-soft: rgba(244, 63, 94, 0.12);
}

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

/* ── Tab Switcher ── */
.tab-container {
  position: relative;
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 6px;
  border-radius: 100px;
  width: max-content;
  max-width: 100%;
  margin-bottom: 32px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeUp 0.6s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.tab-container::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

.tab-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  border-radius: 100px;
  background: var(--tool-indigo);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 0;
}

.tab-btn {
  position: relative;
  z-index: 1;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 10px 22px;
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-1);
}

.tab-btn.active {
  color: #fff;
}

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

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

/* ── Panel Styles ── */
.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;
}

.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  pointer-events: none;
}

.panel-title {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.40);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.title-line {
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* ── Input Rows ── */
.input-group {
  margin-bottom: 24px;
}

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

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

.input-header label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  flex: 1;
}

/* ── Bank Presets Row ── */
.presets-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.presets-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-3);
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Outfit', sans-serif;
}

.preset-btn:hover {
  background: var(--tool-indigo-soft);
  color: var(--tool-indigo);
  border-color: rgba(99, 102, 241, 0.3);
}

/* ── Premium Dropdown Select ── */
.premium-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: #fff;
  padding: 11px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ffffff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
}

.premium-select:focus {
  border-color: var(--tool-indigo);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.premium-select option {
  background: #111;
  color: #fff;
}

/* ── Badges ── */
.value-badge {
  background: var(--tool-indigo-soft);
  color: var(--tool-indigo);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 5px 14px;
  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: 90px;
  text-align: center;
}

/* Specific Badge Colors */
#loan-amount-val, #monthly-income-val, #co-income-val {
  background: var(--tool-emerald-soft);
  color: var(--tool-emerald);
  border-color: rgba(16, 185, 129, 0.25);
}

#existing-emi-val, #prepayment-monthly-val, #prepayment-annual-val {
  background: var(--tool-red-soft);
  color: var(--tool-red);
  border-color: rgba(244, 63, 94, 0.25);
}

/* Salary Comfort Badge */
.comfort-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'Outfit', sans-serif;
}

.badge-safe {
  background: var(--tool-emerald-soft);
  color: var(--tool-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-manageable {
  background: var(--tool-amber-soft);
  color: var(--tool-amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-stretched {
  background: rgba(249, 115, 22, 0.12); /* orange */
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.badge-risky {
  background: var(--tool-red-soft);
  color: var(--tool-red);
  border: 1px solid rgba(244, 63, 94, 0.25);
}

/* ── Sliders ── */
.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(--slider-color, var(--tool-indigo)) 0%, 
    var(--slider-color, var(--tool-indigo)) var(--fill, 50%),
    rgba(255, 255, 255, 0.1) var(--fill, 50%), 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(--slider-color, var(--tool-indigo));
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 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(--slider-color, var(--tool-indigo));
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

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

.kpi-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s, background 0.3s;
}

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

.kpi-card.indigo::before  { background: linear-gradient(90deg, #6366f1, #818cf8); }
.kpi-card.emerald::before { background: linear-gradient(90deg, #10b981, #34d399); }
.kpi-card.amber::before   { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi-card.purple::before  { background: linear-gradient(90deg, #a78bfa, #c4b5fd); }

.kpi-card.kpi-span-full {
  grid-column: span 2;
}

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

.kpi-val {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(18px, 2.5vw, 24px);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 8px;
  line-height: 1.4;
}

/* ── Status Card Customization ── */
.status-card {
  background: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.20);
}

.status-card.warning-state {
  background: rgba(244, 63, 94, 0.05);
  border-color: rgba(244, 63, 94, 0.20);
}

.status-msg {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
}

.status-msg strong {
  color: var(--text-1);
}

/* ── Doughnut Chart Visuals ── */
.chart-box {
  position: relative;
  width: 100%;
  height: 200px;
  margin: 16px auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chart-box canvas {
  max-width: 100%;
  max-height: 100%;
  z-index: 2;
}

.chart-center-val {
  position: absolute;
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  z-index: 1;
  text-align: center;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.chart-labels {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
}

.chart-label-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Amortization 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: hidden;
  overflow-x: auto;
  backdrop-filter: blur(12px);
  position: relative;
}

.table-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  pointer-events: none;
  z-index: 1;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

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

.schedule-table thead th:first-child {
  text-align: left;
}

.schedule-table tbody td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--glass-border);
  font-weight: 500;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  text-align: right;
  transition: background 0.15s;
}

.schedule-table tbody td:first-child {
  text-align: left;
}

.schedule-table tbody tr:last-child td {
  border-bottom: none;
}

.schedule-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.schedule-table tbody tr.prepaid-row td {
  color: var(--tool-emerald);
  font-weight: 600;
}

/* FAQ spacing */
#tool-faq {
  margin-top: 56px;
}

/* ── Light Mode Support ── */
body.light .tab-container {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light .tab-indicator {
  background: var(--tool-indigo);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

body.light .tab-btn {
  color: #555;
}

body.light .tab-btn:hover {
  color: #000;
}

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

body.light .panel {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.04);
}

body.light .panel::before {
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.12), transparent);
}

body.light .panel-title {
  color: rgba(0, 0, 0, 0.60);
}

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

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

body.light .preset-btn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.10);
  color: #444;
}

body.light .preset-btn:hover {
  background: var(--tool-indigo-soft);
  color: var(--tool-indigo);
}

body.light .premium-select {
  background-color: #fff;
  border-color: rgba(0, 0, 0, 0.15);
  color: #000;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000000'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

body.light .premium-select option {
  background: #fff;
  color: #000;
}

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

body.light .range-slider::-webkit-slider-thumb {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

body.light .range-labels {
  color: #666;
}

body.light .kpi-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.03);
}

body.light .kpi-label {
  color: #555;
}

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

body.light .kpi-sub {
  color: #666;
}

body.light .status-card {
  background: rgba(99, 102, 241, 0.03);
  border-color: rgba(99, 102, 241, 0.12);
}

body.light .status-card.warning-state {
  background: rgba(244, 63, 94, 0.03);
  border-color: rgba(244, 63, 94, 0.12);
}

body.light .status-msg {
  color: #444;
}

body.light .status-msg strong {
  color: #000;
}

body.light .chart-center-val {
  color: #000;
}

body.light .chart-label-item {
  color: #333;
}

body.light .table-wrapper {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

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 td {
  color: #333;
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.light .schedule-table tbody tr:hover td {
  background: rgba(0, 0, 0, 0.015);
}

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

  .right-col {
    position: static;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px 80px;
  }

  .tool-header {
    padding: 40px 0 24px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel {
    padding: 20px;
    border-radius: 20px;
  }

  .chart-box {
    height: 180px;
  }

  .tab-btn {
    padding: 8px 16px;
    font-size: 12px;
  }
}
