/* [BLOCK SHARED-THEME-COMPAT] Legacy RetireWhen theme stylesheet path */
@import url("../shared/retirewhen-theme.css");

/* [BLOCK RETIREWHEN-CALCULATION-METHOD] Concise target-method explainer */
.calculation-method-note {
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.45;
}

.calculation-method-note strong {
  font-weight: 700;
}

.calculation-method-note ul {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-left: 1.15rem;
}

.calculation-method-note li {
  margin: 0;
}

/* [BLOCK RETIREWHEN-BASE-CHART-HEADING] Label the current-input chart */
.base-chart-heading {
  margin: 28px 0 12px;
  color: var(--dark);
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
}

/* [BLOCK RETIREWHEN-FINANCIAL-DETAILS-SECTIONS] Improve first-tile section scanning */
.financial-details-card > .disclaimer {
  margin-bottom: 20px;
}

.financial-details-card > .input-group {
  margin-bottom: 0;
  padding-top: 16px;
}

.financial-details-card > .input-group + .input-group {
  margin-top: 16px;
  border-top: 1px solid rgba(139, 90, 43, 0.16);
}

.financial-details-card > .retirement-mode-group,
.financial-details-card > .schedule-group,
.financial-details-card > .emi-obligations-group {
  padding: 14px 0 16px 14px;
  border-left: 3px solid rgba(139, 90, 43, 0.55);
  background: linear-gradient(90deg, rgba(139, 90, 43, 0.06), rgba(249, 245, 235, 0) 70%);
}

.financial-details-card > .schedule-group,
.financial-details-card > .emi-obligations-group {
  margin-top: 20px;
}

.financial-details-card > .input-group > label,
.financial-details-card > .input-group > .schedule-header-row,
.financial-details-card > .input-group > .emi-header-row,
.financial-details-card > .input-group > .retirement-mode-title {
  margin-bottom: 8px;
}

.financial-details-card > .input-group > label + div[style*="font-size:0.9em"],
.financial-details-card > .input-group > .schedule-header-row + div[style*="font-size:0.9em"],
.financial-details-card > .input-group > .emi-header-row + div[style*="font-size:0.9em"] {
  margin-bottom: 8px;
}

/* [BLOCK RETIREWHEN-RESPONSIVE-CHART-HEIGHT] Grow the result chart into spare desktop space */
@media (min-width: 769px) {
  #calculator > .card .chart-container {
    flex: 1 1 clamp(320px, 36vh, 560px);
    min-height: clamp(320px, 36vh, 560px);
    max-height: 720px;
    max-width: 100%;
  }

  #financeChart {
    width: 100% !important;
    height: 100% !important;
  }
}

/* [BLOCK RETIREWHEN-MATCHED-CARD-SCROLL] Keep the input tile level with the result tile */
@media (min-width: 769px) {
  #calculator {
    align-items: start;
  }

  #calculator > .card {
    height: auto;
  }

  #calculator > .financial-details-card {
    max-height: var(--retirewhen-journey-card-height, calc(100vh - 80px));
    overflow-y: auto;
    overscroll-behavior-y: auto;
    padding-right: 18px;
    scrollbar-gutter: stable;
    scrollbar-width: auto;
    scrollbar-color: #8b5a2b rgba(139, 90, 43, 0.14);
  }

  #calculator > .financial-details-card::-webkit-scrollbar {
    width: 18px;
  }

  #calculator > .financial-details-card::-webkit-scrollbar-thumb {
    border-radius: 999px;
    border: 4px solid rgba(249, 245, 235, 0.96);
    background: linear-gradient(180deg, #8b5a2b, #5d4037);
  }

  #calculator > .financial-details-card::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(139, 90, 43, 0.12);
  }
}

@media (max-width: 768px) {
  #calculator > .financial-details-card {
    max-height: none;
    overflow-y: visible;
    padding-right: 20px;
  }
}

/* [BLOCK RETIREWHEN-RECOMMENDATION-AND-IMPORT] Clear replacement-plan guidance and report import drop */
.investment-recommendation-content {
  display: grid;
  gap: 8px;
  text-align: left;
}

.investment-recommendation-content strong {
  display: block;
  text-align: center;
}

.investment-recommendation-content ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.92rem;
  line-height: 1.35;
  text-shadow: none;
}

.report-import-overlay {
  align-items: center;
  background: rgba(49, 38, 9, 0.72);
  color: #fffaf0;
  display: none;
  font-size: clamp(1.1rem, 3vw, 1.8rem);
  font-weight: 700;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  text-align: center;
  z-index: 9999;
}

body.report-import-active .report-import-overlay {
  display: flex;
}

.schedule-rows:empty,
.emi-rows:empty {
  display: none;
}

/* [BLOCK RETIREWHEN-EMI-OBLIGATIONS] Temporary fixed loan obligation inputs */
.retirement-mode-group,
.schedule-group,
.emi-obligations-group {
  display: grid;
  gap: 10px;
}

.retirement-mode-title {
  color: var(--dark);
  font-weight: 700;
}

.schedule-header-row,
.emi-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.schedule-add-btn,
.schedule-remove-btn,
.emi-add-btn,
.emi-remove-btn {
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: rgba(249, 245, 235, 0.92);
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.schedule-add-btn,
.emi-add-btn {
  width: 34px;
  height: 34px;
  font-size: 1.35rem;
}

.schedule-remove-btn,
.emi-remove-btn {
  border-color: rgba(196, 32, 32, 0.72);
  background: rgba(246, 201, 201, 0.22);
  color: #8c1616;
  padding: 7px 12px;
  font-size: 0.85rem;
  justify-self: start;
}

.schedule-remove-btn:hover,
.emi-remove-btn:hover {
  background: rgba(246, 201, 201, 0.38);
  border-color: rgba(196, 32, 32, 0.9);
}

/* [BLOCK RETIREWHEN-SCHEDULE-INPUT-LAYOUT] Shared control tracks and tile-width responsive rows */
.schedule-rows,
.emi-rows {
  container-type: inline-size;
  container-name: calculator-fields;
  display: grid;
  gap: 12px;
  max-height: clamp(280px, 42vh, 430px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

.expense-rows,
.investment-rows {
  max-height: clamp(190px, 30vh, 320px);
}

.schedule-rows::-webkit-scrollbar,
.emi-rows::-webkit-scrollbar {
  width: 8px;
}

.schedule-rows::-webkit-scrollbar-thumb,
.emi-rows::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(139, 90, 43, 0.45);
}

.schedule-rows::-webkit-scrollbar-track,
.emi-rows::-webkit-scrollbar-track {
  background: transparent;
}

.schedule-row,
.emi-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(249, 245, 235, 0.66);
}

.expense-row > .schedule-money-field,
.investment-row > .schedule-money-field {
  grid-column: 1 / -1;
}

.schedule-money-field {
  min-width: 0;
}

.financial-details-card .input-with-currency {
  align-items: stretch;
  min-height: 46px;
  min-width: 0;
}

.financial-details-card .currency-symbol {
  align-items: center;
  display: inline-flex;
  flex: 0 0 64px;
  justify-content: center;
  min-height: 46px;
  padding: 0 10px;
}

.financial-details-card .input-with-currency input {
  flex: 1 1 0;
  height: auto;
  min-height: 46px;
  min-width: 0;
  width: auto;
}

.schedule-field > input,
.emi-field > input,
.emi-duration-fields > input {
  height: auto;
  min-height: 46px;
}

.schedule-remove-btn,
.emi-remove-btn {
  grid-column: 1 / -1;
}

.schedule-row-error,
.emi-row-error {
  border-color: rgba(196, 32, 32, 0.72);
  background: rgba(246, 201, 201, 0.18);
}

.schedule-row-title,
.emi-row-title {
  grid-column: 1 / -1;
  color: var(--dark);
  font-weight: 700;
}

.schedule-field,
.emi-field {
  display: grid;
  min-width: 0;
  gap: 5px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(2.55rem, auto) minmax(46px, auto) auto;
  align-self: stretch;
  align-content: start;
}

@supports (grid-template-rows: subgrid) {
  .schedule-field,
  .emi-field {
    grid-template-rows: subgrid;
    grid-row: span 3;
  }
}

.schedule-field label,
.emi-field label {
  align-items: flex-end;
  min-height: 2.55rem;
  min-width: 0;
  margin: 0;
  color: var(--secondary);
  display: flex;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.field-note {
  color: rgba(78, 52, 46, 0.68);
  display: block;
  font-size: 0.72rem;
  line-height: 1.25;
  min-height: 1.8em;
  min-width: 0;
  overflow-wrap: anywhere;
}

.emi-duration-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.schedule-row input,
.emi-row input {
  min-width: 0;
}

.schedule-field-error label,
.emi-field-error label {
  color: #b81f1f;
}

.schedule-field-error input,
.schedule-field-error .input-with-currency,
.emi-field-error input,
.emi-field-error .input-with-currency {
  border-color: rgba(196, 32, 32, 0.78) !important;
  box-shadow: 0 0 0 2px rgba(196, 32, 32, 0.12);
}

.schedule-status,
.emi-status {
  padding: 10px 12px;
  border: 1px solid rgba(139, 90, 43, 0.28);
  border-radius: 8px;
  background: rgba(249, 245, 235, 0.72);
  color: var(--dark);
  font-size: 0.9rem;
  line-height: 1.35;
}

.schedule-status-error,
.emi-status-error {
  border-color: rgba(196, 32, 32, 0.72);
  background: rgba(246, 201, 201, 0.32);
  color: #b81f1f;
  font-weight: 700;
}

.download-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* [BLOCK RETIREWHEN-FIRST-TILE-CARD-FIT] Keep first-tile utility cards fully visible */
.financial-details-card .metric-card,
.financial-details-card .wisdom-text {
  max-width: 100%;
  overflow: visible;
  overflow-x: visible;
}

.financial-details-card .metric-value {
  overflow: visible;
}

@container calculator-fields (min-width: 240px) {
  .expense-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container calculator-fields (min-width: 300px) {
  .investment-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container calculator-fields (min-width: 380px) {
  .emi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container calculator-fields (min-width: 440px) {
  .expense-row {
    grid-template-columns: minmax(180px, 1.8fr) repeat(2, minmax(76px, 1fr));
  }

  .expense-row > .schedule-money-field {
    grid-column: auto;
  }
}

@container calculator-fields (min-width: 500px) {
  .investment-row {
    grid-template-columns: minmax(190px, 2.25fr) repeat(3, minmax(76px, 1fr));
  }

  .investment-row > .schedule-money-field {
    grid-column: auto;
  }
}

/* [BLOCK RETIREWHEN-TARGET-METHOD] Local target method controls */
.target-method-group {
  display: grid;
  gap: 10px;
}

.target-method-title {
  color: var(--dark);
  font-weight: 700;
}

.target-method-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(249, 245, 235, 0.72);
  color: var(--dark);
  cursor: pointer;
}

.input-group .target-method-option input[type="radio"],
.target-method-option input[type="radio"] {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  min-height: 18px !important;
  max-width: 18px;
  margin-top: 2px;
  padding: 0;
  border: initial;
  border-radius: 50%;
  appearance: auto;
  -webkit-appearance: radio;
  accent-color: var(--primary);
  box-shadow: none;
  background: initial;
}

.target-method-option strong,
.target-method-option small {
  display: block;
}

.target-method-option small {
  margin-top: 3px;
  color: var(--secondary);
  font-size: 0.88rem;
  font-weight: 400;
}
