/* ============================================================
   OFF-GRID LOAD CALCULATOR
   Layers on top of style.css + calculator.css (hero, cards, stat
   cards and the lead form are all shared with the savings calculator).
   ============================================================ */

.offgrid-intro { max-width: 900px; margin-bottom: var(--space-6); }
.offgrid-intro p { font-size: 15.5px; }

.offgrid-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.offgrid-toolbar .hint { font-size: 13.5px; color: var(--color-text-body); }

/* ---- Appliance groups ---- */
.appliance-group { margin-bottom: var(--space-6); }
.appliance-group:last-child { margin-bottom: 0; }
.appliance-group-title {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary-dark);
  margin-bottom: var(--space-3);
}

.appliance-table {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.appliance-row {
  display: grid;
  grid-template-columns: 1fr 96px 76px 110px 96px;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--transition-base);
}
.appliance-row:last-child { border-bottom: none; }
.appliance-row.is-on { background: rgba(21, 186, 178, 0.06); }

.appliance-row--head {
  background: var(--color-bg-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-body);
}
.appliance-row--head .cell-watts,
.appliance-row--head .cell-qty,
.appliance-row--head .cell-hours,
.appliance-row--head .cell-total { text-align: center; }

.appliance-row .cell-name { display: flex; align-items: flex-start; gap: 10px; }
.appliance-row .cell-name input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.appliance-row .cell-name label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--color-text-heading);
  cursor: pointer;
  line-height: 1.35;
}
.appliance-row.is-on .cell-name label { color: var(--color-primary-dark); }
.app-note { display: block; font-size: 12px; font-weight: 500; color: #8b8f92; }

.appliance-row input[type="number"] {
  width: 100%;
  padding: 7px 8px;
  text-align: center;
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-heading);
  background: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
}
.appliance-row input[type="number"]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.appliance-row input[type="number"]:disabled {
  opacity: 0.45;
  background: var(--color-bg-muted);
  cursor: not-allowed;
}

.appliance-row .app-total {
  display: block;
  text-align: center;
  font-size: 14.5px;
  font-weight: 700;
  color: #8b8f92;
  font-variant-numeric: tabular-nums;
}
.appliance-row.is-on .app-total { color: var(--color-text-heading); }

/* The per-cell labels only surface in the stacked mobile layout — on
   desktop the column header does that job, so keep them for screen
   readers but out of the visual grid. */
.appliance-row .cell-label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 780px) {
  .appliance-row--head { display: none; }
  .appliance-row {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3) var(--space-3);
  }
  .appliance-row .cell-name { grid-column: 1 / -1; }
  .appliance-row .cell-total { grid-column: 1 / -1; text-align: left; }
  .appliance-row .cell-label {
    position: static;
    width: auto; height: auto;
    margin: 0 0 4px;
    clip: auto;
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-body);
  }
  .appliance-row .cell-total { display: flex; align-items: baseline; gap: 8px; }
  .appliance-row .cell-total .cell-label { margin: 0; }
  .appliance-row .app-total { text-align: left; }
}

/* ---- Results ---- */
.offgrid-results-section { padding-top: 0; }
.offgrid-empty {
  border: 1.5px dashed var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  text-align: center;
  color: var(--color-text-body);
  font-size: 15px;
}
#offgrid-results { display: none; }
#offgrid-results.is-active { display: block; }

.offgrid-stat-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
  margin-bottom: var(--space-5);
}
@media (min-width: 700px) { .offgrid-stat-grid { grid-template-columns: 1fr 1fr; } }

.offgrid-stat {
  background: var(--color-black);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  color: #fff;
}
.offgrid-stat .stat-value {
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 800;
  color: var(--color-primary-light);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--space-1);
}
.offgrid-stat .stat-label {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: var(--space-2);
}
.offgrid-stat .stat-help { font-size: 13px; color: var(--color-text-on-dark-muted); line-height: 1.5; }

.offgrid-substats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.offgrid-substats div {
  flex: 1 1 200px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.offgrid-substats .sub-value { font-size: 22px; font-weight: 800; color: var(--color-text-heading); font-variant-numeric: tabular-nums; }
.offgrid-substats .sub-label { font-size: 13px; color: var(--color-text-body); }

/* ---- Category breakdown ---- */
.breakdown-row {
  display: grid;
  grid-template-columns: 190px 1fr 130px;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border-light);
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-name { font-size: 14px; font-weight: 600; color: var(--color-text-heading); }
.breakdown-bar {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--color-bg-muted);
  overflow: hidden;
}
.breakdown-bar span {
  display: block;
  height: 100%;
  background: var(--color-primary);
  border-radius: 4px;
  transition: width var(--transition-base);
}
.breakdown-value { font-size: 14px; text-align: right; color: var(--color-text-heading); font-variant-numeric: tabular-nums; }
.breakdown-value small { font-weight: 600; color: var(--color-text-body); }

@media (max-width: 620px) {
  .breakdown-row { grid-template-columns: 1fr auto; }
  .breakdown-bar { grid-column: 1 / -1; order: 3; }
  .breakdown-value { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  .appliance-row, .breakdown-bar span { transition: none !important; }
}

.form-intro {
  font-size: 13.5px;
  color: var(--color-primary-dark);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

/* The shared .calc-card padding (48px) is generous for prose but leaves a
   dense five-column table almost no room on a phone. Claw it back here
   without touching the savings calculator's layout. */
@media (max-width: 780px) {
  #offgrid-tool .calc-card { padding: var(--space-4) var(--space-3); }
  .offgrid-toolbar { flex-direction: column; align-items: stretch; }
  .offgrid-toolbar .btn { width: 100%; }
}

/* ---- Custom appliance rows ---- */
.offgrid-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}
.offgrid-add-row .btn { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.offgrid-add-row .btn svg { width: 16px; height: 16px; }
.offgrid-add-row .hint { font-size: 13.5px; color: var(--color-text-body); flex: 1 1 260px; }

.appliance-row--custom .cell-name { align-items: center; }
.app-custom-name {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-heading);
  background: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
}
.app-custom-name:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.app-custom-name:disabled { opacity: 0.45; background: var(--color-bg-muted); }

.app-remove {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  color: var(--color-text-body);
  cursor: pointer;
  transition: color var(--transition-base), border-color var(--transition-base);
}
.app-remove svg { width: 14px; height: 14px; }
.app-remove:hover { color: var(--color-danger); border-color: var(--color-danger); }

@media (max-width: 780px) {
  .offgrid-add-row .btn { width: 100%; justify-content: center; }
}

/* The custom row's name label stays screen-reader-only at every width —
   the placeholder carries the visible cue, and a stacked label would
   break the row's flex layout on a phone. */
@media (max-width: 780px) {
  .appliance-row--custom .cell-name .cell-label {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* ---- Locked results state ---- */
.offgrid-locked {
  border: 1.5px dashed var(--color-primary);
  border-radius: var(--radius-lg);
  background: rgba(21, 186, 178, 0.06);
  padding: var(--space-6) var(--space-5);
  text-align: center;
}
.offgrid-locked svg { width: 34px; height: 34px; color: var(--color-primary); margin-bottom: var(--space-3); }
.offgrid-locked h3 { font-size: 20px; margin-bottom: var(--space-2); }
.offgrid-locked p {
  font-size: 15px;
  max-width: 560px;
  margin: 0 auto var(--space-4);
}
