/* ═══════════════════════════════════════════════════════════════════
   Concrete.ai Savings Calculator — Styles
   Brand: Dark #2A2A2A, Gold #F5C400, with grays #E8E8E8 / #9B9B9B.
   Green #34A853 is reserved for CO2/carbon-savings visuals only.
   ═══════════════════════════════════════════════════════════════════ */

.csc-wrap {
  --dark: #2A2A2A;
  --gold: #F5C400;
  --green: #34A853;
  --lgray: #E8E8E8;
  --mgray: #9B9B9B;

  font-family: Arial, "Helvetica Neue", sans-serif;
  color: var(--dark);
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px;
  line-height: 1.5;
}

/* ── Typography ─────────────────────────────────────────────────── */

.csc-title {
  font-size: 28px;
  margin: 0 0 4px;
}

.csc-subtitle {
  color: var(--mgray);
  margin: 0 0 24px;
  font-size: 15px;
}

.csc-section-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mgray);
  margin: 28px 0 12px;
}

.csc-hint {
  font-size: 13px;
  color: var(--mgray);
  margin: 0 0 8px;
}

/* ── Form ───────────────────────────────────────────────────────── */

.csc-fieldset {
  border: 1px solid var(--lgray);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 0 0 16px;
}

.csc-fieldset legend {
  font-weight: 700;
  font-size: 15px;
  padding: 0 6px;
}

.csc-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.csc-row > label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--mgray);
  flex: 1 1 180px;
}

.csc-wrap input[type="number"],
.csc-wrap input[type="text"],
.csc-wrap input[type="email"],
.csc-wrap select {
  font-family: inherit;
  font-size: 15px;
  padding: 8px 10px;
  border: 1px solid var(--lgray);
  border-radius: 6px;
  background: #fff;
  color: var(--dark);
  margin-top: 4px;
}

.csc-wrap input:focus,
.csc-wrap select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(245, 196, 0, 0.25);
}

.csc-input-group {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}

.csc-input-group input,
.csc-input-group select {
  margin-top: 0;
}

.csc-unit {
  font-size: 14px;
  color: var(--mgray);
  white-space: nowrap;
}

/* ── Sector rows ─────────────────────────────────────────────────── */

.csc-sector-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.csc-sector-row input,
.csc-sector-row select {
  margin-top: 4px;
}

.csc-sector-row .csc-sec-name {
  flex: 1 1 120px;
  font-weight: 600;
}

.csc-sector-row label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--mgray);
  flex: 0 1 110px;
}

/* Spec dropdown needs much more room than the share input — its options
   carry inline parentheticals ("Mixed (strength, slump + w/cm, …)") so
   the user can see what each spec means without opening the dropdown.
   min-width:0 + select{width:100%} are needed because a <select>'s
   intrinsic min-content is the width of its longest option; without
   these, the label refuses to shrink to its flex-basis and pushes the
   sector row to wrap. */
.csc-sector-row .csc-sec-spec-label {
  flex: 1 1 220px;
  min-width: 0;
}

.csc-sector-row .csc-sec-spec-label select {
  width: 100%;
  box-sizing: border-box;
}

.csc-remove-sector {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--mgray);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  align-self: center;
}

.csc-remove-sector:hover {
  color: #d00;
}

/* First sector can't be removed — hide the button but keep its slot so
   the row above stays aligned with the removable rows below. */
.csc-sector-row[data-index="0"] .csc-remove-sector {
  visibility: hidden;
  pointer-events: none;
}

/* ── Help icon with hover tooltip ───────────────────────────────── */

.csc-help {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--lgray);
  color: var(--dark);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 14px;
  cursor: help;
  /* Keep the icon inside the row's baseline alignment. */
  vertical-align: text-bottom;
}

.csc-help-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  padding: 10px 12px;
  background: var(--dark);
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: normal;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 10;
}

.csc-help:hover .csc-help-tip,
.csc-help:focus .csc-help-tip {
  visibility: visible;
  opacity: 1;
}

/* ── Buttons ─────────────────────────────────────────────────────── */

.csc-btn-primary {
  display: inline-block;
  background: var(--gold);
  color: var(--dark);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

/* Pin the main "Calculate Savings" submit button centered under the form. */
#csc-form > .csc-btn-primary {
  display: block;
  margin: 8px auto 0;
}

.csc-btn-primary:hover {
  background: #e0b400;
}

.csc-btn-secondary {
  background: none;
  border: 1px solid var(--lgray);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--mgray);
}

.csc-btn-secondary:hover {
  border-color: var(--mgray);
  color: var(--dark);
}

/* ── Results ─────────────────────────────────────────────────────── */

.csc-results-section {
  margin-top: 32px;
}

/* ── KPI cards ───────────────────────────────────────────────────── */

.csc-kpi-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.csc-kpi {
  flex: 1 1 200px;
  text-align: center;
  padding: 24px 16px;
  border-radius: 10px;
}

.csc-kpi-cost {
  background: var(--dark);
  color: #fff;
}

.csc-kpi-co2 {
  background: var(--green);
  color: #fff;
}

.csc-kpi-value {
  display: block;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
}

.csc-kpi-label {
  display: block;
  font-size: 14px;
  opacity: 0.85;
  margin-top: 4px;
}

/* ── Charts ──────────────────────────────────────────────────────── */

.csc-chart-wrap {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.csc-chart-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

/* Cost + CO2 bar charts sit side by side in the free results, matching
   the §2 layout of the emailed report. */
.csc-bar-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.csc-bar-half {
  flex: 1 1 280px;
  max-width: 360px;
}

.csc-bar-half img {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Summary table ───────────────────────────────────────────────── */

.csc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.csc-table th {
  background: var(--dark);
  color: #fff;
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
}

.csc-table th:first-child {
  text-align: left;
}

.csc-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--lgray);
}

.csc-table tr:nth-child(even) {
  background: #f9f9f9;
}

.csc-table-result {
  background: var(--gold) !important;
  font-weight: 700;
}

.csc-table-result td {
  border-bottom: none;
  padding: 10px 12px;
}

/* ── Error message ───────────────────────────────────────────────── */

.csc-error {
  background: #fff0f0;
  border: 1px solid #f5a5a5;
  color: #b00;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ── Gated / locked preview ──────────────────────────────────────── */

.csc-gated {
  position: relative;
  margin-top: 24px;
}

.csc-email-gate {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
}

.csc-email-box {
  background: #fff;
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 32px 36px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.csc-email-box h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.csc-email-box p {
  color: var(--mgray);
  margin: 0 0 20px;
  font-size: 14px;
}

.csc-email-box input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.csc-email-box .csc-btn-primary {
  width: 100%;
  margin-top: 4px;
}

.csc-email-box .csc-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  font-size: 11px;
  line-height: 1.45;
  color: var(--mgray);
  margin: 2px 0 16px;
  cursor: pointer;
}

.csc-email-box .csc-consent input[type="checkbox"] {
  /* Override .csc-email-box input { width: 100% } and pin a tidy size. */
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  margin: 2px 0 0;
  accent-color: var(--gold);
  cursor: pointer;
}

.csc-email-box .csc-consent a {
  color: var(--dark);
  text-decoration: underline;
}

.csc-email-box .csc-consent a:hover {
  color: var(--gold);
}

/* Gold (not green) because green is reserved for carbon/CO2 messaging. */
.csc-email-sent {
  color: var(--gold);
  font-weight: 700;
  font-size: 15px;
  margin: 12px 0 0;
}

/* ── Gated placeholder (blurred decoration) ──────────────────────── */

.csc-locked-preview {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
  padding: 16px 0;
}

.csc-placeholder-charts {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}

.csc-placeholder-donut {
  flex: 1;
  height: 200px;
  border-radius: 50%;
  background: conic-gradient(#2A2A2A 0% 35%, #F5C400 35% 70%, #9B9B9B 70% 100%);
  max-width: 200px;
  margin: 0 auto;
  box-shadow: 0 0 0 50px white inset;
}

.csc-placeholder-table {
  height: 140px;
  background: repeating-linear-gradient(
    0deg,
    #E8E8E8,
    #E8E8E8 1px,
    #f9f9f9 1px,
    #f9f9f9 40px
  );
  border-radius: 6px;
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .csc-row {
    flex-direction: column;
  }
  .csc-sector-row {
    flex-direction: column;
    align-items: stretch;
  }
  .csc-kpi-value {
    font-size: 28px;
  }
  .csc-chart-half {
    flex-basis: 100%;
  }
}
