/* ── Variables ── */
:root {
  --green:        #1B5E20;
  --green-mid:    #2E7D32;
  --green-light:  #F1F8E9;
  --orange:       #C84200;
  --orange-hover: #A83000;
  --text:         #1A1A1A;
  --text-sec:     #616161;
  --border:       #E0E0E0;
  --bg:           #FAFAFA;
  --white:        #FFFFFF;
  --radius:       8px;
  --shadow:       0 1px 4px rgba(0,0,0,.10);
  --shadow-md:    0 4px 16px rgba(0,0,0,.12);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select { font-family: inherit; font-size: 1rem; }
ul { list-style: none; }

/* ── Layout ── */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Header ── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 16px;
  max-width: 480px;
  margin: 0 auto;
}
.logo {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--green);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-name { color: var(--green); }
.logo-name span { color: var(--orange); }
.logo-img { height: 32px; width: auto; display: block; }

/* ── Burger ── */
.burger {
  width: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius);
}
.burger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: background .15s;
}
.burger:hover span { background: var(--green); }

/* ── Nav ── */
.nav-menu {
  display: none;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.nav-menu.open { display: block; }
.nav-menu a {
  display: block;
  padding: 14px 16px;
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  max-width: 480px;
  margin: 0 auto;
}
.nav-menu a:last-child { border-bottom: none; }
.nav-menu a:hover { color: var(--green); }

/* ── Hero ── */
.hero {
  background: var(--white);
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 10px;
}
.hero h1 em {
  font-style: normal;
  color: var(--green);
}
.hero p {
  font-size: 1rem;
  color: var(--text-sec);
  line-height: 1.55;
}

/* ── Calculator card ── */
.calc-section { padding: 24px 0 100px; }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.card-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-sec);
  margin-bottom: 16px;
}

/* ── Form fields ── */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.field-hint {
  display: block;
  font-size: .8rem;
  color: var(--text-sec);
  margin-top: 4px;
}
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
select {
  width: 100%;
  height: 48px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  font-size: 1rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--green-mid);
}
input.error { border-color: #C62828; }
input.success { border-color: var(--green-mid); }

/* ── CP resolve ── */
.cp-resolve {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--green-light);
  border-radius: var(--radius);
  font-size: .875rem;
}
.cp-resolve.show { display: block; }
.cp-resolve .municipio-name {
  font-weight: 600;
  color: var(--green);
}
.cp-resolve .subsidios-badge {
  color: var(--text-sec);
  font-size: .8rem;
  margin-top: 2px;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.tab-btn {
  flex: 1;
  height: 40px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-sec);
  background: var(--white);
  border: none;
  transition: background .15s, color .15s;
}
.tab-btn.active {
  background: var(--green);
  color: var(--white);
}

/* ── Battery toggle ── */
.toggle-group {
  display: flex;
  gap: 8px;
}
.toggle-btn {
  flex: 1;
  height: 48px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 500;
  color: var(--text-sec);
  background: var(--white);
  transition: all .15s;
}
.toggle-btn.active {
  border-color: var(--green-mid);
  color: var(--green);
  background: var(--green-light);
}

/* ── Price field ── */
.price-wrap {
  position: relative;
}
.price-wrap input { padding-right: 56px; }
.price-unit {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .875rem;
  color: var(--text-sec);
  pointer-events: none;
}

/* ── Primary CTA ── */
.btn-primary {
  display: block;
  width: 100%;
  height: 52px;
  background: var(--orange);
  color: var(--white);
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius);
  transition: background .15s;
  margin-top: 8px;
}
.btn-primary:hover { background: var(--orange-hover); }
.btn-primary:disabled {
  background: #BDBDBD;
  cursor: not-allowed;
}

.btn-secondary {
  display: block;
  width: 100%;
  height: 52px;
  background: var(--green);
  color: var(--white);
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius);
  transition: background .15s;
  margin-top: 8px;
}
.btn-secondary:hover { background: var(--green-mid); }

/* ── Sticky CTA ── */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  z-index: 90;
  display: none;
}
.sticky-cta.show { display: block; }
.sticky-cta .btn-primary { height: 48px; margin: 0; }

/* ── Results ── */
.results-section {
  display: none;
  padding: 0 0 24px;
}
.results-section.show { display: block; }

.result-hero {
  background: var(--green);
  color: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 12px;
}
.result-hero .label {
  font-size: .8rem;
  opacity: .8;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 4px;
}
.result-hero .big-number {
  font-family: 'Poppins', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
}
.result-hero .big-unit {
  font-size: 1.25rem;
  font-weight: 400;
  opacity: .85;
}
.result-hero .sub {
  font-size: .875rem;
  opacity: .75;
  margin-top: 6px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.result-cell {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.result-cell .r-label {
  font-size: .75rem;
  color: var(--text-sec);
  margin-bottom: 4px;
}
.result-cell .r-value {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
}
.result-cell .r-value.highlight { color: var(--green); }

.result-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.result-card h3 {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: .875rem;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Fiscal ── */
.fiscal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.fiscal-row:last-child { border-bottom: none; }
.fiscal-row .f-label { color: var(--text-sec); }
.fiscal-row .f-value { font-weight: 600; color: var(--green); }

/* ── Subsidios ── */
.subsidio-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.subsidio-item:last-child { border-bottom: none; }
.subsidio-item a {
  color: var(--green);
  text-decoration: underline;
  font-weight: 500;
  font-size: .8rem;
  display: inline-block;
  margin-top: 2px;
}
.subsidio-nivel {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.nivel-local  { background: #E8F5E9; color: var(--green); }
.nivel-ccaa   { background: #E3F2FD; color: #1565C0; }
.nivel-nacional { background: #FFF3E0; color: #A83000; }

/* ── Lead form ── */
.lead-section {
  display: none;
  padding: 16px 0 40px;
}
.lead-section.show { display: block; }
.lead-section > h2 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 6px;
}
.lead-section > p {
  font-size: .9rem;
  color: var(--text-sec);
  margin-bottom: 20px;
}
.phone-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.phone-prefix {
  flex: 0 0 64px;
  background: var(--bg);
  color: var(--text-sec);
  text-align: center;
  font-size: .9rem;
}
.phone-wrap input[type="tel"] {
  flex: 1;
  min-width: 0;
  width: auto;
}

.form-success {
  display: none;
  text-align: center;
  padding: 32px 20px;
  background: var(--green-light);
  border-radius: var(--radius);
  border: 1px solid #A5D6A7;
}
.form-success.show { display: block; }
.form-success h3 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--green);
  margin-bottom: 8px;
}
.form-success p { font-size: .9rem; color: var(--text-sec); }

/* ── Footer ── */
.site-footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.footer-links a {
  font-size: .8rem;
  color: var(--text-sec);
}
.footer-links a:hover { color: var(--green); }
.footer-copy {
  font-size: .75rem;
  color: var(--text-sec);
}

/* ── Loader ── */
.loading {
  display: none;
  text-align: center;
  padding: 16px;
  color: var(--text-sec);
  font-size: .875rem;
}
.loading.show { display: block; }

/* ── Error msg ── */
.field-error {
  display: none;
  font-size: .8rem;
  color: #C62828;
  margin-top: 4px;
}
.field-error.show { display: block; }

/* ── Empty state (desktop right panel) ── */
.empty-state {
  display: none;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-sec);
}
.empty-state .es-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.empty-state .es-icon svg { width: 28px; height: 28px; }
.empty-state h3 {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 6px;
}
.empty-state p { font-size: .875rem; line-height: 1.5; }

/* ── Tablet (520px+) ── */
@media (min-width: 520px) {
  .hero h1 { font-size: 2.25rem; }
  .sticky-cta { display: none !important; }
  .calc-section { padding-bottom: 32px; }
}

/* ── Desktop 2-column (840px+) ── */
@media (min-width: 840px) {
  .site-header { position: sticky; top: 0; }
  .header-inner { max-width: 1100px; }

  .hero { padding: 48px 0 40px; }
  .hero .container { max-width: 1100px; }
  .hero h1 { font-size: 2.5rem; max-width: 620px; }
  .hero p { max-width: 500px; }

  .calc-section { padding: 32px 0 48px; }
  .calc-section > .container { max-width: 1100px; }

  .main-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
  }

  .col-left { position: sticky; top: 72px; }

  .col-right .empty-state { display: block; }

  /* Results go inline on desktop — no scroll needed */
  .results-section {
    padding: 0;
  }
  .results-section.show { display: block; }
  .results-section + .lead-section { margin-top: 16px; }

  .lead-section h2 { font-size: 1.5rem; }

  .burger { display: none; }

  .site-header {
    display: flex;
    align-items: center;
    padding: 0 32px;
    height: 60px;
    position: relative;
  }
  .header-inner {
    max-width: none;
    margin: 0;
    padding: 0;
    height: 60px;
    flex-shrink: 0;
  }
  .nav-menu {
    display: flex !important;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    align-items: center;
    background: none;
    border-bottom: none;
    gap: 4px;
  }
  .nav-menu a {
    display: inline-block;
    padding: 6px 14px;
    border-bottom: none;
    font-size: .9rem;
    border-radius: var(--radius);
    max-width: none;
    margin: 0;
  }
  .nav-menu a:hover { background: var(--green-light); color: var(--green); }

  .site-footer .container { max-width: 1100px; }
}


/* ── Ciudades destacadas ── */
.ciudades-section { padding: 20px 0 32px; border-top: 1px solid var(--border); }
.ciudades-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-sec); margin-bottom: 10px; }
.ciudades-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.ciudad-pill { display: inline-block; padding: 6px 13px; background: var(--white); border: 1.5px solid var(--border); border-radius: 20px; font-size: .83rem; color: var(--text); text-decoration: none; transition: border-color .15s, color .15s; }
.ciudad-pill:hover { border-color: var(--green); color: var(--green); }
.ciudad-pill-more { border-color: var(--green); color: var(--green); font-weight: 600; }
.ciudad-pill-more:hover { background: var(--green-light); }

/* ── Ciudad única — contenido diferenciado top 30 ── */
.ciudad-unica { background: var(--green-light); border-radius: var(--radius); padding: 16px 18px; }
.ciudad-intro { font-size: .92rem; line-height: 1.75; color: #333; margin-bottom: 0; }
.ciudad-contexto { font-size: .85rem; line-height: 1.7; color: var(--text-sec); margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(27,94,32,.15); margin-bottom: 0; }
