/* ================================================================
   Terawatt 3.0 — Bill Upload (free teaser flow)
   Wires the v4-mockup dropzones (input[type=file][name=bill]) to
   EnergyCloud /api/onboarding/upload via /wp-json/tw3/v1/bill-upload
   and polls the result. Result renders behind the same saffron-lock
   pattern as savings-calc — opens consult-popup on Reveal, lead lands
   in Perfex, then unblurs on `tw3:calc:unlocked`.
   ================================================================ */

.tw3-bill-upload {
  margin-top: 18px;
  width: 100%;
}

/* ---------------- Progress strip ---------------- */

.bill-upload__progress {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--c-line, #DDD9D0);
  border-radius: 6px;
  background: var(--c-paper, #F2F0EC);
  font-size: 13px;
  color: var(--c-ink-soft, #2C2F36);
}
.bill-upload__progress[data-state="idle"]      { display: none; }
.bill-upload__progress[data-state="error"]     { border-color: #B33A3A; color: #B33A3A; background: #FBEEEE; }
.bill-upload__progress[data-state="done"]      { border-color: #2E8C5F; color: #2E8C5F; background: #ECF6F0; }

.bill-upload__bar {
  flex: 0 0 140px;
  height: 6px;
  background: rgba(12, 14, 18, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.bill-upload__bar-fill {
  height: 100%;
  width: 0%;
  background: #E8B92E; /* saffron */
  transition: width .25s ease;
}
.bill-upload__progress[data-state="done"]  .bill-upload__bar-fill { background: #2E8C5F; }
.bill-upload__progress[data-state="error"] .bill-upload__bar-fill { background: #B33A3A; width: 100% !important; }
.bill-upload__progress[data-state="analysing"] .bill-upload__bar-fill {
  background: linear-gradient(90deg, #E8B92E 0%, #d9aa1d 50%, #E8B92E 100%);
  background-size: 200% 100%;
  animation: tw3-bill-shimmer 1.6s linear infinite;
}
@keyframes tw3-bill-shimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }

.bill-upload__status { flex: 1 1 auto; }

/* ---------------- Drop hover state on the existing v4 zone ---------------- */

.bill-upload-block__zone.is-dragover,
label.is-dragover {
  outline: 2px dashed #E8B92E;
  outline-offset: -4px;
  background: rgba(232, 185, 46, 0.08);
}

/* ---------------- Locked teaser (matches savings-calc lock) ---------------- */

.tw3-bill-upload .bill-result {
  position: relative;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--c-line, #DDD9D0);
  border-radius: 6px;
  background: var(--c-paper, #F2F0EC);
  display: grid;
  gap: 8px;
}
.tw3-bill-upload .bill-result .calc-output__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(12, 14, 18, 0.08);
  font-size: 14px;
}
.tw3-bill-upload .bill-result .calc-output__row:last-of-type { border-bottom: 0; }
.tw3-bill-upload .bill-result .label {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-faint, #8C9099);
}
.tw3-bill-upload .bill-result .value {
  font-weight: 600;
  color: var(--c-ink, #0C0E12);
}
.tw3-bill-upload .bill-result .value em {
  font-style: normal;
  color: #E8B92E;
}

/* Reuse the savings-calc lock overlay & unlock visual semantics. The
   selectors below mirror what's in savings-calc.css but scoped to
   .tw3-bill-upload — keeps them independent in case a page only has a
   bill-upload widget without a calc widget. */
.tw3-bill-upload .calc-output.is-locked .calc-output__row {
  filter: blur(7px) saturate(1.05);
  -webkit-filter: blur(7px) saturate(1.05);
  user-select: none;
  pointer-events: none;
}
.tw3-bill-upload .calc-output__lock {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: linear-gradient(180deg, rgba(242, 240, 236, 0.55) 0%, rgba(242, 240, 236, 0.86) 100%);
  z-index: 2;
  border-radius: 6px;
}
.tw3-bill-upload .calc-output.is-locked .calc-output__lock { display: flex; }

html.tw3-calc-unlocked .tw3-bill-upload .calc-output.is-locked .calc-output__row {
  filter: none;
  -webkit-filter: none;
  user-select: auto;
  pointer-events: auto;
}
html.tw3-calc-unlocked .tw3-bill-upload .calc-output__lock { display: none; }

/* ---------------- Footer compact zone ---------------- */

.site-footer__bill-upload {
  margin-top: 28px;
  padding: 22px 22px 20px;
  background: rgba(12, 14, 18, 0.04);
  border: 1px solid var(--c-line, #DDD9D0);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: center;
}
@media (min-width: 720px) {
  .site-footer__bill-upload { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}
.site-footer__bill-upload .eyebrow {
  display: block;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #E8B92E;
  margin-bottom: 6px;
}
.site-footer__bill-upload h3 {
  margin: 0 0 4px;
  font-family: var(--font-display, 'Inter Tight', 'Inter', sans-serif);
  font-size: 20px;
  line-height: 1.25;
  color: var(--c-ink, #0C0E12);
}
.site-footer__bill-upload p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-ink-soft, #2C2F36);
}
.site-footer__bill-upload .bill-upload-block__zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 96px;
  padding: 14px 16px;
  border: 1.5px dashed rgba(12, 14, 18, 0.18);
  border-radius: 6px;
  background: var(--c-paper, #F2F0EC);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center;
  font-size: 13px;
  color: var(--c-ink-soft, #2C2F36);
}
.site-footer__bill-upload .bill-upload-block__zone:hover {
  border-color: #E8B92E;
  background: rgba(232, 185, 46, 0.05);
}
.site-footer__bill-upload .bill-upload-block__zone-title {
  font-weight: 600;
  color: var(--c-ink, #0C0E12);
}
.site-footer__bill-upload .bill-upload-block__zone-meta {
  font-size: 11px;
  color: var(--c-faint, #8C9099);
}

/* ---------------- Mobile polish ---------------- */

@media (max-width: 540px) {
  .bill-upload__progress { flex-wrap: wrap; padding: 10px 12px; }
  .bill-upload__bar { flex: 1 1 100%; order: 2; }
  .bill-upload__status { font-size: 12px; }
}

/* ================================================================
   Two-step popup — step 1 form
   Added 2026-07-31. Lives on the DARK popup panel, so it borrows the
   .bill__ vocabulary from v5-base.css: #EAF2FA text, #E8B92E saffron,
   #0E243B ink, mono uppercase labels, 4px radii.
   ================================================================ */

.bill__steps {
  list-style: none;
  display: flex;
  gap: 10px;
  padding: 0;
  margin: 4px 0 0;
  font-family: var(--tw-font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.bill__steps li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(234, 242, 250, 0.16);
  border-radius: 2px;
  color: rgba(234, 242, 250, 0.42);
  transition: color .18s, border-color .18s, background .18s;
}
.bill__steps li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 9px;
}
.bill__steps li.is-on {
  color: #E8B92E;
  border-color: rgba(232, 185, 46, 0.45);
  background: rgba(232, 185, 46, 0.06);
}
.bill__steps li.is-done { color: rgba(234, 242, 250, 0.7); border-color: rgba(234, 242, 250, 0.28); }

.bill__form { width: 100%; display: grid; gap: 16px; justify-items: center; }

.bill__grid {
  width: 100%;
  max-width: 56ch;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  text-align: left;
}
.bill__field--wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .bill__grid { grid-template-columns: 1fr; } }

.bill__field { display: grid; gap: 6px; }
.bill__label {
  font-family: var(--tw-font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(234, 242, 250, 0.55);
}
.bill__field input,
.bill__field select {
  width: 100%;
  padding: 11px 12px;
  background: rgba(234, 242, 250, 0.04);
  border: 1px solid rgba(234, 242, 250, 0.18);
  border-radius: 4px;
  color: #EAF2FA;
  font-family: var(--tw-font-body, 'Inter', sans-serif);
  font-size: 0.9375rem;
  line-height: 1.3;
  outline: none;
  transition: border-color .15s, background .15s;
  -webkit-appearance: none;
  appearance: none;
}
.bill__field input::placeholder { color: rgba(234, 242, 250, 0.32); }
.bill__field input:focus,
.bill__field select:focus {
  border-color: #E8B92E;
  background: rgba(232, 185, 46, 0.06);
}
.bill__field input[aria-invalid="true"],
.bill__field select[aria-invalid="true"] { border-color: #E2725B; }

/* Native select arrow, drawn rather than inherited so it reads on dark. */
.bill__field select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23E8B92E' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.bill__field select option { background: #0E243B; color: #EAF2FA; }

/* Honeypot — off-screen rather than display:none, which some bots skip. */
.bill__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.bill__err {
  width: 100%;
  max-width: 56ch;
  padding: 10px 12px;
  border: 1px solid rgba(226, 114, 91, 0.5);
  border-radius: 4px;
  background: rgba(226, 114, 91, 0.08);
  color: #F0B5A6;
  font-size: 0.875rem;
  text-align: left;
}

.bill__note {
  margin: 0;
  font-family: var(--tw-font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(234, 242, 250, 0.38);
  max-width: 56ch;
}

.bill__btn[disabled] { opacity: 0.5; cursor: default; }
.bill__btn[disabled]:hover { background: #E8B92E; }

.bill__back {
  background: none;
  border: 0;
  padding: 4px;
  cursor: pointer;
  font-family: var(--tw-font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(234, 242, 250, 0.45);
}
.bill__back:hover { color: #E8B92E; }

.bill__upload { width: 100%; display: grid; gap: 16px; justify-items: center; }

/* ----------------------------------------------------------------------
   Two bugs lived here, and they compounded. Fixed 2026-08-01.

   1. `.bill__form` and `.bill__upload` both set `display: grid`. A class
      selector beats the user-agent `[hidden] { display: none }` rule, so
      the `hidden` attribute did NOTHING — step 2 was rendered on top of
      step 1 the whole time, and vice versa.

   2. v5-base.css line 909 sets
      `.bill input[type="file"] { position: absolute; inset: 0; opacity: 0 }`
      — the original dropzone pattern, where the whole panel is one big
      invisible click-to-upload target.

   Together: an invisible full-panel file input sat over the step-1 form,
   so clicking the Name field opened the file picker instead of focusing
   the input. Every field on the form was unreachable.

   The `inset: 0` overlay is still correct for the inline dropzones on the
   Elementor pages, so the override below is scoped to the popup only.
   ---------------------------------------------------------------------- */

.bill__form[hidden],
.bill__upload[hidden] { display: none !important; }

#tw-bill-popup .bill input[type="file"] {
  position: absolute;
  inset: auto;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
