.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #222;
  padding: 0.5rem 1rem;
  color: #fff;
  position: relative;
  z-index: 1000;
}

.site-header .logo {
  height: 40px;
  width: auto;
}

.site-header .logo a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
}

#nav-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
  display: none;
  z-index: 1001;
}

.nav-menu {
  display: flex;
  gap: 1rem;
}

.nav-menu a,
.nav-menu button {
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}

.nav-menu button:hover,
.nav-menu a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.nav-social-icons {
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-icon {
  font-size: 1.5rem;
  color: #fff;
  transition: transform 0.3s ease;
}

.social-icon:hover {
  transform: scale(1.2);
  color: #ff4081;
}

/* ============================================
   INDICADOR DE DEUDA EN HEADER
   ============================================ */

.header-user-section {
  position: relative;
}

.nav-perfil-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.indicador-deuda {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 12px;
  height: 12px;
  background: #e74c3c;
  border-radius: 50%;
  border: 2px solid #1a1a2e;
  animation: pulse-deuda 2s infinite;
  cursor: pointer;
  z-index: 10;
}

/* Tooltip en hover (escritorio) */
.indicador-deuda::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #e74c3c;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.indicador-deuda::before {
  content: '';
  position: absolute;
  top: 100%;
  right: 10px;
  margin-top: 2px;
  border: 6px solid transparent;
  border-bottom-color: #e74c3c;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Mostrar tooltip en hover (escritorio) */
@media (hover: hover) {
  .indicador-deuda:hover::after,
  .indicador-deuda:hover::before {
    opacity: 1;
    visibility: visible;
  }
}

/* Mostrar tooltip activo (móvil - activado por JS) */
.indicador-deuda.tooltip-activo::after,
.indicador-deuda.tooltip-activo::before {
  opacity: 1;
  visibility: visible;
}

@keyframes pulse-deuda {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(231, 76, 60, 0);
  }
}

/* ========== INDICADOR DE AVISOS ========== */
.nav-perfil-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.indicador-avisos {
  position: absolute;
  top: -8px;
  right: -12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: bold;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: pulso 2s infinite;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Colores según tipo de aviso */
.indicador-avisos.aviso-deuda {
  background: #ef4444; /* Rojo para deuda */
}

.indicador-avisos.aviso-encuesta {
  background: #f59e0b; /* Naranja para encuesta */
}

.indicador-avisos.aviso-reto {
  background: #ffd700; /* Amarillo dorado para reto */
}

.indicador-avisos.aviso-multiple {
  background: linear-gradient(135deg, #ef4444 50%, #f59e0b 50%); /* Rojo y naranja */
}

.indicador-avisos.aviso-deuda-reto {
  background: linear-gradient(135deg, #ef4444 50%, #ffd700 50%); /* Rojo y amarillo */
}

.indicador-avisos.aviso-reto-encuesta {
  background: linear-gradient(135deg, #ffd700 50%, #f59e0b 50%); /* Amarillo y naranja */
}

.indicador-avisos.aviso-resultado {
  background: #0a7a5a; /* Verde para resultado pendiente */
}

.indicador-avisos.aviso-deuda-resultado {
  background: linear-gradient(135deg, #ef4444 50%, #0a7a5a 50%);
}

.indicador-avisos.aviso-encuesta-resultado {
  background: linear-gradient(135deg, #f59e0b 50%, #0a7a5a 50%);
}

.indicador-avisos.aviso-reto-resultado {
  background: linear-gradient(135deg, #ffd700 50%, #0a7a5a 50%);
}

@keyframes pulso {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Tooltip */
.indicador-avisos::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #1e1e1e;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: normal;
  white-space: pre-line;
  min-width: 180px;
  max-width: min(250px, calc(100vw - 40px));
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  pointer-events: none;
}

.indicador-avisos::before {
  content: '';
  position: absolute;
  top: 100%;
  right: 8px;
  margin-top: 2px;
  border: 6px solid transparent;
  border-bottom-color: #1e1e1e;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 1001;
}

/* Mostrar tooltip en hover (escritorio) */
.indicador-avisos:hover::after,
.indicador-avisos:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Mostrar tooltip activo (móvil) */
.indicador-avisos.tooltip-activo::after,
.indicador-avisos.tooltip-activo::before {
  opacity: 1;
  visibility: visible;
}

/* Responsive: ajustar posición en móvil */
@media (max-width: 768px) {
  .indicador-avisos {
    top: -6px;
    right: -10px;
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
  }

  .indicador-avisos::after {
    right: -10px;
    left: auto;
    transform: none;
    min-width: 160px;
    max-width: calc(100vw - 30px);
    font-size: 0.75rem;
  }

  .indicador-avisos::before {
    right: 4px;
    left: auto;
    transform: none;
  }
}

/* Pantallas muy pequeñas */
@media (max-width: 400px) {
  .indicador-avisos::after {
    position: fixed;
    top: 60px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    min-width: auto;
  }

  .indicador-avisos::before {
    display: none;
  }
}

/* Responsive */
@media (max-width: 768px) {
  #nav-toggle {
    display: block;
  }
  .nav-menu {
    display: none;
    flex-direction: column;
    background: #222;
    position: absolute;
    top: 60px;
    right: 0;
    padding: 1rem;
    z-index: 1000;
  }
  .nav-menu.open {
    display: flex;
  }
  .social-icon {
    font-size: 1.3rem;
  }
}
