/* ConIngenio · Herramienta Solar — estilos (marca: navy #1B2B4B / oro #F5A623 / verde #2ECC71) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --navy: #1B2B4B; --navy-light: #263d66; --navy-dark: #111d33;
  --gold: #F5A623; --gold-light: #f7b84d; --gold-dark: #d48d10;
  --green: #2ECC71; --green-dark: #27ae60;
  --blue: #3498DB;
  --white: #fff; --cloud: #F4F6F8; --sand: #FAF3E8;
  --slate: #6B7B8D; --slate-light: #8a97a5; --line: #e6eaf0;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 10px 34px rgba(27, 43, 75, 0.10);
  --shadow-sm: 0 3px 12px rgba(27, 43, 75, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font); color: var(--navy); background: var(--cloud);
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ── Header ─────────────────────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  position: sticky; top: 0; z-index: 20; box-shadow: 0 4px 22px rgba(11, 20, 35, 0.20);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 80px; gap: 14px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand img { width: auto; }
.brand .brand-sym { height: 56px; }
.brand .brand-wordmark { height: 33px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3)); }
.header-pill { font-size: 12.5px; font-weight: 700; color: #fff; background: rgba(255,255,255,.12); padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); white-space: nowrap; }
.header-pill.internal { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--navy); border: 0; }

/* Etiquetas de la búsqueda de dirección */
.search-label { display: block; color: #fff; font-weight: 700; font-size: 14.5px; margin: 24px 0 9px; }
.search-hint { color: #c9d3e4; font-size: 13.5px; margin-top: 11px; }
.panel-title { font-size: 22px; font-weight: 800; color: var(--navy); }
.panel-title + .panel-sub { color: var(--slate); font-size: 14.5px; margin: 4px 0 4px; }
.fld-label { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero { background: linear-gradient(160deg, rgba(17,29,51,.94), rgba(27,43,75,.86) 55%, rgba(38,61,102,.80)), url('/assets/brand/hero_solar.png') center/cover no-repeat; color: #fff; padding: 52px 0 92px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; background: radial-gradient(circle, rgba(245,166,35,.28), transparent 70%); }
.hero h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; line-height: 1.12; max-width: 760px; }
.hero h1 .em { color: var(--gold); }
.hero p.sub { margin-top: 12px; color: #cdd6e6; font-size: 17px; max-width: 620px; }

/* ── Search box ─────────────────────────────────────────────────────── */
.searchbar { margin-top: 26px; display: flex; gap: 10px; max-width: 640px; background: #fff; padding: 8px; border-radius: 999px; box-shadow: var(--shadow); }
.searchbar input { flex: 1; border: 0; outline: 0; font-family: var(--font); font-size: 15.5px; padding: 12px 18px; color: var(--navy); background: transparent; }
.searchbar input::placeholder { color: var(--slate-light); }
.panel-search { max-width: 720px; margin: 0; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn { font-family: var(--font); font-weight: 700; font-size: 15px; border: 0; border-radius: 999px; padding: 13px 26px; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .12s; display: inline-flex; align-items: center; gap: 8px; }
.btn:active { transform: translateY(1px); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--navy); box-shadow: 0 6px 18px rgba(245,166,35,.35); }
.btn-gold:hover { box-shadow: 0 8px 22px rgba(245,166,35,.5); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-light); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: var(--green-dark); }
.btn-ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); border-radius: var(--radius-sm); padding: 11px 18px; }
.btn-ghost:hover { border-color: var(--gold); }
.btn-sm { padding: 9px 16px; font-size: 13.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ── Results / cards ────────────────────────────────────────────────── */
.results { margin-top: -60px; position: relative; z-index: 5; padding-bottom: 60px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.card + .card { margin-top: 20px; }
.card h2 { font-size: 20px; font-weight: 800; }
.card h3 { font-size: 15px; font-weight: 700; color: var(--navy); }
.muted { color: var(--slate); font-size: 14px; }

.result-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.addr { font-weight: 700; font-size: 16px; }
.badge { font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.badge.alta { background: #e5f8ee; color: var(--green-dark); }
.badge.media { background: #fff4e0; color: var(--gold-dark); }
.badge.baja { background: #eef1f5; color: var(--slate); }
.badge.demo { background: #eaf2fb; color: var(--blue); }

/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 18px; }
.tile { background: var(--cloud); border-radius: var(--radius-sm); padding: 18px; border: 1px solid var(--line); }
.tile .ic { font-size: 22px; }
.tile .val { font-size: 26px; font-weight: 800; color: var(--navy); margin-top: 6px; line-height: 1; }
.tile .lbl { font-size: 12.5px; color: var(--slate); margin-top: 6px; font-weight: 600; }
.tile.hl { background: linear-gradient(135deg, #eafaf0, #dff5e8); border-color: #bfe9cf; }
.tile.hl .val { color: var(--green-dark); }
.tile.gold { background: linear-gradient(135deg, #fff6e6, #fdeccd); border-color: #f6ddac; }
.tile.gold .val { color: var(--gold-dark); }

/* Monthly bar chart */
.chart { margin-top: 22px; }
.chart .bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 10px; }
.chart .bar { flex: 1; background: linear-gradient(to top, var(--gold), var(--gold-light)); border-radius: 5px 5px 0 0; min-height: 4px; position: relative; transition: height .4s ease; }
.chart .bar:hover::after, .chart .bar:focus::after { content: attr(data-v); position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.chart .labels { display: flex; gap: 6px; margin-top: 6px; }
.chart .labels span { flex: 1; text-align: center; font-size: 10.5px; color: var(--slate); }

/* CTA */
.cta { background: linear-gradient(135deg, var(--navy), var(--navy-light)); color: #fff; border-radius: var(--radius); padding: 26px; margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.cta h3 { color: #fff; font-size: 19px; }
.cta p { color: #c9d3e4; font-size: 14px; margin-top: 4px; }

/* Lead form */
.leadform { display: none; margin-top: 16px; }
.leadform.open { display: block; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label.fld { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
input.in, textarea.in, select.in { width: 100%; font-family: var(--font); font-size: 14.5px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--navy); background: #fff; outline: 0; }
input.in:focus, textarea.in:focus, select.in:focus { border-color: var(--gold); }
textarea.in { resize: vertical; min-height: 70px; }

/* Warnings / notes */
.note { background: #fff8ec; border: 1px solid #f6e2b8; color: #8a6414; border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; margin-top: 14px; }
.note.info { background: #eef5fc; border-color: #cfe2f6; color: #2c5d86; }

/* Loader */
.loader { display: none; text-align: center; padding: 40px 0; }
.loader.on { display: block; }
.spinner { width: 42px; height: 42px; border: 4px solid rgba(245,166,35,.25); border-top-color: var(--gold); border-radius: 50%; margin: 0 auto 12px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.site-footer { background: var(--navy-dark); color: #aab6cc; font-size: 13px; padding: 26px 0; text-align: center; }
.site-footer strong { color: #fff; }
.site-footer .src { font-size: 11.5px; color: #6c7a94; margin-top: 6px; }

.hidden { display: none !important; }

/* ── Autocompletado de direcciones ──────────────────────────────────── */
.ac-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 3000; max-height: 300px; overflow-y: auto; text-align: left; }
.ac-item { padding: 12px 18px; font-size: 14.5px; color: var(--navy); cursor: pointer; border-bottom: 1px solid var(--line); line-height: 1.3; }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.active { background: var(--sand); }
.ac-item::before { content: '📍 '; opacity: .6; }

/* ── Mapa para marcar el tejado ─────────────────────────────────────── */
.roofmap { height: 420px; width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); z-index: 1; }
.roof-pin { font-size: 28px; text-align: center; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.55)); cursor: grab; }
.map-head h2 { display: flex; align-items: center; gap: 8px; }
.map-hint { display: inline-flex; align-items: center; gap: 7px; background: var(--sand); color: var(--navy); font-weight: 600; font-size: 13px; padding: 7px 13px; border-radius: 999px; margin: 8px 0 14px; }
.leaflet-container { font-family: var(--font); }
@media (max-width: 820px) { .roofmap { height: 320px; } }

/* El resultado no queda tapado por el header fijo al hacer scroll automático */
#result, #panel { scroll-margin-top: 96px; }

/* ── Panel (interno) — layout de 2 columnas ─────────────────────────── */
.panel-wrap { padding: 26px 0 60px; }
.panel-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 20px; align-items: start; margin-top: 20px; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--slate); }
.kv .v { font-weight: 700; }
table.seg { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13.5px; }
table.seg th { text-align: left; color: var(--slate); font-weight: 600; padding: 7px 8px; border-bottom: 2px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.seg td { padding: 8px; border-bottom: 1px solid var(--line); }
.assump { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.assump .full { grid-column: 1 / -1; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; padding-top: 12px; border-top: 2px solid var(--navy); }
.total-row .k { font-weight: 700; font-size: 16px; }
.total-row .v { font-weight: 800; font-size: 24px; color: var(--gold-dark); }
.export-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.src-badge { font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 6px; }
.src-google { background: #e8f0fe; color: #1a56db; }
.src-pvgis { background: #e7f6ee; color: var(--green-dark); }
.src-mock { background: #eaf2fb; color: var(--blue); }

@media (max-width: 820px) {
  .panel-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .searchbar { flex-direction: column; border-radius: var(--radius); }
  .searchbar .btn { width: 100%; justify-content: center; }
}
