/* EcoSolar Calculator — scoped styles */

.ecosolar-calc {
  --ecs-dark: #0D2E1D;
  --ecs-green: #2E7D32;
  --ecs-green-deep: #14532D;
  --ecs-gold: #E5A823;
  --ecs-cream: #FAF9F5;
  --ecs-mint: #EBF0EC;
  --ecs-border: #E3E3DA;
  --ecs-text: #0D2E1D;
  --ecs-text-muted: #5B6B60;
  --ecs-radius: 16px;

  container-type: inline-size;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #ffffff;
  border: 1px solid var(--ecs-border);
  border-radius: var(--ecs-radius);
  overflow: hidden;
  color: var(--ecs-text);
}

.ecosolar-calc, .ecosolar-calc *, .ecosolar-calc *::before, .ecosolar-calc *::after {
  box-sizing: border-box;
}

/* ---------- Defensive reset: neutralize theme/Elementor global button & visibility styles ---------- */
.ecosolar-calc button {
  all: unset;
  box-sizing: border-box !important;
  cursor: pointer;
  font-family: inherit;
}
.ecosolar-calc [hidden] {
  display: none !important;
}
.ecosolar-calc select.ecs-input {
  all: unset;
  box-sizing: border-box !important;
  cursor: pointer;
}

/* ---------- Step header ---------- */
.ecs-steps {
  display: flex;
  align-items: center;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--ecs-border);
}
.ecs-step-dot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ecs-step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: #fff;
  border: 2px solid #D7DED9;
  color: #9AA69E;
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
  flex-shrink: 0;
}
.ecs-step-label {
  font-size: 13px;
  font-weight: 600;
  color: #9AA69E;
  white-space: nowrap;
  transition: color .25s ease;
}
.ecs-step-dot.is-active .ecs-step-circle {
  background: var(--ecs-dark);
  border-color: var(--ecs-dark);
  color: #fff;
}
.ecs-step-dot.is-active .ecs-step-label { color: var(--ecs-dark); }
.ecs-step-dot.is-complete .ecs-step-circle {
  background: var(--ecs-green);
  border-color: var(--ecs-green);
  color: #fff;
}
.ecs-step-line {
  flex: 1 1 auto;
  height: 2px;
  background: #E3E3DA;
  margin: 0 12px;
  min-width: 16px;
}

/* ---------- Body / panels ---------- */
.ecs-body { position: relative; padding: 28px 32px 8px; min-height: 320px; }

.ecs-panel { display: none; animation: ecsFade .32s ease; }
.ecs-panel.is-active { display: block; }
@keyframes ecsFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ecsShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.ecs-h { margin: 0 0 6px; font-size: 20px; font-weight: 700; color: var(--ecs-dark); }
.ecs-h-sm { margin: 24px 0 14px; font-size: 15px; font-weight: 700; color: var(--ecs-dark); }
.ecs-sub { margin: 0 0 22px; font-size: 13.5px; color: var(--ecs-text-muted); line-height: 1.5; }

/* ---------- Property cards (step 1) ---------- */
.ecs-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ecs-card {
  position: relative;
  text-align: left;
  background: #fff !important;
  border: 1.5px solid var(--ecs-border) !important;
  border-radius: 12px !important;
  padding: 18px !important;
  width: 100% !important;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .18s ease, background-color .18s ease, transform .12s ease;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px;
}
.ecs-card:hover { border-color: #B9CCBE; transform: translateY(-1px); }
.ecs-card.is-selected { border-color: var(--ecs-green) !important; background: var(--ecs-mint) !important; }
.ecs-card-top { display: flex !important; align-items: center; justify-content: space-between; width: 100%; }
.ecs-card-icon {
  width: 40px !important; height: 40px !important; min-width: 40px; border-radius: 10px !important;
  background: var(--ecs-mint) !important;
  display: flex !important; align-items: center; justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.ecs-card.is-selected .ecs-card-icon { background: #fff !important; }
.ecs-card-check {
  width: 22px !important; height: 22px !important; min-width: 22px; border-radius: 50% !important;
  background: var(--ecs-green) !important;
  color: #fff;
  font-size: 12px;
  display: none; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ecs-card.is-selected .ecs-card-check { display: flex !important; }
.ecs-card-title { font-size: 15px; font-weight: 700; color: var(--ecs-dark); margin-top: 4px; width: 100%; }
.ecs-card-desc { font-size: 12.5px; color: var(--ecs-text-muted); line-height: 1.45; width: 100%; }

/* ---------- Fields ---------- */
.ecs-field { margin-bottom: 18px; }
.ecs-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ecs-dark); margin-bottom: 8px; letter-spacing: .2px; }
.ecs-input {
  width: 100% !important;
  padding: 13px 14px !important;
  font-size: 14.5px !important;
  border: 1.5px solid var(--ecs-border) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: var(--ecs-text) !important;
  font-family: inherit;
  height: auto !important;
  min-height: 0 !important;
  box-shadow: none !important;
  transition: border-color .15s ease, box-shadow .15s ease;
  appearance: none;
  -webkit-appearance: none;
}
select.ecs-input {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='18' height='18'%3E%3Cpath fill='%235B6B60' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}
.ecs-input:focus {
  outline: none;
  border-color: var(--ecs-green);
  box-shadow: 0 0 0 3px rgba(46,125,50,0.15);
}
.ecs-hint { display: block; margin-top: 7px; font-size: 12px; color: var(--ecs-text-muted); line-height: 1.4; }
.ecs-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Step 4: loading ---------- */
.ecs-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; gap: 16px; text-align: center; }
.ecs-loading p { margin: 0; color: var(--ecs-text-muted); font-size: 13.5px; }
.ecs-spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--ecs-mint);
  border-top-color: var(--ecs-green);
  animation: ecsSpin .8s linear infinite;
}
@keyframes ecsSpin { to { transform: rotate(360deg); } }

/* ---------- Step 4: results ---------- */
.ecs-result-hero {
  background: linear-gradient(135deg, #2E7D32, #14532D);
  border-radius: 14px;
  padding: 26px 24px;
  text-align: center;
  margin-bottom: 18px;
}
.ecs-result-label { display: block; color: var(--ecs-gold); font-size: 11.5px; font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; }
.ecs-result-value { display: block; color: #fff; font-size: 34px; font-weight: 800; line-height: 1.15; margin-bottom: 10px; }
.ecs-result-note { display: block; color: #D7E4DA; font-size: 11.5px; line-height: 1.55; max-width: 440px; margin: 0 auto; }

.ecs-result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.ecs-result-stat { background: var(--ecs-mint); border-radius: 10px; padding: 14px; text-align: center; }
.ecs-stat-value { display: block; font-size: 17px; font-weight: 800; color: var(--ecs-dark); }
.ecs-stat-label { display: block; font-size: 10.5px; color: var(--ecs-text-muted); margin-top: 3px; }

.ecs-lead-form { margin-top: 8px; }
.ecs-error { color: #B3261E; font-size: 12.5px; margin: 6px 0 0; }

/* ---------- Thank you ---------- */
.ecs-thankyou { text-align: center; padding: 46px 20px; }
.ecs-thankyou-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ecs-green); color: #fff; font-size: 26px;
  margin-bottom: 16px;
}
.ecs-thankyou h3 { margin: 0 0 8px; }
.ecs-thankyou p { margin: 0 auto; max-width: 380px; color: var(--ecs-text-muted); font-size: 13.5px; line-height: 1.6; }

/* ---------- Footer / actions ---------- */
.ecs-footer {
  padding: 18px 32px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--ecs-border);
  margin-top: 6px;
}
.ecs-progress { display: flex; align-items: center; gap: 8px; }
.ecs-progress-dot { width: 7px; height: 7px; border-radius: 50%; background: #D7DED9; transition: background-color .2s ease, width .2s ease; }
.ecs-progress-dot.is-active { background: var(--ecs-gold); width: 20px; border-radius: 4px; }
.ecs-progress-text { font-size: 12px; color: var(--ecs-text-muted); margin-left: 4px; white-space: nowrap; }

.ecs-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.ecs-btn {
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 100px !important;
  padding: 13px 26px !important;
  border: none !important;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  line-height: normal !important;
  transition: transform .12s ease, box-shadow .12s ease, opacity .15s ease;
}
.ecs-btn:active { transform: scale(0.97); }
.ecs-btn-primary { background: var(--ecs-gold) !important; color: var(--ecs-dark) !important; }
.ecs-btn-primary:hover { box-shadow: 0 4px 14px rgba(229,168,35,0.35); }
.ecs-btn-primary:disabled { opacity: .6; cursor: default; transform: none; box-shadow: none; }
.ecs-btn-ghost { background: transparent !important; color: var(--ecs-text-muted) !important; padding: 13px 18px !important; }
.ecs-btn-ghost:hover { color: var(--ecs-dark) !important; }
.ecs-arrow { transition: transform .15s ease; }
.ecs-btn-primary:hover .ecs-arrow { transform: translateX(2px); }

/* ---------- Container queries: adapt to the column width, not viewport ---------- */
@container (max-width: 620px) {
  .ecs-steps { padding: 20px 18px 16px; }
  .ecs-step-label { display: none; }
  .ecs-step-circle { width: 28px; height: 28px; font-size: 12px; }
  .ecs-step-line { margin: 0 6px; }
  .ecs-body { padding: 22px 18px 4px; }
  .ecs-grid-2, .ecs-grid-2col { grid-template-columns: 1fr; }
  .ecs-result-grid { grid-template-columns: 1fr 1fr; }
  .ecs-result-value { font-size: 27px; }
  .ecs-footer { padding: 16px 18px 22px; flex-direction: column; align-items: stretch; }
  .ecs-actions { margin-left: 0; justify-content: space-between; }
  .ecs-progress { justify-content: space-between; }
  .ecs-progress-text { margin-left: 0; }
}

@container (max-width: 380px) {
  .ecs-result-grid { grid-template-columns: 1fr; }
  .ecs-h { font-size: 18px; }
}

/* Fallback for browsers without container query support: still usable, just not column-aware */
@supports not (container-type: inline-size) {
  @media (max-width: 620px) {
    .ecs-step-label { display: none; }
    .ecs-grid-2, .ecs-grid-2col { grid-template-columns: 1fr; }
  }
}
