:root {
  --bg: #f0f4f8;
  --card: #fff;
  --primary: #2c3e50;
  --accent: #3498db;
  --text: #333;
  --success: #27ae60;
  --clima-bg: #e8f4fd;
  --clima-border: #3498db;
}

/* Reset y base */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background-color: var(--bg);
  padding: 20px;
  color: var(--text);
  overflow-x: hidden;
}
header {
  text-align: center;
  margin-bottom: 30px;
}
header h1 {
  color: var(--primary);
  margin-bottom: 10px;
}
footer {
  text-align: center;
  padding: 20px 0 10px 0;
  color: #f0f4f8;
  font-size: 15px;
  background: #222c36;
  margin-top: 40px;
  letter-spacing: 0.5px;
}
footer a {
  color: #7ec3ff;
  text-decoration: none;
  transition: color 0.2s;
}
footer a:hover {
  text-decoration: underline;
  color: #fff;
}

/* CONTENEDOR DE FILTROS Y BOTONES */
.filtros {
  width: 100%;
  margin-bottom: 30px;
}

.busqueda-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin: 30px auto 40px auto;
  max-width: 1000px;
}

.busqueda-container select,
.busqueda-container button,
.busqueda-container a.ad-contact-button {
  font-size: 1.1em;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  margin: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  box-sizing: border-box;
}

.busqueda-container button {
  background: #28a745;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(40,167,69,0.08);
}

.busqueda-container button:hover {
  background: #218838;
  transform: translateY(-1px);
}

.geo-button {
  background: #20b2aa !important;
}

.geo-button:hover {
  background: #178f8a !important;
}

.ad-contact-button {
  background: linear-gradient(135deg, #f39c12, #e67e22) !important;
  color: #fff !important;
  font-weight: 600;
  border: none !important;
  box-shadow: 0 2px 6px rgba(230, 126, 34, 0.3) !important;
}

.ad-contact-button:hover {
  background: linear-gradient(135deg, #e67e22, #d35400) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(230, 126, 34, 0.4) !important;
}

.reset-button {
  background: #dc3545 !important;
  color: #fff !important;
}

.reset-button:hover {
  background: #c82333 !important;
}

#btn-electrico {
  background-color: #28a745;
  color: white;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s;
}

#btn-electrico:hover {
  background-color: #218838;
}

#btn-electrico:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

/* RESPONSIVE PARA MÓVILES - ESPACIADO OPTIMIZADO Y COMPACTO */
@media (max-width: 768px) {
  body {
    padding: 10px 8px;
  }
  
  header {
    margin-bottom: 5px;
    padding: 10px 5px;
  }
  
  header h1 {
    font-size: 1.4em;
    margin: 0 0 2px 0;
  }
  
  header p {
    font-size: 0.8em;
    margin: 0;
  }

  .filtros {
    padding: 0;
    margin-bottom: 8px;
  }
  
  .busqueda-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-width: 100%;
    margin: 10px auto;
  }
  
  .busqueda-container select,
  .busqueda-container button,
  .busqueda-container a.ad-contact-button {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 13.5px;
    border-radius: 8px;
    box-sizing: border-box;
    touch-action: manipulation;
  }

  #carburante {
    grid-column: 1 / -1;
  }

  #btn-publicidad {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  body {
    padding: 8px 6px;
  }
  
  .busqueda-container {
    gap: 6px;
    margin: 8px auto;
  }
  
  .busqueda-container select,
  .busqueda-container button,
  .busqueda-container a.ad-contact-button {
    min-height: 40px;
    padding: 8px 8px;
    font-size: 13px;
  }
}

/* SPINNER GLOBAL */
#spinner-global {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 9999;
  display: none;
}
.spinner-overlay {
  background: rgba(0, 0, 0, 0.8);
  width: 100%; height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(2px);
}
.spinner-content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 2px solid #007bff;
}
.spinner-icon {
  font-size: 3em;
  margin-bottom: 15px;
  animation: spin 2s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
#mensaje-carga {
  font-size: 16px;
  margin-bottom: 20px;
  color: #333;
  font-weight: 600;
  min-height: 20px;
}
.spinner-bar {
  width: 100%;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 15px;
}
.spinner-progress {
  height: 100%;
  background: linear-gradient(90deg, #007bff, #0056b3);
  animation: progress 2s ease-in-out infinite;
}
@keyframes progress {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}
.spinner-tip {
  color: #6c757d;
  font-size: 12px;
  margin-top: 10px;
}
@media (max-width: 768px) {
  .spinner-content {
    margin: 20px;
    padding: 25px 20px;
    max-width: 280px;
  }
  #mensaje-carga { font-size: 14px; }
  .spinner-icon { font-size: 2.5em; }
}

/* ESTILOS DEL CLIMA COMPACTO (PÍLDORA HORIZONTAL) */
#clima-info { 
  margin: 4px auto 10px auto; 
  max-width: 1250px;
  padding: 0 10px;
  box-sizing: border-box;
}

.clima-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 20px;
  padding: 6px 14px;
  box-shadow: 0 1px 4px rgba(56, 189, 248, 0.12);
  gap: 10px;
  max-width: 600px;
  margin: 0 auto;
  font-size: 13px;
  color: #0369a1;
  box-sizing: border-box;
}

.clima-pill-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clima-mini-icono {
  width: 28px;
  height: 28px;
  vertical-align: middle;
}

.clima-pill-left strong {
  font-size: 14px;
  color: #0284c7;
}

.clima-desc-text {
  color: #0369a1;
  font-size: 12.5px;
}

.clima-pill-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #0c4a6e;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .clima-pill {
    padding: 5px 10px;
    font-size: 12px;
    gap: 6px;
    border-radius: 16px;
  }
  .clima-desc-text {
    display: none;
  }
  .clima-pill-right {
    gap: 6px;
    font-size: 11px;
  }
}

.clima-loading, .clima-error {
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 12px;
}
.clima-loading {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}
.clima-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ESTILOS DE GASOLINERAS */
#resultados, #resultados-electricos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  max-width: 1250px;
  margin: 0 auto;
  overflow: visible;
  padding: 0 15px;
}
.gasolinera {
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.gasolinera:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}
.gasolinera h3 {
  margin-top: 0;
  color: var(--accent);
}
.gasolinera p {
  margin: 6px 0;
  font-size: 14px;
}
.gasolinera a {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.gasolinera a:hover {
  color: var(--primary);
  text-decoration: underline;
}
.distancia {
  color: var(--success);
  font-weight: bold;
}
.destacada {
  border: 2px solid var(--accent);
  background-color: #e8f4ff;
}
.destacada::before {
  content: "⭐ Más barata";
  position: absolute;
  top: -8px;
  right: 10px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 10;
}
.cercana {
  border: 2px solid var(--success);
  background-color: #e8f5e8;
}
.cercana::before {
  content: "📍 Cercana";
  position: absolute;
  top: -8px;
  right: 10px;
  background: var(--success);
  color: white;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 10;
}

/* Cabecera de información de resultados */
.resultados-info-header {
  grid-column: 1 / -1;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 4px;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

.resultados-info-header h3 {
  font-size: 1.05em;
  margin: 0;
}

.resultados-info-header p {
  font-size: 0.85em;
  margin: 2px 0 0 0;
}

/* Banner Publicitario / Patrocinado Hero Compacto */
.ad-banner-hero {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #fffdf2 0%, #fff9e8 100%);
  border: 1.5px solid #f1c40f;
  border-radius: 10px;
  padding: 12px 18px;
  box-shadow: 0 2px 8px rgba(241, 196, 15, 0.18);
  position: relative;
  margin-bottom: 4px;
  box-sizing: border-box;
}

.ad-banner-hero .ad-badge {
  position: absolute;
  top: -8px;
  left: 15px;
  background: linear-gradient(135deg, #f39c12, #d35400);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  letter-spacing: 0.5px;
}

.ad-banner-info {
  flex: 1 1 280px;
}

.ad-banner-info h3 {
  margin: 2px 0 2px 0;
  color: #2c3e50;
  font-size: 1.1em;
}

.ad-banner-info p {
  margin: 2px 0;
  font-size: 12.5px;
  color: #555;
  line-height: 1.35;
}

.ad-banner-info .ad-highlight {
  display: inline-block;
  background: #fef5d1;
  color: #8a6d3b;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 3px;
  font-size: 11.5px;
  border-left: 3px solid #f1c40f;
}

.ad-banner-action {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ad-banner-action .ad-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #27ae60, #219653);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 2px 6px rgba(39, 174, 96, 0.25);
  white-space: nowrap;
}

.ad-banner-action .ad-cta:hover {
  background: linear-gradient(135deg, #219653, #1e8449);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .ad-banner-hero {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    padding: 12px 14px;
    gap: 8px;
  }
  .ad-banner-action {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
  }
  .ad-banner-action .ad-cta {
    width: 100%;
    margin: 0 !important;
    text-align: center;
    box-sizing: border-box;
    padding: 9px 8px;
    font-size: 12.5px;
  }
}

/* Guía explicativa de conectores eléctricos */
.guia-conectores {
  grid-column: 1 / -1;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 5px;
  box-sizing: border-box;
}

.guia-conectores details {
  width: 100%;
}

.guia-conectores summary {
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  font-size: 1.05em;
  outline: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guia-conectores summary::-webkit-details-marker {
  color: var(--accent);
}

.conectores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.conector-card-info {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.conector-card-info h4 {
  margin: 0 0 4px 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.conector-card-info p {
  margin: 0;
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
}

.conector-card-info .tag-potencia {
  display: inline-block;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 5px;
}

.tag-ccs { background: #e0f2fe; color: #0369a1; }
.tag-type2 { background: #ecfdf5; color: #047857; }
.tag-chademo { background: #fef3c7; color: #b45309; }
.tag-schuko { background: #f1f5f9; color: #475569; }

.conector-item {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin: 2px 4px 2px 0;
  font-weight: 500;
}

/* Responsive para tarjetas y clima */
@media (max-width: 768px) {
  .destacada::before,
  .cercana::before {
    right: 5px;
    top: -6px;
    font-size: 10px;
    padding: 3px 6px;
  }
  .gasolinera {
    margin: 0;
    padding: 12px 14px;
  }
  .gasolinera h3 {
    font-size: 1.05em;
    margin-bottom: 4px;
  }
  .gasolinera p {
    margin: 4px 0;
    font-size: 13px;
  }
}

/* =======================================================
   SECCIÓN SEO: GUÍA DE AHORRO, FAQ Y BOTÓN VIRAL
   ======================================================= */
.seo-guide-container {
  max-width: 1200px;
  margin: 40px auto 20px auto;
  padding: 0 15px;
}

.seo-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid #e9ecef;
}

.seo-card h2 {
  color: #2c3e50;
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.4em;
}

.seo-card p {
  color: #555;
  line-height: 1.6;
  margin-bottom: 20px;
  font-size: 0.95em;
}

.seo-faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 25px 0;
}

.faq-item {
  background: #f8fafc;
  border-radius: 8px;
  padding: 18px;
  border-left: 4px solid #28a745;
}

.faq-item h3 {
  margin: 0 0 8px 0;
  font-size: 1.05em;
  color: #1e293b;
}

.faq-item p {
  margin: 0;
  font-size: 0.9em;
  color: #64748b;
  line-height: 1.5;
}

.viral-share-box,
.viral-share-box-inline {
  grid-column: 1 / -1;
  text-align: center;
  background: #f0fdf4;
  border: 1px dashed #86efac;
  border-radius: 12px;
  padding: 18px 20px;
  margin: 15px 0;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.08);
}

.viral-share-box p,
.viral-share-box-inline p {
  margin: 0 0 10px 0;
  font-weight: 600;
  color: #166534;
  font-size: 1.05em;
}

.btn-share-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25d366;
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 25px;
  font-size: 1em;
  box-shadow: 0 3px 8px rgba(37, 211, 102, 0.3);
  transition: all 0.2s ease;
}

.btn-share-whatsapp:hover {
  background: #1ebc59;
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(37, 211, 102, 0.4);
}

@media (max-width: 500px) {
  #resultados, #resultados-electricos {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}