/* ===========================
   RESET Y BASE
=========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --verde:    #4CAF50;
  --amarillo: #FFC107;
  --rojo:     #F44336;
  --gris:     #f5f5f5;
  --texto:    #333;
  --sombra:   0 2px 10px rgba(0,0,0,0.1);
  --radio:    12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont,
               'Segoe UI', Roboto, sans-serif;
  background: var(--gris);
  color: var(--texto);
  min-height: 100vh;
}

/* ===========================
   PANTALLAS
=========================== */
.pantalla {
  display: none;
  min-height: 100vh;
  padding: 20px;
}

.pantalla.activa {
  display: flex;
  align-items: center;
  justify-content: center;
}

.contenedor {
  width: 100%;
  max-width: 480px;
}

/* ===========================
   PANTALLA BUSCAR
=========================== */
#pantalla-buscar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  align-items: flex-start;  /* ← antes era center */
  padding-top: 80px;        /* ← ajusta este valor a tu gusto */
}

#pantalla-buscar h1 {
  color: white;
  font-size: 2rem;
  text-align: center;
  margin-bottom: 30px;
}

.buscador {
  position: relative;
}

#input-municipio {
  width: 100%;
  padding: 16px 20px;
  font-size: 1.1rem;
  border: none;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  outline: none;
}

#lista-sugerencias {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 0 0 var(--radio) var(--radio);
  box-shadow: var(--sombra);
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
}

#lista-sugerencias li {
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 1rem;
}

#lista-sugerencias li:hover {
  background: var(--gris);
}

#lista-sugerencias li:last-child {
  border-bottom: none;
}

#lista-sugerencias li span {
  font-size: 0.85rem;
  color: #999;
  margin-left: 8px;
}

/* ===========================
   PANTALLA RESULTADO
=========================== */
#pantalla-resultado {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: none;
  align-items: flex-start;
  padding-top: 40px;
}

#pantalla-resultado.activa {
  display: flex;
}

#btn-volver {
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.5);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radio);
  margin-bottom: 20px;
}

#btn-volver:hover {
  background: rgba(255,255,255,0.3);
}

#pantalla-resultado .spinner {
  border-color: rgba(255,255,255,0.3);
  border-top-color: white;
}

/* ===========================
   SEMÁFORO
=========================== */
#semaforo {
  font-size: 5rem;
  text-align: center;
  margin: 20px 0 10px;
  animation: aparecer 0.5s ease;
}

@keyframes aparecer {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

#resultado-titulo {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}

#resultado-titulo.verde   { color: var(--verde); }
#resultado-titulo.amarillo { color: var(--amarillo); }
#resultado-titulo.rojo    { color: var(--rojo); }

#resultado-mensaje {
  text-align: center;
  color: #666;
  margin-bottom: 24px;
  font-size: 1rem;
}


/* ===========================
   DETALLES
=========================== */
#detalles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.detalle {
  background: white;
  border-radius: var(--radio);
  padding: 14px 18px;
  box-shadow: var(--sombra);
  font-size: 0.95rem;
  display: none;
}

.detalle.visible {
  display: block;
}

/* ===========================
   SEMÁFORO CSS
=========================== */
#semaforo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 20px auto 10px;
  animation: aparecer 0.5s ease;
}

#semaforo.verde {
  background: #4CAF50;
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
  border: 3px solid rgba(0,0,0,0.2);
}

#semaforo.amarillo {
  background: #FFC107;
  box-shadow: 0 0 20px rgba(255, 193, 7, 0.5);
  border: 3px solid rgba(0,0,0,0.2);
}

#semaforo.rojo {
  background: #F44336;
  box-shadow: 0 0 20px rgba(244, 67, 54, 0.5);
  border: 3px solid rgba(0,0,0,0.2);
}

/* ===========================
   RESULTADO CARD
=========================== */
#resultado-card {
  background: white;
  border-radius: var(--radio);
  padding: 24px;
  box-shadow: var(--sombra);
  text-align: center;
  margin-bottom: 16px;
}

#resultado-motivo {
  font-size: 0.85rem;
  color: #666;
  margin-top: 8px;
  font-style: italic;
}

/* ===========================
   BOTÓN RECORDATORIO
=========================== */
#btn-recordatorio {
  width: 100%;
  padding: 16px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: var(--radio);
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 24px;
  box-shadow: var(--sombra);
  transition: background 0.2s;
}

#btn-recordatorio:hover {
  background: #764ba2;
}

/* ===========================
   PRÓXIMOS DÍAS
=========================== */
#proximos-dias {
  background: white;
  border-radius: var(--radio);
  padding: 18px;
  box-shadow: var(--sombra);
}

#proximos-dias h3 {
  font-size: 1rem;
  color: #666;
  margin-bottom: 14px;
}

#lista-dias {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dia-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.dia-item:last-child {
  border-bottom: none;
}

.dia-fecha {
  font-weight: 600;
  font-size: 0.95rem;
}

.dia-desc {
  color: #666;
  font-size: 0.85rem;
  flex: 1;
  margin: 0 12px;
}

.dia-emoji {
  font-size: 1.4rem;
}

.aviso-fiabilidad {
  margin-top: 14px;
  font-size: 0.8rem;
  color: #999;
  text-align: center;
}

/* ===========================
   LOADING
=========================== */
#loading-overlay {
  text-align: center;
  padding-top: 40vh;
  color: white;
}

#loading {
  display: none;
  text-align: center;
  padding: 40px;
}

#loading.visible {
  display: block;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #eee;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: girar 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes girar {
  to { transform: rotate(360deg); }
}

/* ===========================
   OCULTO
=========================== */
.oculto {
  display: none !important;
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 480px) {
  #pantalla-buscar h1 {
    font-size: 1.6rem;
  }

  #semaforo {
    font-size: 4rem;
  }

  #resultado-titulo {
    font-size: 1.3rem;
  }
}

.buscador-input {
  display: flex;
  gap: 8px;
}

#input-municipio {
  flex: 1;
  padding: 16px 20px;
  font-size: 1.1rem;
  border: none;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  outline: none;
}

#btn-buscar {
  padding: 16px 20px;
  background: white;
  border: none;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-buscar:hover {
  background: #f0f0f0;
}

#municipio-recordado {
  margin-bottom: 16px;
}

#btn-recordado {
  width: 100%;
  padding: 16px 20px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: var(--radio);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}

#btn-recordado:hover {
  background: rgba(255,255,255,0.3);
}

#btn-recordado::before {
  content: '🕐 ';
}

#nombre-municipio {
  color: black;
  text-align: center;
  margin-bottom: 10px;
  font-size: 2rem;
}

