* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue: #0868ff;
  --green: #1c913d;
  --light-blue: #f1f6ff;
  --border: #dedede;
  --text: #111;
  --muted: #656565;
}

/* body {
  font-family: "Poppins", sans-serif;
  background: #fff;
  color: var(--text);
  padding: 10px;
} */

/* MAIN CONTAINER */

.calculator {
  /* width: 100%;
  max-width: 1180px;
  min-height: 580px; */
  margin: auto;
  display: grid;
  grid-template-columns: 45% 55%;
  border: 1px solid #ddd;
  border-radius: 14px;
  overflow: hidden;
  background: white;
}


/* LEFT */

.left-panel {
  border-right: 1px solid #e6e6e6;
}

.main-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #ddd;
}

.main-tab {
  min-height: 58px;
  border: none;
  background: white;
  /* font-family: inherit; */
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 12px;
  border-bottom: 2px solid transparent;
  transition: .2s;
}

.main-tab.active {
  color: var(--blue);
  background: var(--light-blue);
  border-bottom-color: var(--blue);
}

.controls {
  padding: 18px 32px 35px;
}

.investment-types {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.type-btn {
  border: 1px solid #ddd;
  background: white;
  border-radius: 24px;
  padding: 2px 14px;
  /* font-family: inherit; */
  cursor: pointer;
  color: #555;
}

.type-btn.active {
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 600;
}

.control-block {
  margin-bottom: 20px;
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: -2px;
  color: var(--muted);
  font-size: 13px;
}

.input-value {
  color: #111;
  display: flex;
  white-space: nowrap;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 600;
}

.input-value input {
  border: none;
  border-bottom: 1px solid #ccc;
  outline: none;
  background: transparent;
  width: 100px;
  text-align: right;
  font: inherit;
  font-weight: 600;
}

#yearsInput,
#returnInput,
#stepInput {
  width: 48px;
}

/* RANGE */

.range {
  --progress: 50%;
  width: 100%;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 10px;
  outline: none;
  background:
    linear-gradient(
      to right,
      var(--blue) 0%,
      var(--blue) var(--progress),
      #dfdfdf var(--progress),
      #dfdfdf 100%
    );
}

.range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--blue);
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 0 0 3px white;
}

.range::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 2px solid var(--blue);
  background: white;
  border-radius: 50%;
  cursor: pointer;
}

.range-labels {
    margin-top: -5px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #555;
}


/* RIGHT */

.right-panel {
  background: #fafbfc;
  padding: 25px 55px;
}

.step-toggle {
  margin: 0 auto 10px;
  padding: 5px;
  width: max-content;
  display: flex;
  border: 1px solid #ddd;
  border-radius: 30px;
  background: white;
}

.step-btn {
  border: none;
  border-radius: 23px;
  background: transparent;
  /* font-family: inherit; */
  padding: 2px 22px;
  cursor: pointer;
  font-weight: 500;
}

.step-btn.active {
  background: var(--blue);
  color: white;
}

.summary {
  background: white;
  min-height: 90px;
  border: 1px solid #ddd;
  border-radius: 13px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  text-align: center;
  font-size: 12px;
}

.summary-item strong {
  font-size: 18px;
}

.summary-item.highlight {
  color: #058b36;
  background: #f2faf5;
  padding: 10px 14px;
  border-radius: 10px;
}

.symbol {
  font-size: 23px;
}


/* CHART */

.chart-card {
  background: white;
  height: 305px;
  margin-top: 8px;
  padding: 26px 40px 10px;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.chart {
  position: relative;
  height: 220px;
  border-bottom: 1px solid #ddd;
}

.grid-lines {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.grid-lines span {
  border-top: 1px dashed #e1e1e1;
}

.bars {
  position: absolute;
  inset: 0 10%;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
}

.bar-column {
  height: 100%;
  width: 30%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-direction: column;
}

.bar {
  width: 57px;
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height .4s ease;
}

.blue {
  background: var(--blue);
}

.green {
  background: var(--green);
}

.bar-value {
  background: white;
  border: 1px solid #ddd;
  box-shadow: 0 1px 5px rgba(0,0,0,.1);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  margin-bottom: 4px;
  white-space: nowrap;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-top: 15px;
  font-size: 10px;
  color: #555;
}

.legend > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 13px;
  height: 13px;
  display: inline-block;
}

.blue-box {
  background: var(--blue);
}

.green-box {
  background: var(--green);
}


/* CTA */

.cta {
  width: 88%;
  display: block;
  margin: 25px auto 0;
  height: 50px;
  border: none;
  border-radius: 4px;
  background: var(--blue);
  color: white;
  /* font-family: inherit; */
  font-size: 14px;
  cursor: pointer;
}

.cta span {
  font-size: 24px;
  margin-left: 8px;
  vertical-align: -2px;
}

.hidden {
  display: none !important;
}


/* TABLET */

@media (max-width: 900px) {

  body {
    padding: 8px;
  }

  .calculator {
    grid-template-columns: 1fr;
  }

  .left-panel {
    border-right: none;
    border-bottom: 1px solid #ddd;
  }

  .right-panel {
    padding: 25px 30px 35px;
  }

  .controls {
    padding: 22px 30px;
  }

  .chart-card {
    max-width: 650px;
    margin: 15px auto 0;
  }

  .summary {
    max-width: 650px;
    margin: auto;
  }
}


/* MOBILE */

@media (max-width: 600px) {

  body {
    padding: 0;
    background: #fafafa;
  }

  .calculator {
    border: none;
    border-radius: 0;
  }

  .main-tab {
    font-size: 12px;
    padding: 10px 6px;
  }

  .controls {
    padding: 20px 18px;
  }

  .investment-types {
    gap: 7px;
  }

  .type-btn {
    font-size: 11px;
    padding: 8px 11px;
  }

  .control-header {
    align-items: flex-start;
    font-size: 11px;
  }

  .input-value {
    font-size: 13px;
  }

  .input-value input {
    width: 75px;
  }

  .right-panel {
    padding: 20px 14px 30px;
  }

  .step-btn {
    padding: 8px 14px;
    font-size: 11px;
  }

  .summary {
    padding: 10px 7px;
    gap: 5px;
  }

  .summary-item {
    font-size: 9px;
  }

  .summary-item strong {
    font-size: 13px;
  }

  .summary-item.highlight {
    padding: 9px 7px;
  }

  .symbol {
    font-size: 16px;
  }

  .chart-card {
    height: 280px;
    padding: 20px 12px 10px;
  }

  .chart {
    height: 205px;
  }

  .bar {
    width: 43px;
  }

  .bar-value {
    font-size: 9px;
    padding: 3px 6px;
  }

  .legend {
    gap: 15px;
    font-size: 9px;
  }

  .cta {
    width: 100%;
    margin-top: 18px;
    font-size: 12px;
  }
}


/* VERY SMALL PHONES */

@media (max-width: 370px) {

  .main-tab {
    font-size: 10px;
  }

  .type-btn {
    padding: 7px 8px;
    font-size: 10px;
  }

  .summary-item strong {
    font-size: 11px;
  }

  .chart-card {
    padding-left: 5px;
    padding-right: 5px;
  }
}