/* ==========================================================================
   Cellwatch ROI Calculator — [parameter_roi_calculator]
   Colors follow Divi's global palette (--gcid-*) with fallbacks.
   ========================================================================== */

.param-roi {
  --roi-primary:   var(--gcid-primary-color, #00c59e);
  --roi-secondary: var(--gcid-secondary-color, #202b30);
  --roi-gap: 15px;
  width: 100%;
}
.param-roi *,
.param-roi *::before,
.param-roi *::after { box-sizing: border-box; }

/* Shared row width (mirrors Divi's 80% / 1080px rows) */
.param-roi__panel,
.param-roi__actions,
.param-roi__results {
  width: 80%;
  max-width: 1080px;
  margin: 0 auto;
}

/* ---- Teal panel (inputs) ---------------------------------------------- */
.param-roi__panel {
  padding: 25px;
  background-color: var(--roi-primary);
  border-radius: 10px 10px 0 0;
}

.param-roi__title,
.param-roi__heading {
  margin: 0;
  padding: 0;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 5px;
  color: var(--roi-secondary);
}
.param-roi__title {
  font-weight: 900;
  font-size: 28px;
  line-height: 1;
  margin-bottom: 25px;
}
.param-roi__heading {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 5px;
}
.param-roi__grid + .param-roi__heading { margin-top: 25px; }

/* ---- Input grid: 2 columns of label/input pairs ----------------------- */
.param-roi__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--roi-gap) 3%;
}
.param-roi__field {
  display: grid;
  grid-template-columns: 3fr 2fr;
  align-items: center;
  column-gap: 8px;
}
.param-roi__field label {
  margin: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.1;
}
.param-roi__field input {
  width: 100%;
  padding: 5px;
  font-size: 18px;
  color: var(--roi-secondary);
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 0;
}
.param-roi__field input.is-invalid { border: 2px solid red; }

/* ---- Calculate / Reset buttons ---------------------------------------- */
.param-roi__actions {
  display: flex;
  margin-bottom: 50px;
  border-bottom-left-radius: 10px;
  overflow: hidden;
}
.param-roi__btn {
  flex: 1 1 50%;
  padding: 5px 0;
  text-align: center;
  text-decoration: none !important;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 4px;
  line-height: 1.7em;
  border: 3px solid var(--roi-primary);
  transition: background-color 300ms ease;
  cursor: pointer;
}
.param-roi__btn--calculate {
  background-color: var(--roi-primary);
  color: var(--roi-secondary) !important;
  border-bottom-left-radius: 5px;
}
.param-roi__btn--calculate:hover { background-color: #03e8bb; }
.param-roi__btn--reset {
  background-color: #212c31;
  color: var(--roi-primary) !important;
  border-bottom-right-radius: 10px;
}
.param-roi__btn--reset:hover { background-color: #384145; }

/* ---- Results (table + charts) ----------------------------------------- */
.param-roi__results {
  max-width: 1400px;
  padding: 2% 0;
  display: flex;
  gap: 30px 3%;
}
.param-roi__results[hidden] { display: none; }

.param-roi__table-col {
  flex: 1 1 31%;
  min-width: 360px;       /* keeps both table columns readable on mid-size screens */
  max-height: 1000px;
  overflow-y: scroll;
  scrollbar-color: var(--roi-primary) #fff;
  display: flex;
}
.param-roi__table { flex: 1 1 auto; min-width: 0; }

/* Vertical "Year N" tabs — each spans 12 table rows */
.param-roi__years {
  flex: 0 0 50px;
  align-self: flex-start;
  margin-top: 45px;       /* clears the table header */
}
.param-roi__years > div {
  height: 502px;
  padding: 20px 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: sideways-lr;
  background-color: var(--roi-primary);
  border: 2px solid var(--roi-secondary);
  color: #fff;
  font-weight: 600;
  font-size: 25px;
  letter-spacing: 2px;
}
.param-roi__years > div:first-child { border-top-left-radius: 50px; }
.param-roi__years > div:last-child  { border-bottom-left-radius: 50px; }

.param-roi__charts-col {
  flex: 1 1 66%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  row-gap: 30px;
}
.param-roi__charts-col canvas { max-width: 100%; }

/* ---- Grid.js table ---------------------------------------------------- */
.param-roi__table .gridjs-th,
.param-roi__table .gridjs-td {
  padding: 12px 14px;
  line-height: 1.2;
  vertical-align: middle;
}
.param-roi__table .gridjs-th {
  font-weight: 700;
  font-size: 16px;
  white-space: normal;    /* let "Cumulative Savings" wrap instead of clipping */
}
.param-roi__table tbody td {
  font-size: 14px;
  font-weight: 600;
}
.param-roi__table tbody td:nth-child(2) {
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.param-roi__table tbody tr:nth-child(odd) td { background: rgba(0,0,0,.02); }
.param-roi__table tbody tr:hover td          { background: rgba(0,0,0,.05); }
.param-roi__table .pos { color: #1a7f37; }
.param-roi__table .neg { color: #b42318; }

/* ---- Responsive ------------------------------------------------------- */
@media only screen and (max-width: 980px) {
  /* Stack table above charts */
  .param-roi__results { flex-wrap: wrap; }
  .param-roi__table-col,
  .param-roi__charts-col { flex-basis: 100%; }
  .param-roi__table-col { min-width: 0; max-height: 600px; }
  .param-roi__years { flex-basis: 55px; }
}
@media only screen and (max-width: 767px) {
  /* Single column; label above input */
  .param-roi__grid,
  .param-roi__field { grid-template-columns: 1fr; }
  .param-roi__field { row-gap: 4px; }
}
