/* ============================================================
   WACC CALCULATOR STYLES (Weighted Average Cost of Capital)
   Tradesala ToolSpot | Gold & Amber Premium Wealth Theme
   ============================================================ */

.container {
  --tool-fire: #d97706; /* Amber / Gold standard */
  --tool-fire-soft: rgba(217, 119, 6, 0.12);
  --tool-danger: #ef4444;
  --tool-danger-soft: rgba(239, 68, 68, 0.12);
  --tool-red: #d97706;
  --tool-red-soft: rgba(217, 119, 6, 0.12);
}

body.light .container {
  --tool-fire: #b45309; /* Deep Amber for light mode contrast */
  --tool-fire-soft: rgba(180, 83, 9, 0.08);
  --tool-red: #b45309;
  --tool-red-soft: rgba(180, 83, 9, 0.08);
}

/* Collapsible / Expandable CAPM Section transition */
.capm-section {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
}

.capm-section.show {
  max-height: 500px;
  opacity: 1;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

body.light .capm-section.show {
  border-top-color: rgba(0, 0, 0, 0.06);
}

/* Modern Slide Switch Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 20px;
  margin-bottom: 8px;
  transition: all 0.25s ease;
}

.toggle-row:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(217, 119, 6, 0.2);
}

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

body.light .toggle-row:hover {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(180, 83, 9, 0.15);
}

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

.toggle-label span:first-child {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.toggle-label span:last-child {
  font-size: 11px;
  color: var(--text-3);
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  flex-shrink: 0;
}

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

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 34px;
  border: 1px solid var(--glass-border);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .switch-slider {
  background-color: var(--tool-fire);
}

input:checked + .switch-slider:before {
  transform: translateX(22px);
}

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

body.light input:checked + .switch-slider {
  background-color: var(--tool-fire);
}

/* ── KPI Grid & Status Banner Styles ── */
.wacc-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 640px) {
  .wacc-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-span-full {
  grid-column: 1 / -1;
}

/* ── WACC Gold / Amber Hero Card ── */
.kpi-card.hero.amber {
  box-shadow: 0 8px 32px rgba(217, 119, 6, 0.15);
  border-color: rgba(217, 119, 6, 0.3);
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.1) 0%, rgba(217, 119, 6, 0.02) 100%);
  transition: all 0.3s ease;
}

.kpi-card.hero.amber .kpi-val {
  color: var(--tool-fire) !important;
  text-shadow: 0 0 20px rgba(217, 119, 6, 0.2);
}

.kpi-card.hero.amber .kpi-label {
  color: rgba(253, 230, 138, 0.8) !important; /* Soft gold text for dark mode */
}

body.light .kpi-card.hero.amber {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.08) 0%, rgba(217, 119, 6, 0.02) 100%);
  border-color: rgba(217, 119, 6, 0.2);
}

body.light .kpi-card.hero.amber .kpi-val {
  color: var(--tool-fire) !important;
  text-shadow: none;
}

body.light .kpi-card.hero.amber .kpi-label {
  color: #78350f !important; /* Deep gold for light mode */
}

/* ── Tab Controls (Chart toggles) ── */
.chart-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 3px;
}

body.light .chart-toggle {
  background: rgba(0, 0, 0, 0.02);
}

.chart-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-toggle-btn.active {
  background: var(--tool-fire);
  color: #ffffff !important;
}

body.light .chart-toggle-btn.active {
  background: var(--tool-fire);
}

/* ── Amortization Table Styles ── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.015);
  margin-top: 16px;
  -webkit-overflow-scrolling: touch;
}

body.light .table-wrap {
  background: rgba(0, 0, 0, 0.005);
  border-color: rgba(0, 0, 0, 0.08);
}

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

.projection-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 8px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 2px solid rgba(217, 119, 6, 0.15);
}

body.light .projection-table th {
  background: rgba(0, 0, 0, 0.02);
  color: #444;
  border-bottom-color: rgba(217, 119, 6, 0.12);
}

.projection-table td {
  padding: 10px 8px;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

body.light .projection-table td {
  color: #333;
  border-bottom-color: rgba(0, 0, 0, 0.035);
}

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

.projection-table th:first-child,
.projection-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.projection-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.008);
}

body.light .projection-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.01);
}

.projection-table tr:hover td {
  background: rgba(217, 119, 6, 0.07) !important;
}

body.light .projection-table tr:hover td {
  background: rgba(217, 119, 6, 0.04) !important;
}

.text-success {
  color: #10b981 !important;
}

body.light .text-success {
  color: #059669 !important;
}

.text-danger {
  color: #f87171 !important;
}

body.light .text-danger {
  color: #dc2626 !important;
}

/* ── Status Banner Viability Modes ── */
.status-banner {
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid transparent;
}

.status-banner.achieved {
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.25);
  color: #fde68a;
}

.status-banner.warning {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

body.light .status-banner.achieved {
  background: rgba(217, 119, 6, 0.06);
  border-color: rgba(217, 119, 6, 0.2);
  color: #78350f;
}

body.light .status-banner.warning {
  background: rgba(239, 68, 68, 0.04);
  border-color: rgba(239, 68, 68, 0.15);
  color: #7f1d1d;
}

@media (max-width: 520px) {
  .hide-mobile {
    display: none !important;
  }
}

/* ── Mobile Layout Adjustments (Width <= 768px) ── */
@media (max-width: 768px) {
  .container {
    padding: 0 12px 60px !important;
  }

  .panel {
    padding: 16px 12px !important;
    border-radius: 16px !important;
  }

  .input-header label {
    font-size: 13px !important;
  }
  
  .value-badge {
    font-size: 12px !important;
    padding: 3px 8px !important;
  }

  .projection-table th, 
  .projection-table td {
    padding: 8px 6px !important;
    font-size: 11.5px !important;
  }
}
