/**
 * Hello Plataforma · Header Component
 *
 * Estilos del header sticky para fan y creadora.
 * Se cargan desde functions.php cuando hay header presente.
 */


/* ============================================================
   HEADER BASE
   ============================================================ */

.hp-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--hp-border-subtle);
  transition: background-color var(--hp-duration-normal) var(--hp-ease),
              border-color var(--hp-duration-normal) var(--hp-ease),
              box-shadow var(--hp-duration-normal) var(--hp-ease);
}

/* Cuando hay scroll: sombra sutil + borde más visible */
.hp-header.is-scrolled {
  background: rgba(255, 255, 255, 0.95);
  border-bottom-color: var(--hp-border-purple);
  box-shadow: 0 2px 12px -4px rgba(105, 73, 158, 0.08);
}

.hp-header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  max-width: 100%;
  min-height: 56px;
}


/* ============================================================
   BOTÓN BACK
   ============================================================ */

.hp-header-back {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  transition: background-color var(--hp-duration-normal) var(--hp-ease);
}

.hp-header-back:hover {
  background: var(--hp-bg-card);
}

.hp-header-back i {
  font-size: 22px;
  color: var(--hp-text-primary);
}


/* ============================================================
   CREATOR INFO (lado izquierdo)
   ============================================================ */

.hp-header-creator {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.hp-header-creator-info {
  min-width: 0;
  flex: 1;
}

.hp-header-creator-name {
  font-family: var(--hp-font-base);
  font-size: 14px;
  font-weight: 600;
  color: var(--hp-text-primary);
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hp-header-creator-status {
  font-family: var(--hp-font-base);
  font-size: 11px;
  margin: 1px 0 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hp-header-status-online {
  color: var(--hp-green-success);
}

.hp-header-status-recent {
  color: var(--hp-text-secondary);
}

.hp-header-status-offline {
  color: var(--hp-text-tertiary);
}


/* ============================================================
   GREETING (creadora)
   ============================================================ */

.hp-header-greeting {
  flex: 1;
  min-width: 0;
}

.hp-header-greeting .hp-tag {
  margin: 0;
  display: block;
}

.hp-header-greeting-name {
  font-family: var(--hp-font-base);
  font-size: 18px;
  font-weight: 700;
  color: var(--hp-text-primary);
  margin: 2px 0 0;
  letter-spacing: -0.4px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ============================================================
   TITLE (cuando se muestra título de pantalla)
   ============================================================ */

.hp-header-title,
.hp-header-title-creator {
  font-family: var(--hp-font-base);
  font-size: 14px;
  font-weight: 600;
  color: var(--hp-text-primary);
  margin: 0;
  flex: 1;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ============================================================
   ACCIONES (lado derecho)
   ============================================================ */

.hp-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.hp-header-action {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: var(--hp-bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-decoration: none !important;
  color: inherit;
  transition: background-color var(--hp-duration-normal) var(--hp-ease),
              transform var(--hp-duration-fast) var(--hp-ease);
}

/* Defensa nuclear: ningún elemento del header debe tener decoración */
.hp-header,
.hp-header *,
.hp-header-back,
.hp-header-back *,
.hp-header-action,
.hp-header-action *,
.hp-header a,
.hp-header a *,
.hp-header a:hover,
.hp-header a:hover *,
.hp-header-action:hover,
.hp-header-action:hover *,
.hp-header-action:focus,
.hp-header-action:focus *,
.hp-header-back:hover,
.hp-header-back:hover *,
.hp-header-back:focus,
.hp-header-back:focus * {
  text-decoration: none !important;
  border-bottom: 0 !important;
}

.hp-header-action:hover {
  background: var(--hp-border-subtle);
}

.hp-header-action:active {
  transform: scale(0.95);
}

.hp-header-action i {
  font-size: 18px;
  color: var(--hp-text-primary);
}

/* Pulso sutil cuando hay notificaciones sin ver */
.hp-header-action.has-unread .hp-header-badge {
  animation: hpBadgePulse 2400ms ease-in-out infinite;
}

@keyframes hpBadgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 1px 3px rgba(105, 73, 158, 0.30);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(105, 73, 158, 0.55);
  }
}


/* ============================================================
   LEGAL ACTION (icono avisos legales con respiración)
   "Sensación de activo en tiempo real"
   ============================================================ */

.hp-header-action--legal {
  background: linear-gradient(135deg, rgba(212, 191, 232, 0.45) 0%, rgba(168, 135, 208, 0.25) 100%);
  border: 0.5px solid rgba(149, 117, 205, 0.35);
  animation: hpLegalBreath 2800ms ease-in-out infinite;
  position: relative;
}

.hp-header-action--legal i {
  color: var(--hp-purple-deep) !important;
  filter: drop-shadow(0 1px 2px rgba(105, 73, 158, 0.30));
  /* Refuerzo visual del icono */
  -webkit-text-stroke: 0.5px currentColor;
}

.hp-header-action--legal:hover {
  background: linear-gradient(135deg, rgba(212, 191, 232, 0.65) 0%, rgba(168, 135, 208, 0.40) 100%);
  border-color: rgba(149, 117, 205, 0.55);
  animation: none;
  /* Pequeño scale al hover */
  transform: scale(1.04);
}

.hp-header-action--legal:hover i {
  transform: rotate(-4deg);
  transition: transform var(--hp-duration-normal) var(--hp-ease);
}

/* Aura externa (halo de respiración) */
.hp-header-action--legal::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  background: radial-gradient(circle, rgba(149, 117, 205, 0.30) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  animation: hpLegalHalo 2800ms ease-in-out infinite;
  z-index: -1;
}

@keyframes hpLegalBreath {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(149, 117, 205, 0.40),
      inset 0 1px 0 rgba(255, 255, 255, 0.20);
  }
  50% {
    box-shadow:
      0 0 0 6px rgba(149, 117, 205, 0),
      inset 0 1px 0 rgba(255, 255, 255, 0.30);
  }
}

@keyframes hpLegalHalo {
  0%, 100% {
    opacity: 0;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.55;
    transform: scale(1.15);
  }
}

/* Respeta prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .hp-header-action--legal,
  .hp-header-action--legal::before {
    animation: none;
  }
}


/* ============================================================
   BADGE DE NOTIFICACIONES
   ============================================================ */

.hp-header-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--hp-gradient-purple-button);
  color: #FFFFFF;
  font-family: var(--hp-font-base);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  border: 1.5px solid var(--hp-bg-primary);
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  box-shadow: 0 1px 3px rgba(105, 73, 158, 0.30);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (min-width: 768px) {
  .hp-header-inner {
    padding: 14px 24px;
    max-width: 720px;
    margin: 0 auto;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .hp-header-inner {
    max-width: 960px;
  }
}


/* ============================================================
   PADDING-TOP DEL BODY PARA COMPENSAR HEADER STICKY
   Solo cuando el header está visible
   ============================================================ */

body.hp-has-sticky-header {
  /* No padding-top adicional porque el header es sticky desde el inicio,
     no fixed. Esto permite que el contenido empiece debajo naturalmente. */
}


/* ============================================================
   ELEMENTOR COMPATIBILITY
   Override de algunos estilos default de Hello Elementor
   ============================================================ */

/* Si Elementor mete su header genérico, lo escondemos cuando
   estamos usando el nuestro */
.hp-using-custom-header .site-header,
.hp-using-custom-header .elementor-location-header {
  display: none;
}