/* =====================================
   GLOBAL RESET
===================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    Inter,
    system-ui,
    -apple-system,
    sans-serif;
  background: #f5f7fa;
  color: #202124;
  min-height: 100vh;
  padding: 40px 20px;
}

/* =====================================
   CALCULATOR CONTAINER
===================================== */

.calculator {
  max-width: 520px;
  margin: 0 auto;
  padding: 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* =====================================
   HEADER
===================================== */

.calculator-header {
  margin-bottom: 32px;
}

h1 {
  font-size: 28px;
  margin-bottom: 10px;
  font-weight: 700;
}

.calculator-header p {
  font-size: 14px;
  color: #777;
  line-height: 1.5;
}

/* =====================================
   INPUT GROUPS
===================================== */

.input-group {
  margin-bottom: 28px;
}

.input-group > label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: #444;
}

.input-group input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  margin-top: 14px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.input-group input[type="text"]:focus {
  border-color: #00a86b;
  box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.1);
}

.input-group input[type="range"] {
  display: block;
  width: 100%;
  accent-color: #00a86b;
  cursor: pointer;
}

/* =====================================
   AGE TIMELINE TOGGLE
===================================== */

.timeline-toggle {
  padding: 16px;
  background: #f7faf8;
  border: 1px solid #e5eee8;
  border-radius: 10px;
  margin-bottom: 28px;
}

.timeline-toggle > label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.timeline-toggle input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #00a86b;
  cursor: pointer;
  flex-shrink: 0;
}

/* =====================================
   AGE TIMELINE DATE FIELDS
===================================== */

#ageTimelineFields {
  margin-top: 20px;
}

#ageTimelineFields[hidden] {
  display: none;
}

.date-input-group {
  margin-bottom: 16px;
}

.date-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #444;
}

.date-input-group input[type="date"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
  color: #202124;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.date-input-group input[type="date"]:focus {
  border-color: #00a86b;
  box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.1);
}

.timeline-hint {
  color: #777;
  font-size: 12px;
  line-height: 1.6;
  margin-top: 4px;
}

/* =====================================
   INVESTMENT SUMMARY
===================================== */

#results {
  margin-top: 36px;
  padding: 24px;
  background: #f7faf8;
  border: 1px solid #e5eee8;
  border-radius: 12px;
}

#results h2 {
  font-size: 19px;
  margin-bottom: 22px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #e5eee8;
}

.result-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.result-item p {
  font-size: 14px;
  color: #666;
}

.result-item h3 {
  font-size: 17px;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

/* =====================================
   TOTAL VALUE
===================================== */

.total-value-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-top: 18px;
}

.total-value-item p {
  font-size: 14px;
  color: #666;
}

.total-value-item h3 {
  color: #00a86b;
  font-size: 26px;
  font-weight: 700;
  text-align: left;
  margin: 0;
  overflow-wrap: anywhere;
}

#totalValueWords {
  display: block;
  width: 100%;
  color: #777;
  font-size: 12px;
  line-height: 1.6;
  font-weight: 400;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* =====================================
   CHART SECTIONS
===================================== */

.chart-section,
.table-section {
  margin-top: 36px;
  padding: 22px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.chart-section h2,
.table-section h2 {
  font-size: 18px;
  margin-bottom: 20px;
}

.chart-section canvas {
  display: block;
  width: 100% !important;
  max-height: 300px;
}

/* =====================================
   MONTHLY PROJECTION TABLE
===================================== */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 13px;
}

th,
td {
  padding: 13px 12px;
  text-align: right;
  border-bottom: 1px solid #eee;
}

th {
  background: #f7faf8;
  font-weight: 600;
  color: #444;
}

th:first-child,
td:first-child {
  text-align: left;
}

tbody tr:hover {
  background: #f8faf9;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* =====================================
   FOOTER
===================================== */

.calculator-footer {
  margin-top: 28px;
  padding: 0 4px;
}

.calculator-footer p {
  font-size: 12px;
  line-height: 1.6;
  color: #888;
  text-align: center;
}

/* =====================================
   RESPONSIVE DESIGN
===================================== */

@media (max-width: 480px) {
  body {
    padding: 20px 12px;
  }

  .calculator {
    padding: 22px 18px;
    border-radius: 12px;
  }

  h1 {
    font-size: 24px;
  }

  .calculator-header {
    margin-bottom: 28px;
  }

  #results {
    padding: 18px;
  }

  .result-item h3 {
    font-size: 15px;
  }

  .total-value-item h3 {
    font-size: 24px;
  }

  .chart-section,
  .table-section {
    padding: 16px;
    margin-top: 24px;
  }

  .chart-section h2,
  .table-section h2 {
    font-size: 16px;
  }

  .timeline-toggle {
    padding: 14px;
  }

  th,
  td {
    padding: 11px 9px;
    font-size: 12px;
  }
}
#sipIncrementFields {
  margin-top: 20px;
}

#sipIncrementFields[hidden] {
  display: none;
}

#sipIncrementFields > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

#sipIncrementFields input[type="range"] {
  width: 100%;
  accent-color: #00a86b;
}

#sipIncrementFields input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  margin-top: 14px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  font-size: 16px;
}

.input-hint {
  margin-top: 8px;
  color: #888;
  font-size: 12px;
  line-height: 1.5;
}
