/**
 * UNIVERSAL HEADER COMPONENT
 * Header universal que se adapta al estado de autenticación
 * Siguiendo el patrón de redes sociales profesionales
 * 
 * @author MrGreen Development Team
 * @version 2.0.0
 * @since 2025-01-08
 */

/* ===== VARIABLES CSS ===== */
:root {
  /* Header dimensions */
  --header-height: 64px;
  --header-padding: 0 24px;
  --header-z-index: 10000;
  
  /* Colors */
  --header-bg: #ffffff;
  --header-border: #e5e7eb;
  --header-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  
  /* Logo */
  --logo-size: 32px;
  --logo-text-size: 1.5rem;
  --logo-text-weight: 700;
  --logo-color: #ff0050;
  
  /* Search */
  --search-height: 40px;
  --search-bg: #f3f4f6;
  --search-border: #e5e7eb;
  --search-focus-border: #53fc1b;
  --search-focus-shadow: 0 0 0 3px rgba(83, 252, 27, 0.1);
  
  /* Buttons */
  --btn-height: 36px;
  --btn-padding: 0 16px;
  --btn-radius: 8px;
  --btn-primary-bg: #53fc1b;
  --btn-primary-hover: #4ae317;
  --btn-secondary-bg: #f3f4f6;
  --btn-secondary-hover: #e5e7eb;
  
  /* Transitions */
  --header-transition: all 0.2s ease;
}

/* ===== HEADER PRINCIPAL ===== */
.universal-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--header-z-index);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--header-shadow);
  height: var(--header-height);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.universal-header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: var(--header-padding);
  max-width: 100%;
}

/* ===== LADO IZQUIERDO - LOGO ===== */
.universal-header__left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.universal-header__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: var(--header-transition);
}

.universal-header__logo:hover {
  transform: scale(1.02);
  text-decoration: none;
}

.universal-header__logo-img {
  height: var(--logo-size);
  width: var(--logo-size);
  object-fit: contain;
}

.universal-header__logo-text {
  font-size: var(--logo-text-size);
  font-weight: var(--logo-text-weight);
  color: var(--logo-color);
  letter-spacing: -0.5px;
}

.universal-header__beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  margin-left: 8px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 4px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.universal-header__logo:hover .universal-header__beta-badge {
  opacity: 1;
  transform: translateY(-1px);
}

/* ===== CENTRO - BÚSQUEDA ===== */
.universal-header__center {
  flex: 1;
  display: flex !important;
  justify-content: center;
  align-items: center;
  max-width: 600px;
  margin: 0 32px;
}

.universal-header__search {
  position: relative;
  width: 100%;
  max-width: 500px;
  z-index: 10001; /* Asegurar que el contenedor esté por encima */
}

.universal-header__search-input {
  width: 100%;
  height: var(--search-height);
  padding: 0 16px 0 40px;
  border: 1px solid var(--search-border);
  border-radius: 20px;
  background: var(--search-bg);
  color: #374151;
  font-size: 14px;
  transition: var(--header-transition);
  outline: none;
}

.universal-header__search-input:focus {
  background: #ffffff;
  border-color: var(--search-focus-border);
  box-shadow: var(--search-focus-shadow);
}

.universal-header__search-input::placeholder {
  color: #9ca3af;
}

.universal-header__search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 14px;
  pointer-events: none;
}

.universal-header__search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--header-transition);
}

.universal-header__search-clear:hover {
  background: #f3f4f6;
  color: #374151;
}

/* ===== LADO DERECHO - ACCIONES DE USUARIO ===== */
.universal-header__right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* ===== MENÚ DE USUARIO AUTENTICADO ===== */
.universal-header__user-menu {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

/* Notificaciones */
.universal-header__notifications {
  position: relative;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.universal-header__notifications:hover {
  background: #e4e6eb;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transform: translateY(-1px);
}

.universal-header__notifications i {
  font-size: 18px;
  color: #050505;
}

.universal-header__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  background: #e41e3f;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(228, 30, 63, 0.35);
}

body.notification-preview-open {
  overflow: hidden;
}

.notification-preview-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}

.notification-preview-modal.is-visible {
  display: flex;
}

.notification-preview-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
}

.notification-preview-modal__card {
  position: relative;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: hidden;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 25px 65px rgba(15, 23, 42, 0.25);
  padding: 28px;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.notification-preview-modal__content {
  overflow-y: auto;
  padding-right: 4px;
}

.notification-preview-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.06);
  color: #111827;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.notification-preview-modal__close:hover {
  background: rgba(15, 23, 42, 0.12);
  color: #000;
}

.notification-preview-modal__loading,
.notification-preview-modal__error {
  padding: 60px 20px;
  text-align: center;
  font-size: 15px;
  color: #4b5563;
}

.notification-preview-modal__error a {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.notification-preview-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.notification-preview-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.notification-preview-card__badge {
  background: rgba(17, 24, 39, 0.08);
  color: #0f172a;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  text-transform: capitalize;
}

.notification-preview-card__time {
  font-size: 13px;
  color: #6b7280;
}

.notification-preview-card__context {
  border: 1px dashed rgba(15, 23, 42, 0.15);
  border-radius: 16px;
  padding: 16px;
  background: rgba(249, 250, 251, 0.8);
}

.notification-preview-card__context-title {
  font-weight: 600;
  margin: 0 0 4px;
  color: #111827;
}

.notification-preview-card__context-text {
  margin: 0;
  font-size: 14px;
  color: #374151;
}

.notification-preview-card__quote {
  margin-top: 10px;
  padding-left: 14px;
  border-left: 3px solid #9ca3af;
  color: #1f2937;
  font-style: italic;
}

.notification-preview-card__post {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notification-preview-card__author {
  display: flex;
  gap: 12px;
  align-items: center;
}

.notification-preview-card__author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(15, 23, 42, 0.05);
}

.notification-preview-card__author-name {
  font-weight: 600;
  color: #0f172a;
}

.notification-preview-card__author-meta {
  font-size: 13px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 6px;
}

.notification-preview-card__author-meta .separator {
  color: rgba(107, 114, 128, 0.6);
}

.notification-preview-card__post-title {
  margin: 0;
  font-size: 18px;
  color: #111827;
}

.notification-preview-card__text {
  font-size: 15px;
  color: #1f2937;
  line-height: 1.6;
  white-space: pre-wrap;
}

.notification-preview-card__media {
  border-radius: 18px;
  overflow: hidden;
  background: #000;
}

.notification-preview-card__media img,
.notification-preview-card__media iframe {
  display: block;
  width: 100%;
  height: 100%;
}

.notification-preview-card__media--video {
  aspect-ratio: 16 / 9;
}

.notification-preview-card__footer {
  display: flex;
  justify-content: flex-end;
}

.notification-preview-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f172a, #111827);
  color: #f8fafc;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
}

.notification-preview-card__cta:hover {
  filter: brightness(1.05);
}

@media (max-width: 640px) {
  .notification-preview-modal {
    padding: 12px;
  }

  .notification-preview-modal__card {
    padding: 20px;
  }

  .notification-preview-card__author {
    align-items: flex-start;
  }
}

.universal-header__notifications-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background: white;
  border: 1px solid var(--header-border);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--header-transition);
  z-index: 1000;
}

.universal-header__notifications-header {
  padding: 16px;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid var(--header-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.universal-header__notifications-friend-requests-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: all 0.2s ease;
}

.universal-header__notifications-friend-requests-link:hover {
  background: #e5e7eb;
  color: #111827;
}

.universal-header__notifications-friend-requests-badge {
  background: #3b82f6;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

.universal-header__notifications-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--header-border);
  background: #f9fafb;
}

.universal-header__notifications-view-all {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: all 0.2s ease;
  width: 100%;
  justify-content: center;
}

.universal-header__notifications-view-all:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #111827;
}

.universal-header__notifications-list {
  max-height: 300px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}

.universal-header__notification-item {
  border-bottom: 1px solid var(--header-border);
  padding: 14px 16px;
  transition: background 0.2s ease;
}

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

.universal-header__notification-item.is-unread {
  background: #f9fafb;
}

.universal-header__notification-link {
  display: block;
  text-decoration: none;
  color: inherit;
  gap: 6px;
}

.universal-header__notification-title {
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
  margin-bottom: 4px;
}

.universal-header__notification-message {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.4;
  margin-bottom: 4px;
}

.universal-header__notification-time {
  font-size: 12px;
  color: #9ca3af;
}

.universal-header__notifications-empty {
  padding: 32px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
}

/* Avatar de usuario */
.universal-header__user-avatar {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: var(--header-transition);
}

.universal-header__user-avatar:hover {
  background: #f3f4f6;
}

.universal-header__avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* Dropdown de usuario */
.universal-header__dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 280px;
  max-height: calc(100vh - 80px); /* Altura máxima: viewport menos espacio del header */
  background: white;
  border: 1px solid var(--header-border);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 10001; /* Mayor que el header (10000) para aparecer por encima */
  pointer-events: none; /* Deshabilitar interacción cuando está oculto */
  margin-top: 8px; /* Espacio entre el avatar y el dropdown */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Ocultar overflow del contenedor principal */
}

.universal-header__user-menu.is-open .universal-header__dropdown {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  pointer-events: auto !important; /* Habilitar interacción cuando está visible */
  display: block !important; /* Forzar display block cuando está abierto */
}

.universal-header__dropdown-header {
  padding: 16px;
  border-bottom: 1px solid var(--header-border);
  flex-shrink: 0; /* No se encoge, siempre visible */
}

.universal-header__dropdown-name {
  font-weight: 600;
  color: #374151;
  font-size: 16px;
}

.universal-header__dropdown-email {
  color: #9ca3af;
  font-size: 14px;
  margin-top: 2px;
}

.universal-header__dropdown-content {
  padding: 8px 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0; /* Permite que el flex funcione correctamente con overflow */
  max-height: calc(100vh - 160px); /* Altura máxima del contenido */
}

/* Scrollbar personalizada para el dropdown */
.universal-header__dropdown-content::-webkit-scrollbar {
  width: 6px;
}

.universal-header__dropdown-content::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

.universal-header__dropdown-content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.universal-header__dropdown-content::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.universal-header__dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #374151;
  text-decoration: none;
  transition: var(--header-transition);
}

/* Sección de administración - texto más pequeño */
.universal-header__dropdown-admin-section .universal-header__dropdown-item {
  font-size: 13px;
  padding: 10px 16px;
}

.universal-header__dropdown-admin-section .universal-header__dropdown-section-title {
  font-size: 11px;
  padding: 10px 16px 6px;
}

.universal-header__dropdown-admin-section .universal-header__dropdown-item i {
  font-size: 14px;
}

.universal-header__dropdown-admin-section .universal-header__dropdown-section-title i {
  font-size: 12px;
}

.universal-header__dropdown-item:hover {
  background: #f3f4f6;
  text-decoration: none;
  color: #374151;
}

.universal-header__dropdown-item i {
  width: 16px;
  color: #9ca3af;
}

.universal-header__dropdown-divider {
  height: 1px;
  background: var(--header-border);
  margin: 8px 0;
}

.universal-header__dropdown-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  margin: 4px 8px;
  border-radius: 8px;
}

.universal-header__dropdown-section-title i {
  font-size: 14px;
  color: #667eea;
}

.dark-mode .universal-header__dropdown-section-title {
  color: #8094f0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
}

.dark-mode .universal-header__dropdown-section-title i {
  color: #8094f0;
}

.universal-header__dropdown-item--logout {
  color: #dc2626;
}

.universal-header__dropdown-item--logout:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* ===== SUBMENÚ DE APARIENCIA ===== */
.universal-header__dropdown-submenu {
  position: relative;
}

.universal-header__dropdown-submenu-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #374151;
  cursor: pointer;
  transition: var(--header-transition);
  position: relative;
}

.universal-header__dropdown-submenu-trigger:hover {
  background: #f3f4f6;
}

.universal-header__dropdown-submenu-trigger i:first-child {
  width: 16px;
  color: #9ca3af;
}

.universal-header__dropdown-chevron {
  margin-left: auto;
  font-size: 12px;
  color: #6b7280;
  transition: var(--header-transition);
}

.universal-header__dropdown-submenu:hover .universal-header__dropdown-chevron {
  transform: translateX(2px);
}

/* ===== PANEL SUPERPUESTO DE APARIENCIA (ESTILO FACEBOOK) ===== */
.universal-header__appearance-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 15000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.universal-header__appearance-overlay.active {
  opacity: 1;
  visibility: visible;
}

.universal-header__appearance-panel {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  width: 400px;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.universal-header__appearance-overlay.active .universal-header__appearance-panel {
  transform: translateX(0);
}

/* Header del panel */
.universal-header__appearance-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.universal-header__appearance-back {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: var(--header-transition);
  color: #374151;
}

.universal-header__appearance-back:hover {
  background: #e5e7eb;
}

.universal-header__appearance-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

/* Contenido del panel */
.universal-header__appearance-content {
  padding: 24px;
}

/* Sección de configuración */
.universal-header__appearance-section {
  margin-bottom: 32px;
}

.universal-header__appearance-section-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.universal-header__appearance-section-icon {
  font-size: 20px;
  color: #6b7280;
  margin-top: 2px;
}

.universal-header__appearance-section-info {
  flex: 1;
}

.universal-header__appearance-section-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px 0;
}

.universal-header__appearance-section-description {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  line-height: 1.4;
}

/* Opciones de radio */
.universal-header__appearance-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.universal-header__appearance-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 12px;
  row-gap: 6px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--header-transition);
  position: relative;
}

.universal-header__appearance-option:hover {
  background: #f3f4f6;
}

.universal-header__appearance-radio {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.universal-header__appearance-option-text {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  flex: 1;
}

.universal-header__appearance-option-indicator {
  width: 18px;
  height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  position: relative;
  transition: var(--header-transition);
}

.universal-header__appearance-radio:checked + .universal-header__appearance-option-text + .universal-header__appearance-option-indicator {
  border-color: #ff0050;
}

.universal-header__appearance-radio:checked + .universal-header__appearance-option-text + .universal-header__appearance-option-indicator::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: #ff0050;
  border-radius: 50%;
}

.universal-header__appearance-option-description {
  font-size: 12px;
  color: #6b7280;
  margin: 4px 0 0 0;
  line-height: 1.3;
  grid-column: 2 / 4;
}

/* ===== TOGGLE DE MODO OSCURO ===== */
.universal-header__dropdown-item--dark-mode {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: var(--header-transition);
  position: relative;
}

.universal-header__dropdown-item--dark-mode:hover {
  background: #f3f4f6;
}

.universal-header__dark-mode-icon {
  width: 16px;
  color: #9ca3af;
  transition: var(--header-transition);
}

.universal-header__dark-mode-text {
  flex: 1;
  color: #374151;
  font-size: 14px;
}

.universal-header__dark-mode-toggle {
  width: 40px;
  height: 20px;
  background: #d1d5db;
  border-radius: 10px;
  position: relative;
  transition: var(--header-transition);
  cursor: pointer;
}

.universal-header__dark-mode-switch {
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: var(--header-transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Estado activo del toggle */
.universal-header__dark-mode-toggle.active {
  background: #ff0050;
}

.universal-header__dark-mode-toggle.active .universal-header__dark-mode-switch {
  transform: translateX(20px);
}

/* Animación del icono al cambiar modo */
.universal-header__dark-mode-icon.rotating {
  animation: darkModeRotate 0.3s ease-in-out;
}

@keyframes darkModeRotate {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ===== ACCIONES DE USUARIO NO AUTENTICADO ===== */
.universal-header__guest-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.universal-header__login-btn,
.universal-header__register-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--btn-height);
  padding: var(--btn-padding);
  border-radius: var(--btn-radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--header-transition);
  border: none;
  cursor: pointer;
}

.universal-header__login-btn {
  background: var(--btn-primary-bg);
  color: #081902;
}

.universal-header__login-btn:hover {
  background: var(--btn-primary-hover);
  color: #081902;
  text-decoration: none;
  transform: translateY(-1px);
}

.universal-header__register-btn {
  background: transparent;
  color: #081902;
  border: 1px solid #081902;
}

.universal-header__register-btn:hover {
  background: #53fc1b;
  color: #081902;
  border-color: #53fc1b;
  text-decoration: none;
  transform: translateY(-1px);
}

/* ===== SPACER PARA CONTENIDO ===== */
.universal-header__spacer {
  height: var(--header-height);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .universal-header__container {
    padding: 0 16px;
    justify-content: space-between;
  }
  
  /* Ocultar barra de búsqueda en móvil */
  .universal-header__center {
    display: none !important;
  }
  
  /* Mostrar botón de búsqueda móvil */
  .universal-header__search-mobile-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
    z-index: 1;
  }
  
  .universal-header__logo-text {
    display: none;
  }
  
  .universal-header__right {
    gap: 8px;
    display: flex;
    align-items: center;
  }
  
  /* Ajustar el layout para que el botón esté entre logo y acciones */
  .universal-header__left {
    order: 0;
  }
  
  .universal-header__search-mobile-btn {
    order: 1;
    margin-left: auto;
    margin-right: 8px;
  }
  
  .universal-header__right {
    order: 2;
  }
  
  .universal-header__guest-actions {
    gap: 8px;
  }
  
  .universal-header__login-btn,
  .universal-header__register-btn {
    padding: 0 12px;
    font-size: 13px;
  }
  
  .universal-header__login-btn span,
  .universal-header__register-btn span {
    display: none;
  }
}

/* Asegurar que el buscador esté visible en escritorio */
@media (min-width: 769px) {
  .universal-header__center {
    display: flex !important;
  }
  
  .universal-header__search-mobile-btn {
    display: none !important;
    visibility: hidden !important;
  }
}

@media (max-width: 480px) {
  .universal-header__right {
    gap: 6px;
  }
  
  .universal-header__notifications-panel,
  .universal-header__dropdown {
    width: 280px;
    right: -20px;
  }
  
  /* Panel de apariencia en mobile */
  .universal-header__appearance-panel {
    width: 100vw;
  }
  
  .universal-header__appearance-content {
    padding: 16px;
  }
  
  .universal-header__appearance-header {
    padding: 16px;
  }
  
  .universal-header__appearance-title {
    font-size: 16px;
  }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {
  .universal-header__logo,
  .universal-header__search-input,
  .universal-header__login-btn,
  .universal-header__register-btn,
  .universal-header__dropdown,
  .universal-header__notifications-panel {
    transition: none;
  }
}

/* Focus visible para accesibilidad */
.universal-header__login-btn:focus-visible,
.universal-header__register-btn:focus-visible,
.universal-header__search-input:focus-visible {
  outline: 2px solid #ff0050;
  outline-offset: 2px;
}

/* ===== MODO OSCURO PARA HEADER UNIVERSAL ===== */
/* Los estilos de modo oscuro están en webroot/css/themes/_dark-theme.css */

.dark-mode .universal-header__logo-text {
  color: #f9fafb;
}

.dark-mode .universal-header__search-input {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

.dark-mode .universal-header__search-input:focus {
  background: #ffffff;
  border-color: #ff0050;
  color: #1f2937;
}

.dark-mode .universal-header__search-input::placeholder {
  color: #9ca3af;
}

.dark-mode .universal-header__search-icon {
  color: #9ca3af;
}

.dark-mode .universal-header__search-clear {
  color: #9ca3af;
}

.dark-mode .universal-header__search-clear:hover {
  background: #4b5563;
  color: #f9fafb;
}

.dark-mode .universal-header__login-btn {
  background: #53fc1b;
  color: #081902;
}

.dark-mode .universal-header__login-btn:hover {
  background: #4ae317;
  color: #081902;
}

.dark-mode .universal-header__register-btn {
  background: transparent;
  color: #53fc1b;
  border-color: #53fc1b;
}

.dark-mode .universal-header__register-btn:hover {
  background: #53fc1b;
  color: #081902;
}

.dark-mode .universal-header__notifications {
  background: #3a3b3c;
  box-shadow: none;
}

.dark-mode .universal-header__notifications:hover {
  background: #4e4f50;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.dark-mode .universal-header__notifications i {
  color: #f5f6f7;
}

.dark-mode .universal-header__notifications-panel {
  background: #18191a !important;
  border-color: #3a3b3c !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.dark-mode .universal-header__notifications-header {
  color: #f9fafb !important;
  border-bottom-color: #3a3b3c !important;
  background: #18191a !important;
}

.dark-mode .universal-header__notifications-empty {
  color: #9ca3af;
}

.dark-mode .universal-header__notifications-list {
  background: #18191a !important;
}

/* ===== ESTILOS PARA LINK DE SOLICITUDES EN NOTIFICACIONES - MODO OSCURO ===== */
.dark-mode .universal-header__notifications-friend-requests-link {
  background: rgba(83, 252, 27, 0.1) !important;
  color: #53fc1b !important;
  border: 1px solid rgba(83, 252, 27, 0.3);
}

.dark-mode .universal-header__notifications-friend-requests-link:hover {
  background: rgba(83, 252, 27, 0.2) !important;
  color: #4ae317 !important;
  border-color: rgba(83, 252, 27, 0.5);
}

.dark-mode .universal-header__notifications-view-all {
  background: transparent !important;
  border-color: #3a3b3c !important;
  color: #e4e6eb !important;
}

.dark-mode .universal-header__notifications-view-all:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: #4e4f50 !important;
  color: #f9fafb !important;
}

.dark-mode .universal-header__notifications-footer {
  background: #18191a !important;
  border-top-color: #3a3b3c !important;
}

.dark-mode .universal-header__notification-item {
  border-bottom-color: #3a3b3c !important;
  background: transparent !important;
}

.dark-mode .universal-header__notification-item.is-unread {
  background: #242526 !important;
}

.dark-mode .universal-header__notification-title {
  color: #f9fafb;
}

.dark-mode .universal-header__notification-message {
  color: rgba(226, 232, 240, 0.78);
}

.dark-mode .universal-header__notification-time {
  color: rgba(148, 163, 184, 0.7);
}

.dark-mode .universal-header__badge {
  background: #e41e3f !important;
  color: #fff;
  border-color: #18191a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

.dark-mode .notification-preview-modal__backdrop {
  background: rgba(3, 5, 10, 0.8);
}

.dark-mode .notification-preview-modal__card {
  background: #242526 !important;
  border: 1px solid #3A3B3C;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.65);
}

.dark-mode .notification-preview-modal__close {
  background: rgba(255, 255, 255, 0.05);
  color: #f4f4f5;
}

.dark-mode .notification-preview-modal__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.dark-mode .notification-preview-modal__loading,
.dark-mode .notification-preview-modal__error {
  color: rgba(226, 232, 240, 0.8);
}

.dark-mode .notification-preview-modal__error a {
  background: linear-gradient(135deg, #53fc1b, #27d06f);
  color: #041706;
}

.dark-mode .notification-preview-card__badge {
  background: rgba(148, 163, 184, 0.15);
  color: #f8fafc;
}

.dark-mode .notification-preview-card__time {
  color: rgba(226, 232, 240, 0.7);
}

.dark-mode .notification-preview-card__context {
  background: rgba(39, 39, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.2);
}

.dark-mode .notification-preview-card__context-title,
.dark-mode .notification-preview-card__context-text,
.dark-mode .notification-preview-card__quote,
.dark-mode .notification-preview-card__author-name,
.dark-mode .notification-preview-card__post-title,
.dark-mode .notification-preview-card__text {
  color: #f3f4f6;
}

.dark-mode .notification-preview-card__author-meta {
  color: rgba(226, 232, 240, 0.7);
}

.dark-mode .notification-preview-card__media {
  background: #0f0f10;
}

.dark-mode .notification-preview-card__cta {
  background: linear-gradient(135deg, #53fc1b, #2ddf73);
  color: #041706;
  box-shadow: 0 10px 25px rgba(83, 252, 27, 0.25);
}

.dark-mode .universal-header__user-avatar:hover {
  background: #374151;
}

.dark-mode .universal-header__dropdown {
  background: #242526;
  border-color: #374151;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  z-index: 10001; /* Mantener z-index alto en modo oscuro */
}

/* Scrollbar en modo oscuro */
.dark-mode .universal-header__dropdown-content::-webkit-scrollbar-track {
  background: transparent;
}

.dark-mode .universal-header__dropdown-content::-webkit-scrollbar-thumb {
  background: #4b5563;
}

.dark-mode .universal-header__dropdown-content::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

.dark-mode .universal-header__dropdown-header {
  border-bottom-color: #374151;
}

.dark-mode .universal-header__dropdown-name {
  color: #f9fafb;
}

.dark-mode .universal-header__dropdown-email {
  color: #9ca3af;
}

.dark-mode .universal-header__dropdown-item {
  color: #f9fafb;
}

.dark-mode .universal-header__dropdown-item:hover {
  background: #374151;
  color: #f9fafb;
}

.dark-mode .universal-header__dropdown-item i {
  color: #9ca3af;
}

.dark-mode .universal-header__dropdown-divider {
  background: #374151;
}

.dark-mode .universal-header__dropdown-item--logout {
  color: #f87171;
}

.dark-mode .universal-header__dropdown-item--logout:hover {
  background: #7f1d1d;
  color: #f87171;
}

/* Modo oscuro - sección de administración */
.dark-mode .universal-header__dropdown-admin-section .universal-header__dropdown-item {
  font-size: 13px;
  padding: 10px 16px;
}

.dark-mode .universal-header__dropdown-admin-section .universal-header__dropdown-section-title {
  font-size: 11px;
  padding: 10px 16px 6px;
}

/* Submenú en modo oscuro */
.dark-mode .universal-header__dropdown-submenu-trigger {
  color: #f9fafb;
}

.dark-mode .universal-header__dropdown-submenu-trigger:hover {
  background: #374151;
}

.dark-mode .universal-header__dropdown-chevron {
  color: #9ca3af;
}

.dark-mode .universal-header__dropdown-submenu-content {
  background: #1f2937;
  border-color: #374151;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dark-mode .universal-header__dropdown-item--dark-mode {
  color: #f9fafb;
}

.dark-mode .universal-header__dropdown-item--dark-mode:hover {
  background: #374151;
}

.dark-mode .universal-header__dark-mode-text {
  color: #f9fafb;
}

.dark-mode .universal-header__dark-mode-toggle {
  background: #4b5563;
}

.dark-mode .universal-header__dark-mode-toggle.active {
  background: #ff0050;
}

/* ===== MODO OSCURO PARA PANEL DE APARIENCIA ===== */
.dark-mode .universal-header__appearance-overlay {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.dark-mode .universal-header__appearance-panel {
  background: #1a1a1a !important;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.8) !important;
  border-left: 1px solid #2d2d2d !important;
  opacity: 1 !important;
  position: relative;
  z-index: 15001;
}

.dark-mode .universal-header__appearance-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #1a1a1a;
  z-index: -1;
}

/* Asegurar que el panel sea completamente opaco en modo oscuro */
.dark-mode .universal-header__appearance-overlay.active .universal-header__appearance-panel {
  background: #1a1a1a !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  transform: translateX(0) !important;
}

/* Estilo sólido como el menú principal en modo oscuro */
.dark-mode .universal-header__appearance-panel {
  background: #1a1a1a !important;
  border: 1px solid #2d2d2d !important;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.8) !important;
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  transform: translateX(0) !important;
}

.dark-mode .universal-header__appearance-header {
  background: #1a1a1a;
  border-bottom-color: #2d2d2d;
  position: relative;
  z-index: 1;
}

.dark-mode .universal-header__appearance-back {
  color: #ffffff;
}

.dark-mode .universal-header__appearance-back:hover {
  background: #2d2d2d;
}

.dark-mode .universal-header__appearance-title {
  color: #ffffff;
}

.dark-mode .universal-header__appearance-section-icon {
  color: #cccccc;
}

.dark-mode .universal-header__appearance-section-title {
  color: #ffffff;
}

.dark-mode .universal-header__appearance-section-description {
  color: #cccccc;
}

.dark-mode .universal-header__appearance-option:hover {
  background: #2d2d2d;
}

.dark-mode .universal-header__appearance-option-text {
  color: #ffffff;
}

.dark-mode .universal-header__appearance-option-description {
  color: #cccccc;
}

.dark-mode .universal-header__appearance-content {
  position: relative;
  z-index: 1;
}

.dark-mode .universal-header__appearance-option-indicator {
  border-color: #666666;
}

.dark-mode .universal-header__appearance-radio:checked + .universal-header__appearance-option-text + .universal-header__appearance-option-indicator {
  border-color: #ff0050;
}

/* Forzar posición correcta en modo oscuro */
.dark-mode .universal-header__appearance-overlay .universal-header__appearance-panel {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  width: 400px !important;
  height: 100vh !important;
  background: #1a1a1a !important;
  border-left: 1px solid #2d2d2d !important;
}

/* Asegurar que el panel siempre aparezca en el lado derecho */
.universal-header__appearance-overlay .universal-header__appearance-panel {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
}
