/* =========================================================
   AhorroCAE · Estilos complementarios a Tailwind (CDN)
   ========================================================= */

:root {
  --indigo: #4f46e5;
  --violet: #7c3aed;
  --pct: 14%; /* relleno del slider, lo actualiza app.js */
}

html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }

::selection { background: #c7d2fe; color: #1e1b4b; }

/* ---------- Hero ---------- */
.hero-bg {
  background:
    radial-gradient(60rem 28rem at 15% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(50rem 26rem at 90% 0%, rgba(139, 92, 246, 0.16), transparent 60%),
    linear-gradient(180deg, #eef2ff 0%, #f8fafc 100%);
}
.hero-bg::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(79, 70, 229, 0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  pointer-events: none;
}
.text-gradient {
  background: linear-gradient(90deg, #4f46e5, #7c3aed 55%, #c026d3);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- Huecos de AdSense ---------- */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 90px; width: 100%;
  border: 1.5px dashed #cbd5e1;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.7);
  color: #94a3b8;
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0.04em;
  text-transform: uppercase; text-align: center; padding: 0.75rem;
}

/* ---------- Stepper ---------- */
.step-dot {
  display: flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 9999px;
  background: #fff; border: 2px solid #cbd5e1; color: #94a3b8;
  font-size: 0.875rem; font-weight: 700;
  transition: all 0.3s ease;
}
.step-label {
  font-size: 0.7rem; font-weight: 600; color: #94a3b8;
  transition: color 0.3s ease; line-height: 1.2; max-width: 6.5rem;
}
@media (min-width: 640px) { .step-label { font-size: 0.8rem; max-width: none; } }

.step-item.is-active .step-dot {
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px -4px rgba(79, 70, 229, 0.55);
  transform: scale(1.08);
}
.step-item.is-active .step-label { color: #312e81; }
.step-item.is-done .step-dot {
  background: #10b981; border-color: #10b981; color: #fff; font-size: 0;
}
.step-item.is-done .step-dot::after {
  content: ""; width: 0.55rem; height: 1rem;
  border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.step-item.is-done .step-label { color: #047857; }

.progress-fill {
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #10b981);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Transición entre pasos ---------- */
.step-panel { animation: fadeUp 0.45s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Campos ---------- */
.field { transition: border-color 0.2s, box-shadow 0.2s; }
.field:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18); }

/* ---------- Tarjetas de opción (radio) ---------- */
.option-card { position: relative; display: block; cursor: pointer; }
.option-card input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.option-body {
  display: flex; flex-direction: column; gap: 0.5rem;
  height: 100%; padding: 1rem;
  border: 1.5px solid #e2e8f0; border-radius: 16px; background: #fff;
  transition: all 0.2s ease;
}
.option-card:hover .option-body { border-color: #a5b4fc; transform: translateY(-1px); box-shadow: 0 8px 20px -10px rgba(79, 70, 229, 0.35); }
.option-card input:focus-visible + .option-body { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25); }
.option-card input:checked + .option-body {
  border-color: var(--indigo); background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.option-icon {
  display: flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 12px;
  background: #f1f5f9; color: #475569; transition: all 0.2s ease;
}
.option-card input:checked + .option-body .option-icon { background: var(--indigo); color: #fff; }
.option-title { font-size: 0.9rem; font-weight: 700; color: #0f172a; }
.option-desc { font-size: 0.78rem; line-height: 1.35; color: #64748b; }
.option-check {
  position: absolute; top: 0.75rem; right: 0.75rem;
  width: 1.25rem; height: 1.25rem; border-radius: 9999px;
  border: 1.5px solid #cbd5e1; background: #fff;
  transition: all 0.2s ease;
}
.option-card input:checked + .option-body .option-check {
  border-color: var(--indigo); background: var(--indigo);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'%3E%3Cpath fill-rule='evenodd' d='M16.7 5.3a1 1 0 0 1 0 1.4l-7.5 7.5a1 1 0 0 1-1.4 0L3.3 9.7a1 1 0 1 1 1.4-1.4l3.8 3.8 6.8-6.8a1 1 0 0 1 1.4 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-size: 80%; background-position: center; background-repeat: no-repeat;
}

/* ---------- Slider ---------- */
.range {
  -webkit-appearance: none; appearance: none;
  height: 10px; border-radius: 9999px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, #6366f1 0, #8b5cf6 var(--pct), #e2e8f0 var(--pct), #e2e8f0 100%);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; border-radius: 9999px;
  background: #fff; border: 4px solid var(--indigo);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  transition: transform 0.15s ease;
}
.range::-webkit-slider-thumb:hover { transform: scale(1.1); }
.range:active::-webkit-slider-thumb { transform: scale(1.18); }
.range::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 9999px;
  background: #fff; border: 4px solid var(--indigo);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}
.range::-moz-range-track { height: 10px; border-radius: 9999px; background: transparent; }
.range:focus-visible { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: 9999px; padding: 0.8rem 1.6rem;
  font-size: 0.9rem; font-weight: 700; cursor: pointer;
  transition: all 0.2s ease; border: 1.5px solid transparent;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3); }
.btn-primary {
  color: #fff; background: linear-gradient(135deg, var(--indigo), var(--violet));
  box-shadow: 0 10px 22px -10px rgba(79, 70, 229, 0.7);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 26px -10px rgba(79, 70, 229, 0.8); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-secondary { color: #334155; background: #fff; border-color: #cbd5e1; }
.btn-secondary:hover { background: #f8fafc; border-color: #94a3b8; }
.btn-ghost { color: #475569; background: transparent; }
.btn-ghost:hover { background: #f1f5f9; }

/* ---------- Spinner ---------- */
.spinner {
  width: 48px; height: 48px; border-radius: 9999px;
  border: 4px solid #e0e7ff; border-top-color: var(--indigo);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Resultados ---------- */
.hero-result {
  background:
    radial-gradient(30rem 14rem at 100% 0%, rgba(167, 139, 250, 0.45), transparent 60%),
    linear-gradient(135deg, #312e81 0%, #4338ca 55%, #6d28d9 100%);
  box-shadow: 0 24px 40px -22px rgba(67, 56, 202, 0.75);
}
.kpi-card {
  border: 1px solid #e2e8f0; border-radius: 18px; background: #fff; padding: 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -16px rgba(15, 23, 42, 0.25); }
.kpi-icon {
  display: flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 12px; margin-bottom: 0.9rem;
}
.kpi-label { font-size: 0.8rem; font-weight: 600; color: #64748b; }
.kpi-value { margin-top: 0.15rem; font-size: 1.85rem; font-weight: 800; letter-spacing: -0.02em; color: #0f172a; }
.kpi-note { margin-top: 0.25rem; font-size: 0.75rem; color: #94a3b8; line-height: 1.4; }
.stack-seg { transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1); }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border-radius: 9999px; background: #f1f5f9; color: #334155;
  padding: 0.3rem 0.75rem; font-size: 0.75rem; font-weight: 600;
}

/* ---------- Guía ---------- */
.guide-card {
  border: 1px solid #e2e8f0; border-radius: 22px; background: #fff; padding: 1.6rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.guide-card:hover { transform: translateY(-3px); box-shadow: 0 18px 32px -20px rgba(15, 23, 42, 0.3); }
.guide-card h3 { font-size: 1.05rem; font-weight: 700; color: #0f172a; }
.guide-card > p { margin-top: 0.6rem; font-size: 0.9rem; line-height: 1.65; color: #475569; }
.guide-num {
  display: flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; margin-bottom: 1rem;
  border-radius: 14px; font-size: 1.15rem; font-weight: 800;
}
.prose-guide p { margin-top: 0.9rem; line-height: 1.75; color: #475569; font-size: 0.95rem; }
.prose-guide p:first-child { margin-top: 0; }
.prose-guide strong { color: #0f172a; }
.timeline-dot {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 9999px;
  background: #eef2ff; color: var(--indigo); font-size: 0.85rem; font-weight: 800;
  border: 1.5px solid #c7d2fe;
}

/* ---------- FAQ ---------- */
.faq {
  border: 1px solid #e2e8f0; border-radius: 16px; background: #fff;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.faq[open] { border-color: #c7d2fe; box-shadow: 0 12px 24px -16px rgba(79, 70, 229, 0.4); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  cursor: pointer; list-style: none; padding: 1.1rem 1.25rem;
  font-size: 0.95rem; font-weight: 700; color: #0f172a;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25); border-radius: 16px; }
.faq-icon {
  position: relative; flex: none; width: 1.5rem; height: 1.5rem; border-radius: 9999px; background: #eef2ff;
  transition: transform 0.25s ease, background 0.25s ease;
}
.faq-icon::before, .faq-icon::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  background: var(--indigo); border-radius: 2px; transform: translate(-50%, -50%);
}
.faq-icon::before { width: 10px; height: 2px; }
.faq-icon::after { width: 2px; height: 10px; transition: opacity 0.2s; }
.faq[open] .faq-icon { transform: rotate(180deg); background: var(--indigo); }
.faq[open] .faq-icon::before { background: #fff; }
.faq[open] .faq-icon::after { opacity: 0; }
.faq-body { padding: 0 1.25rem 1.2rem; font-size: 0.9rem; line-height: 1.7; color: #475569; animation: fadeUp 0.3s ease both; }

/* ---------- Accesibilidad / movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Impresión del informe ---------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .hero-bg { background: #fff; }
  .hero-result { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #simulador > div { box-shadow: none; border: none; }
  .stack-seg, .progress-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =========================================================
   FASE 2 · Modal legal, banner de cookies, SEO por provincias
   ========================================================= */

/* ---------- Pie de página ---------- */
.footer-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: #475569; text-align: left;
  transition: color 0.2s ease;
}
.footer-link:hover { color: var(--indigo); text-decoration: underline; text-underline-offset: 3px; }
.footer-link:focus-visible { outline: 2px solid var(--indigo); outline-offset: 3px; border-radius: 4px; }

/* ---------- Modal legal ---------- */
.legal-overlay[hidden], .cookie-banner[hidden] { display: none !important; }
.legal-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease both;
}
@media (min-width: 640px) { .legal-overlay { align-items: center; padding: 1.5rem; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.legal-panel {
  display: flex; flex-direction: column;
  width: 100%; max-width: 52rem; max-height: 92vh;
  background: #fff; border-radius: 22px 22px 0 0; outline: none;
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.55);
  animation: fadeUp 0.3s ease both;
}
@media (min-width: 640px) { .legal-panel { border-radius: 24px; max-height: 88vh; } }
.legal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid #e2e8f0;
}
.legal-head h2 { font-size: 1.15rem; font-weight: 800; color: #0f172a; letter-spacing: -0.01em; }
@media (min-width: 640px) { .legal-head { padding: 1.3rem 2rem; } .legal-head h2 { font-size: 1.3rem; } }
.legal-close {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 9999px; border: 0;
  background: #f1f5f9; color: #475569; cursor: pointer; transition: background 0.2s;
}
.legal-close:hover { background: #e2e8f0; }
.legal-close:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3); }
.legal-body { flex: 1; overflow-y: auto; padding: 1.25rem 1.4rem 1.5rem; overscroll-behavior: contain; }
@media (min-width: 640px) { .legal-body { padding: 1.5rem 2rem 2rem; } }
.legal-foot {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.6rem;
  padding: 1rem 1.4rem; border-top: 1px solid #e2e8f0; background: #f8fafc;
  border-radius: 0 0 24px 24px;
}
@media (max-width: 639px) { .legal-foot .btn { flex: 1 1 100%; } }
html.modal-open { overflow: hidden; }

.legal-prose { font-size: 0.92rem; line-height: 1.75; color: #475569; }
.legal-prose h3 { margin: 1.6rem 0 0.5rem; font-size: 1.02rem; font-weight: 800; color: #0f172a; }
.legal-prose h3:first-child { margin-top: 0; }
.legal-prose h4 { margin: 1.1rem 0 0.3rem; font-size: 0.92rem; font-weight: 700; color: #1e293b; }
.legal-prose p { margin: 0.6rem 0; }
.legal-prose ul { margin: 0.6rem 0; padding-left: 1.25rem; list-style: disc; }
.legal-prose li { margin: 0.3rem 0; }
.legal-prose strong { color: #0f172a; }
.legal-prose a { color: var(--indigo); text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
.legal-prose code {
  padding: 0.1rem 0.4rem; border-radius: 6px; background: #f1f5f9; color: #334155;
  font-size: 0.82em; word-break: break-word;
}
.legal-prose table { display: block; overflow-x: auto; width: 100%; margin: 0.8rem 0; border-collapse: collapse; font-size: 0.85rem; }
.legal-prose th, .legal-prose td { padding: 0.65rem 0.8rem; border: 1px solid #e2e8f0; text-align: left; vertical-align: top; min-width: 8rem; }
.legal-prose th { background: #f8fafc; color: #0f172a; font-weight: 700; }
.legal-meta { font-size: 0.78rem !important; color: #94a3b8; margin-top: 0 !important; }
.legal-note { font-size: 0.78rem; color: #94a3b8; }

/* ---------- Interruptores de consentimiento ---------- */
.consent-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  margin-top: 1rem; padding: 1rem 1.1rem; border: 1px solid #e2e8f0; border-radius: 16px;
}
.consent-name { margin: 0 !important; font-weight: 700; color: #0f172a; }
.consent-desc { margin: 0.25rem 0 0 !important; font-size: 0.83rem; }
.switch { position: relative; flex: none; display: inline-block; width: 3rem; height: 1.75rem; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch input:disabled { cursor: not-allowed; }
.switch-track { position: absolute; inset: 0; border-radius: 9999px; background: #cbd5e1; transition: background 0.2s; }
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 1.375rem; height: 1.375rem;
  border-radius: 9999px; background: #fff; box-shadow: 0 2px 4px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s ease;
}
.switch input:checked + .switch-track { background: var(--indigo); }
.switch input:checked + .switch-track::after { transform: translateX(1.25rem); }
.switch input:disabled:checked + .switch-track { background: #a5b4fc; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3); }

/* ---------- Banner de cookies (CMP) ---------- */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: center; padding: 0.75rem;
  pointer-events: none; animation: slideUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
.cookie-card {
  pointer-events: auto; width: 100%; max-width: 62rem;
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1.1rem 1.25rem; border-radius: 20px;
  background: rgba(255, 255, 255, 0.96); border: 1px solid #e2e8f0;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.35);
}
@media (min-width: 860px) { .cookie-card { flex-direction: row; align-items: center; gap: 1.5rem; padding: 1.2rem 1.5rem; } }
.cookie-text { font-size: 0.82rem; line-height: 1.55; color: #475569; }
.cookie-title { margin-bottom: 0.2rem; font-size: 0.95rem; font-weight: 800; color: #0f172a; }
.cookie-text a { color: var(--indigo); text-decoration: underline; text-underline-offset: 2px; }
.cookie-actions { display: flex; flex: none; flex-wrap: wrap; gap: 0.5rem; }
.cookie-btn { padding: 0.65rem 1.15rem; font-size: 0.82rem; }
@media (max-width: 859px) { .cookie-actions .cookie-btn { flex: 1 1 30%; padding-left: 0.6rem; padding-right: 0.6rem; } }
.cookie-actions .btn-ghost { border-color: #e2e8f0; }

/* ---------- Bloque informativo de provincia ---------- */
.province-banner {
  margin-bottom: 1.5rem; padding: 1.4rem; border-radius: 24px;
  border: 1px solid #c7d2fe;
  background: linear-gradient(135deg, #eef2ff 0%, #fff 60%);
  box-shadow: 0 18px 36px -24px rgba(79, 70, 229, 0.5);
  animation: fadeUp 0.5s ease both;
}
@media (min-width: 640px) { .province-banner { padding: 1.8rem 2rem; } }
.pstat {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.95rem 1.1rem; border-radius: 16px; background: #fff; border: 1px solid #e2e8f0;
}
.pstat-label { font-size: 0.72rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.pstat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; color: #0f172a; }
.pstat-sub { font-size: 0.76rem; color: #64748b; }

/* ---------- Cuadrícula de provincias ---------- */
.prov-link {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.75rem 0.9rem; border-radius: 14px;
  border: 1px solid #e2e8f0; background: #fff; text-decoration: none;
  transition: all 0.2s ease;
}
.prov-link:hover, .prov-link:focus-visible {
  border-color: #a5b4fc; background: #eef2ff; transform: translateY(-1px);
  box-shadow: 0 10px 20px -14px rgba(79, 70, 229, 0.6); outline: none;
}
.prov-link.is-current { border-color: var(--indigo); background: #eef2ff; box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2); }
.prov-name { font-size: 0.9rem; font-weight: 700; color: #0f172a; }
.prov-meta { font-size: 0.72rem; color: #64748b; }

/* ---------- Artículo local por provincia ---------- */
.local-article { font-size: 0.92rem; line-height: 1.75; color: #475569; }
.local-article h3 { margin: 1.4rem 0 0.4rem; font-size: 1.02rem; font-weight: 800; color: #0f172a; }
.local-article h3:first-child { margin-top: 0; }
.local-article p { margin: 0.5rem 0; }
.local-article strong { color: #0f172a; }
.local-note { font-size: 0.78rem; color: #94a3b8; }