/* ==========================================================================
   Comprehensive Loan Calculator Styles
   ========================================================================== */

:root {
  --lc-primary: #6366f1;
  --lc-primary-rgb: 99, 102, 241;
  --lc-primary-hover: #4f46e5;
  --lc-secondary: #06b6d4;
  --lc-success: #10b981;
  --lc-success-rgb: 16, 185, 129;
  --lc-warning: #f59e0b;
  --lc-danger: #ef4444;
  --lc-danger-rgb: 239, 68, 68;
  --lc-info: #3b82f6;
  --lc-card-bg: var(--bg-card, #1e293b);
  --lc-card-border: var(--border-color, rgba(148, 163, 184, 0.12));
  --lc-text-primary: var(--text-primary, #f1f5f9);
  --lc-text-secondary: var(--text-secondary, #94a3b8);
  --lc-text-muted: var(--text-muted, #64748b);
  --lc-input-bg: var(--bg-input, rgba(30, 41, 59, 0.7));
  --lc-table-border: rgba(148, 163, 184, 0.15);
  --lc-table-hover: rgba(99, 102, 241, 0.05);
}

body.light-theme {
  --lc-card-bg: #ffffff;
  --lc-card-border: rgba(15, 23, 42, 0.08);
  --lc-text-primary: #0f172a;
  --lc-text-secondary: #475569;
  --lc-text-muted: #94a3b8;
  --lc-input-bg: #ffffff;
  --lc-table-border: rgba(15, 23, 42, 0.08);
  --lc-table-hover: rgba(99, 102, 241, 0.04);
}

.loan-calc-container {
  max-width: 1320px;
  margin: 0 auto;
}

/* --- Mode Navigation / Tabs --- */
.lc-nav-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--lc-card-border);
  border-radius: 14px;
  margin-bottom: 24px;
  scrollbar-width: thin;
}

body.light-theme .lc-nav-pills {
  background: rgba(241, 245, 249, 0.85);
}

.lc-mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--lc-text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.lc-mode-btn:hover {
  color: var(--lc-text-primary);
  background: rgba(99, 102, 241, 0.1);
}

.lc-mode-btn.active {
  background: var(--accent-gradient, linear-gradient(135deg, #6366f1, #06b6d4));
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.lc-mode-btn i {
  font-size: 1rem;
}

/* --- Control Bar --- */
.lc-control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 18px;
  background: var(--lc-card-bg);
  border: 1px solid var(--lc-card-border);
  border-radius: 12px;
}

.lc-currency-select {
  max-width: 180px;
}

.lc-preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lc-preset-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--lc-card-border);
  background: transparent;
  color: var(--lc-text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lc-preset-btn:hover,
.lc-preset-btn.active {
  border-color: var(--lc-primary);
  background: rgba(99, 102, 241, 0.15);
  color: var(--lc-primary);
}

/* --- Form Cards & Controls --- */
.lc-card {
  background: var(--lc-card-bg);
  border: 1px solid var(--lc-card-border);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  margin-bottom: 24px;
  transition: box-shadow 0.25s ease;
}

body.light-theme .lc-card {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

.lc-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--lc-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lc-card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--lc-text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.lc-card-body {
  padding: 24px;
}

.lc-form-group {
  margin-bottom: 18px;
}

.lc-form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--lc-text-primary);
  margin-bottom: 6px;
}

.lc-form-label-hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--lc-text-muted);
}

.lc-input-group {
  position: relative;
  display: flex;
  align-items: stretch;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--lc-card-border);
  background: var(--lc-input-bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lc-input-group:focus-within {
  border-color: var(--lc-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.lc-input-prefix,
.lc-input-suffix {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--lc-text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.08);
  user-select: none;
}

.lc-input-field {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 14px;
  color: var(--lc-text-primary);
  font-size: 1rem;
  font-weight: 600;
  min-width: 0;
}

.lc-input-field:focus {
  outline: none;
}

/* Custom Range Slider */
.lc-range-slider {
  width: 100%;
  height: 6px;
  margin-top: 8px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.lc-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--lc-primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.5);
  border: 2px solid #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease;
}

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

.lc-range-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--lc-primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.5);
  border: 2px solid #ffffff;
  cursor: pointer;
}

/* Toggle Accordions */
.lc-accordion {
  border: 1px solid var(--lc-card-border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.2);
}

body.light-theme .lc-accordion {
  background: rgba(248, 250, 252, 0.8);
}

.lc-accordion-btn {
  width: 100%;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: none;
  background: transparent;
  color: var(--lc-text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.lc-accordion-btn i.arrow-icon {
  transition: transform 0.25s ease;
}

.lc-accordion-btn.expanded i.arrow-icon {
  transform: rotate(180deg);
}

.lc-accordion-content {
  display: none;
  padding: 16px 18px 20px;
  border-top: 1px solid var(--lc-card-border);
}

.lc-accordion-content.show {
  display: block;
}

/* --- Hero Results / KPI Section --- */
.lc-hero-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.lc-hero-main {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--lc-card-border);
}

.lc-hero-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--lc-primary);
  margin-bottom: 6px;
}

.lc-hero-amount {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--lc-text-primary);
  line-height: 1.1;
  letter-spacing: -1px;
}

.lc-hero-frequency {
  font-size: 1rem;
  color: var(--lc-text-muted);
  font-weight: 500;
}

.lc-payment-breakdown-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.lc-breakdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--lc-card-border);
  color: var(--lc-text-secondary);
}

body.light-theme .lc-breakdown-pill {
  background: rgba(255, 255, 255, 0.9);
}

.lc-breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* KPI Grid */
.lc-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.lc-kpi-item {
  text-align: center;
  padding: 10px;
  background: rgba(15, 23, 42, 0.25);
  border-radius: 12px;
  border: 1px solid var(--lc-card-border);
}

body.light-theme .lc-kpi-item {
  background: rgba(255, 255, 255, 0.6);
}

.lc-kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--lc-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.lc-kpi-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--lc-text-primary);
}

.lc-kpi-sub {
  font-size: 0.75rem;
  color: var(--lc-text-muted);
  margin-top: 2px;
}

/* Savings Callout */
.lc-savings-callout {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  gap: 14px;
}

.lc-savings-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--lc-success);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.lc-savings-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--lc-success);
  margin-bottom: 2px;
}

.lc-savings-desc {
  font-size: 0.85rem;
  color: var(--lc-text-secondary);
  margin: 0;
}

/* --- Visual Charts Styling --- */
.lc-chart-container {
  width: 100%;
  position: relative;
}

.lc-donut-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lc-donut-svg {
  width: 100%;
  max-width: 260px;
  height: auto;
  transform: rotate(-90deg);
}

.lc-donut-circle-bg {
  fill: none;
  stroke: rgba(148, 163, 184, 0.1);
  stroke-width: 24;
}

.lc-donut-segment {
  fill: none;
  stroke-width: 24;
  transition: stroke-dasharray 0.5s ease, stroke-dashoffset 0.5s ease, opacity 0.2s ease;
  cursor: pointer;
}

.lc-donut-segment:hover {
  opacity: 0.85;
}

.lc-donut-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.lc-donut-center-amount {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--lc-text-primary);
  line-height: 1.1;
}

.lc-donut-center-label {
  font-size: 0.75rem;
  color: var(--lc-text-muted);
  text-transform: uppercase;
}

/* Trajectory Curve SVG */
.lc-curve-svg {
  width: 100%;
  height: 250px;
  overflow: visible;
}

.lc-chart-grid line {
  stroke: var(--lc-card-border);
  stroke-dasharray: 4, 4;
}

.lc-chart-axis-text {
  fill: var(--lc-text-muted);
  font-size: 11px;
  font-family: inherit;
}

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

.lc-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--lc-text-secondary);
}

.lc-chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 10;
  display: none;
  transform: translate(-50%, -100%);
  margin-top: -8px;
  white-space: nowrap;
}

/* --- Amortization Table --- */
.lc-table-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.lc-view-toggle {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--lc-card-border);
  border-radius: 8px;
  padding: 3px;
}

body.light-theme .lc-view-toggle {
  background: rgba(241, 245, 249, 0.9);
}

.lc-view-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--lc-text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lc-view-btn.active {
  background: var(--lc-primary);
  color: #ffffff;
}

.lc-table-actions {
  display: flex;
  gap: 8px;
}

.lc-btn-action {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--lc-card-border);
  background: var(--lc-card-bg);
  color: var(--lc-text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.lc-btn-action:hover {
  color: var(--lc-primary);
  border-color: var(--lc-primary);
}

.lc-table-responsive {
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid var(--lc-table-border);
  border-radius: 12px;
  scrollbar-width: thin;
}

.lc-table {
  width: 100%;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}

.lc-table thead th {
  position: sticky;
  top: 0;
  background: var(--lc-card-bg);
  color: var(--lc-text-primary);
  font-weight: 700;
  border-bottom: 2px solid var(--lc-table-border);
  padding: 10px 14px;
  text-align: right;
  z-index: 2;
  white-space: nowrap;
}

.lc-table thead th:first-child,
.lc-table tbody td:first-child {
  text-align: left;
}

.lc-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--lc-table-border);
  color: var(--lc-text-secondary);
  text-align: right;
  white-space: nowrap;
}

.lc-table tbody tr:hover td {
  background: var(--lc-table-hover);
  color: var(--lc-text-primary);
}

.lc-table tbody tr.year-row td {
  font-weight: 700;
  color: var(--lc-text-primary);
  background: rgba(99, 102, 241, 0.05);
}

/* --- Side-by-Side Comparison Grid --- */
.lc-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.lc-compare-col {
  background: var(--lc-card-bg);
  border: 1px solid var(--lc-card-border);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.lc-compare-col.highlight-winner {
  border-color: var(--lc-success);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.lc-winner-badge {
  position: absolute;
  top: -12px;
  right: 18px;
  background: var(--lc-success);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.lc-compare-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--lc-text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lc-compare-stat {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--lc-card-border);
  font-size: 0.88rem;
}

.lc-compare-stat-label {
  color: var(--lc-text-muted);
}

.lc-compare-stat-val {
  font-weight: 700;
  color: var(--lc-text-primary);
}

/* --- DTI Affordability Status Gauge --- */
.lc-dti-gauge {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--lc-card-border);
}

body.light-theme .lc-dti-gauge {
  background: rgba(248, 250, 252, 0.9);
}

.lc-dti-meter {
  height: 8px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
  margin: 10px 0 6px;
  display: flex;
}

.lc-dti-bar {
  height: 100%;
  transition: width 0.4s ease;
}

/* Print Styles */
@media print {
  .page-title-box,
  .lc-nav-pills,
  .lc-control-bar,
  .lc-table-controls,
  .topbar,
  .footer,
  .adsense-wrapper,
  .tool-seo-block,
  .related-tools-section,
  .btn,
  .lc-preset-pills,
  .lc-accordion-btn {
    display: none !important;
  }
  
  body, .page-wrapper, .page-content {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .lc-card, .lc-hero-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  .lc-table-responsive {
    max-height: none !important;
    overflow: visible !important;
  }

  .lc-table thead th {
    position: static !important;
    background: #eee !important;
    color: #000 !important;
  }
}

