/* ============================================================
   Pension Planning Tool — EPW-PRO-099
   Irish Pension Tax Engine UI Styles
   ============================================================ */

#pension-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.pension-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px;
}

/* ---- Section Cards ---- */
.pension-section {
  margin-bottom: 24px;
}

.pension-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 2px solid #7C3AED;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.pension-section-title {
  color: #7C3AED;
  margin: 0;
  font-size: 1rem;
}

/* ---- Pension Pot Cards ---- */
.pension-pot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.pension-pot-card {
  background: white;
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 12px;
  padding: 16px;
  transition: box-shadow 0.2s;
}

.pension-pot-card:hover {
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.12);
}

.pension-pot-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.pension-pot-name {
  font-weight: 700;
  font-size: 1rem;
  color: #1E293B;
}

.pension-pot-value {
  font-weight: 800;
  font-size: 1.2rem;
  color: #7C3AED;
}

.pension-pot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.pension-pot-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.pension-pot-badge.ie { background: #DCFCE7; color: #166534; }
.pension-pot-badge.uk { background: #DBEAFE; color: #1E40AF; }
.pension-pot-badge.prsa { background: #F3E8FF; color: #7C3AED; }
.pension-pot-badge.occ { background: #FEF3C7; color: #92400E; }
.pension-pot-badge.arf { background: #CCFBF1; color: #0D9488; }

.pension-pot-detail {
  font-size: 0.8rem;
  color: #64748B;
  line-height: 1.6;
}

.pension-pot-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ---- Quick Calculator ---- */
.pension-calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.pension-calc-panel {
  background: white;
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 12px;
  padding: 20px;
}

.pension-calc-panel h4 {
  margin: 0 0 14px 0;
  color: #7C3AED;
  font-size: 0.9rem;
}

.pension-calc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.pension-calc-row label {
  width: 160px;
  font-size: 0.82rem;
  color: #475569;
  font-weight: 500;
}

.pension-calc-row input, .pension-calc-row select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-size: 0.85rem;
}

.pension-calc-result {
  background: rgba(124, 58, 237, 0.04);
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 8px;
  padding: 14px;
  margin-top: 14px;
}

.pension-result-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.85rem;
}

.pension-result-row.total {
  font-weight: 700;
  border-top: 1px solid rgba(124, 58, 237, 0.2);
  padding-top: 8px;
  margin-top: 4px;
}

/* ---- Projection Table ---- */
.pension-projection-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.pension-projection-table th {
  background: rgba(124, 58, 237, 0.08);
  color: #7C3AED;
  padding: 8px 6px;
  text-align: right;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.pension-projection-table th:first-child { text-align: left; }

.pension-projection-table td {
  padding: 6px;
  text-align: right;
  border-bottom: 1px solid #F1F5F9;
}

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

.pension-projection-table tr.accumulation { color: #64748B; }
.pension-projection-table tr.fund_exhausted td { color: #EF4444; font-style: italic; }
.pension-projection-table tr:hover { background: rgba(124, 58, 237, 0.03); }

/* ---- SFT Gauge ---- */
.sft-gauge {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: white;
  border-radius: 12px;
  border: 1px solid rgba(124, 58, 237, 0.12);
}

.sft-gauge-bar {
  flex: 1;
  height: 24px;
  background: #F1F5F9;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.sft-gauge-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.5s ease;
}

.sft-gauge-label {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 80px;
  text-align: right;
}

/* ---- Monte Carlo ---- */
.mc-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.mc-stat-card {
  background: white;
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.mc-stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #7C3AED;
}

.mc-stat-label {
  font-size: 0.75rem;
  color: #64748B;
  margin-top: 4px;
}

/* ---- Buttons ---- */
.pension-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.08);
  color: #7C3AED;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.pension-btn:hover {
  background: rgba(124, 58, 237, 0.15);
}

.pension-btn.primary {
  background: #7C3AED;
  color: white;
  border-color: #7C3AED;
}

.pension-btn.primary:hover {
  background: #6D28D9;
}

.pension-btn.danger {
  border-color: rgba(239, 68, 68, 0.3);
  color: #EF4444;
  background: rgba(239, 68, 68, 0.06);
}

/* ---- Add Pot Form ---- */
.pension-add-form {
  background: white;
  border: 2px dashed rgba(124, 58, 237, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
  display: none;
}

.pension-add-form.visible { display: block; }

.pension-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pension-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pension-form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
}

.pension-form-group input, .pension-form-group select {
  padding: 7px 10px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-size: 0.85rem;
}

/* ---- Tooltips ---- */
.pen-tip {
  position: relative;
  border-bottom: 1px dotted #7C3AED;
  cursor: help;
  color: inherit;
}

.pen-tip .pen-tip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1E293B;
  color: #F8FAFC;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
  width: max-content;
  max-width: 320px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.pen-tip .pen-tip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1E293B;
}

.pen-tip:hover .pen-tip-text {
  display: block;
}

/* Prevent left-edge cutoff for tooltips near the viewport edge */
.pension-pot-badge.pen-tip .pen-tip-text,
.pension-pot-meta .pen-tip .pen-tip-text {
  left: 0;
  transform: none;
}

.pension-pot-badge.pen-tip .pen-tip-text::after,
.pension-pot-meta .pen-tip .pen-tip-text::after {
  left: 16px;
  transform: none;
}

/* ---- Drawdown Modeler (PRO-282) ---- */
.dd-scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.dd-scenario-card {
  background: white;
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dd-scenario-card.active {
  border-color: #7C3AED;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.dd-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.dd-matrix-table th {
  background: rgba(124, 58, 237, 0.08);
  color: #7C3AED;
  padding: 8px 10px;
  text-align: center;
  font-weight: 600;
}

.dd-matrix-table td {
  padding: 7px 10px;
  text-align: center;
  border-bottom: 1px solid #F1F5F9;
}

.dd-matrix-cell-green {
  background: rgba(22, 163, 74, 0.08);
  color: #16A34A;
  font-weight: 600;
}

.dd-matrix-cell-amber {
  background: rgba(217, 119, 6, 0.08);
  color: #D97706;
  font-weight: 600;
}

.dd-matrix-cell-red {
  background: rgba(239, 68, 68, 0.08);
  color: #EF4444;
  font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .pension-calc-grid { grid-template-columns: 1fr; }
  .mc-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pension-form-grid { grid-template-columns: 1fr; }
  .dd-scenario-grid { grid-template-columns: 1fr; }
}
