/* ============================================================
   LOAN COMPARISON CALCULATOR STYLES
   Tradesala ToolSpot | Premium Aesthetic
   ============================================================ */

/* ── Page Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 100px;
  position: relative;
  z-index: 1;
  /* Tool Specific Palette */
  --tool-indigo: #6366f1;
  --tool-emerald: #10b981;
  --tool-red: #fb7185;
}

/* ── Main Two-Column Grid -> Converted to Unified Flow ── */
.main-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
  animation: fadeUp 0.6s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.left-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.sync-panel, .prepayment-panel, .breakdown-panel {
  grid-column: 1 / -1;
}

.right-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.insights-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ── Standard Panel ── */
.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.22), 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: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

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

/* ── Input Groups ── */
.input-group {
  margin-bottom: 28px;
}
.input-group:last-child {
  margin-bottom: 0;
}
.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}
.input-header label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  flex: 1;
}

/* ── 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(--text-3) 0%, var(--text-3) 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(--text-3);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05), 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); }

#panel-a .range-slider { background: linear-gradient(to right, var(--tool-indigo) 0%, var(--tool-indigo) var(--fill, 40%), rgba(255, 255, 255, 0.1) var(--fill, 40%), rgba(255, 255, 255, 0.1) 100%); }
#panel-a .range-slider::-webkit-slider-thumb { border-color: var(--tool-indigo); box-shadow: 0 0 0 4px rgba(99,102,241,0.15), 0 2px 8px rgba(0,0,0,0.3); }

#panel-b .range-slider { background: linear-gradient(to right, var(--tool-emerald) 0%, var(--tool-emerald) var(--fill, 40%), rgba(255, 255, 255, 0.1) var(--fill, 40%), rgba(255, 255, 255, 0.1) 100%); }
#panel-b .range-slider::-webkit-slider-thumb { border-color: var(--tool-emerald); box-shadow: 0 0 0 4px rgba(16,185,129,0.15), 0 2px 8px rgba(0,0,0,0.3); }

.prepayment-panel .range-slider { background: linear-gradient(to right, #fb7185 0%, #fb7185 var(--fill, 0%), rgba(255, 255, 255, 0.1) var(--fill, 0%), rgba(255, 255, 255, 0.1) 100%); }
.prepayment-panel .range-slider::-webkit-slider-thumb { border-color: #fb7185; box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.15), 0 2px 8px rgba(0,0,0,0.3); }

/* ── Sync Panel & Toggles ── */
.sync-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.sync-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border: 1px solid rgba(255,255,255,0.2);
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  background-color: var(--text-2);
  transition: .4s;
}
input:checked + .slider {
  background-color: var(--tool-indigo);
  border-color: var(--tool-indigo);
}
input:checked + .slider:before {
  transform: translateX(22px);
  background-color: #fff;
}
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

body.light .slider { background-color: #e5e7eb; border-color: #d1d5db; }
body.light .slider:before { background-color: #9ca3af; }

/* ── Panel Styles ── */
.loan-panel {
  margin-bottom: 24px;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
}
#panel-a { border-left-color: var(--tool-indigo); }
#panel-b { border-left-color: var(--tool-emerald); }

.value-badge {
  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;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
#panel-a .value-badge { border-color: rgba(99,102,241,0.25); }
#panel-b .value-badge { border-color: rgba(16,185,129,0.25); }

/* Fee Grid */
.fee-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  align-items: end;
}

/* Syncable fields visualization */
.syncable .input-header label {
  position: relative;
}
.syncable.is-synced {
  opacity: 0.6;
  pointer-events: none;
  filter: grayscale(1);
}

/* ── Verdict Banner ── */
.verdict-banner {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.verdict-banner.winner-a { background: rgba(99, 102, 241, 0.08); border-color: var(--tool-indigo); box-shadow: 0 0 30px rgba(99,102,241,0.15); }
.verdict-banner.winner-b { background: rgba(16, 185, 129, 0.08); border-color: var(--tool-emerald); box-shadow: 0 0 30px rgba(16,185,129,0.15); }
.verdict-banner.winner-tie { background: rgba(255, 255, 255, 0.05); border-color: rgba(255,255,255,0.1); box-shadow: none; }

.v-icon {
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}
.v-content h2 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.winner-a .v-content h2 { color: var(--tool-indigo); }
.winner-b .v-content h2 { color: var(--tool-emerald); }
.winner-tie .v-content h2 { color: var(--text-1); }
.v-content p {
  margin: 0;
  font-size: 1rem;
  color: var(--text-2);
  line-height: 1.4;
}

/* ── Comparison Table ── */
.comparison-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.compare-table th, .compare-table td {
  padding: 12px 16px;
  text-align: right;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.compare-table th:first-child, .compare-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
}
.compare-table th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 16px;
  color: var(--text-3);
}
.compare-table th.col-a { color: var(--tool-indigo); }
.compare-table th.col-b { color: var(--tool-emerald); }
.compare-table td.col-a { font-weight: 700; color: var(--text-1); }
.compare-table td.col-b { font-weight: 700; color: var(--text-1); }

.compare-table .highlight-row td { background: rgba(255, 255, 255, 0.03); }
.compare-table .total-row td {
  font-size: 16px;
  font-weight: 800;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.amort-table th, .amort-table td {
  padding: 12px 16px;
  font-size: 12px;
}
.amort-table td.year-col {
  text-align: center;
  font-weight: 700;
  color: var(--text-2);
  background: rgba(255,255,255,0.02);
  border-right: 1px solid var(--border);
}
.amort-table td.sub-col-a { color: var(--text-2); text-align: right; }
.amort-table td.sub-col-b { color: var(--text-2); text-align: right; }

.val-win { color: var(--tool-emerald) !important; }
.val-lose { color: var(--tool-red) !important; }

/* ── Premium Select ── */
.premium-select {
  width: 100%;
  appearance: none;
  background-color: rgba(255, 255, 255, 0.05);
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%239CA3AF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px top 50%;
  background-size: 10px auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-2);
  padding: 8px 32px 8px 12px;
  border-radius: 8px;
  font-family: 'Figtree', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.3s;
}
.premium-select:focus {
  border-color: rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.08);
}

/* ── Insights Cards ── */
.insights-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.insight-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.i-icon { font-size: 28px; line-height: 1; }
.i-text h4 {
  margin: 0 0 8px 0;
  font-size: 1rem;
  color: var(--text-1);
}
.i-text p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.5;
}

/* ── Action Buttons ── */
.action-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
.action-btn {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  border-radius: 14px;
  font-family: 'Figtree', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.action-btn:active { transform: scale(0.96); }
.action-btn .btn-icon { transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1); }
.action-btn:hover .btn-icon { transform: translateY(-1px); }

.copy-btn:hover { border-color: var(--tool-emerald); background: rgba(16, 185, 129, 0.06); color: var(--tool-emerald); box-shadow: 0 4px 15px rgba(16, 185, 129, 0.15); }
.share-btn:hover { border-color: var(--tool-indigo); background: rgba(99, 102, 241, 0.06); color: var(--tool-indigo); box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15); }
.pdf-btn:hover { background: rgba(99, 102, 241, 0.15) !important; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2); }

/* ── Light Mode Overrides ── */
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.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(--text-3) 0%, var(--text-3) var(--fill, 40%), rgba(0, 0, 0, 0.08) var(--fill, 40%), rgba(0, 0, 0, 0.08) 100%);
}
body.light .prepayment-panel .range-slider {
  background: linear-gradient(to right, #fb7185 0%, #fb7185 var(--fill, 0%), rgba(0, 0, 0, 0.08) var(--fill, 0%), rgba(0, 0, 0, 0.08) 100%);
}
body.light .range-slider::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), 0 2px 8px rgba(0, 0, 0, 0.15);
}
body.light .prepayment-panel .range-slider::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.15), 0 2px 8px rgba(0, 0, 0, 0.15);
}
body.light .value-badge { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
body.light #panel-a .value-badge { background: #e0e7ff; color: #4f46e5; border-color: rgba(79,70,229,0.25); }
body.light #panel-b .value-badge { background: #dcfce7; color: #15803d; border-color: rgba(21,128,61,0.25); }
body.light .premium-select {
  background-color: #f9fafb;
  border-color: #d1d5db;
  color: #374151;
}
body.light .premium-select:focus {
  border-color: #9ca3af;
  background-color: #ffffff;
}
body.light .sync-panel { background: #f3f4f6; border-color: #e5e7eb; }
body.light .verdict-banner.winner-tie { background: #f9fafb; border-color: #e5e7eb; }
body.light .compare-table th, body.light .compare-table td { border-bottom-color: #f3f4f6; }
body.light .compare-table tr.total-row td { border-top-color: #e5e7eb; }
body.light .compare-table tr.highlight-row td { background: #f9fafb; }
body.light .insight-card { background: #ffffff; border-color: #e5e7eb; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
body.light .action-btn { background: #ffffff; border-color: #e5e7eb; color: #4b5563; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02); }

/* ── Mobile Responsive ── */
@media (max-width: 1024px) {
  .insights-chart-row { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .insights-panel { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .left-col { grid-template-columns: 1fr; }
  .fee-grid { grid-template-columns: 1fr; gap: 0; }
  .action-row { flex-direction: column; }
}
