/* =============== VARIABLES GLOBALES =============== */
:root {
  --primary-color: #4A4AFF;
  --accent-color: #CF2722;
  --light-bg: #FFFFFF;
  --light-text: #555;
  --dark-bg: #2A3142;
  --dark-text: #E0E0E0;
  --highlight: #7A9AFF;
  --shadow-dark: rgba(0, 0, 0, 0.3);
  --shadow-light: rgba(0, 0, 0, 0.1);
}
/* =============== HEADER PADDING PROTECTOR =============== */
.header::before {
  content: "";
  position: absolute;
  top: -0.75rem;
  left: -0.75rem;
  right: -0.75rem;
  bottom: -0.75rem;
  z-index: -1;
  border-radius: 1rem;
  background-color: #E6E9EE; /* fondo por defecto (blanco) */
}

/* Soporte para modo oscuro */
html.dark .header::before {
  background-color: #191F2C; /* un poco más oscuro que el fondo de body */
}

/* =============== HEADER GENERAL =============== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  margin: 0.75rem;
  padding-left: 273px; 
  transition: padding-left 0.4s ease;
}


.header__container {
  height: 5rem;
  background-color: var(--light-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  border-radius: 1rem;
  transition: all 0.4s ease;
}


/* =============== LOGO =============== */
.header__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header__logo img {
  height: 72px;
  max-width: 180px;
  object-fit: contain;
}

.logo--desktop { display: block; }
.logo--mobile { display: none; }

/* =============== BOTONES DE ACCIÓN =============== */
.header__toggle,
.header__button,
.header__user-toggle,
.header__notif-btn {
  font-size: 1.5rem;
  color: var(--light-text);
  background: none;
  border: none;
  cursor: pointer;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  position: relative;
}

/* =============== DROPDOWNS BASE =============== */
.header__notif-dropdown,
.header__user-dropdown {
  background-color: var(--light-bg);
  border: 1px solid #eee;
  padding: 0.5rem 0;
  box-shadow: 0 4px 16px var(--shadow-light);
  position: absolute;
  right: 0;
  top: 2.5rem;
  display: none;
  flex-direction: column;
  border-radius: 0.5rem;
  z-index: 10;
  
}
.header__user-dropdown {
  width: 200px;
}
.header__user-dropdown{
    width: 300px;
}
/* Dropdowns abiertos */
.show-dropdown {
  display: flex !important;
}

/* Encabezados y texto */
.header__notif-header,
.header__user-info {
  font-weight: 600;
  color: #333;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

/* Enlaces de acciones */
.header__user-dropdown a,
.header__notif-more {
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.3s;
}

.header__user-dropdown a:hover,
.header__notif-more:hover {
  background-color: #f9f9f9;
}

/* Lista de notificaciones */
.header__notif-list {
  padding: 1rem;
  font-size: 1.1rem;
  color: #777;
  text-align: center;
  max-height: 200px;
  overflow-y: auto;
}

/* Iconos */
.header__user-dropdown i,
.header__notif-more i {
  font-size: 1.2rem;
  color: var(--primary-color);
}

/* =============== RESPONSIVE HEADER CUANDO SIDEBAR ESTÁ COLAPSADO =============== */
/* =============== HEADER CUANDO SIDEBAR ESTÁ COLAPSADO =============== */

/* Ajustes para cuando el sidebar está colapsado */
body.sidebar-collapsed .header {
  padding-left: 103px !important; /* 90px sidebar + 25px separación */
}


/* Tablet (995px) - Similar al main */
@media (max-width: 995px) {
  
  
  body.sidebar-collapsed .header {
    padding-left: 100px !important;
  }
  
  .header__logo img {
    height: 60px;
    max-width: 160px;
  }
  
  .header__actions {
    gap: 1rem;
  }
}

/* Tablet pequeña (768px) - Punto de quiebre principal */
@media (max-width: 768px) {
  .header {
    padding-left: 1rem !important;
    margin: 0;
    border-radius: 0;
    width: 100%;
  }
  
  .header__container {
    border-radius: 0;
    padding: 0 1rem;
  }
  
  /* Ocultamos elementos menos importantes */
  .header__notifications .header__notif-header,
  .header__user-menu .header__user-info {
    display: none;
  }
  
  /* Ajustamos los dropdowns */
  .header__notif-dropdown,
  .header__user-dropdown {
    width: 100vw;
    right: -1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  /* Logo más pequeño */
  .logo--desktop { display: none; }
  .logo--mobile { 
    display: block;
    height: 50px;
    max-width: 140px;
  }
  
  /* Botones más compactos */
  .header__toggle,
  .header__button,
  .header__user-toggle,
  .header__notif-btn {
    font-size: 1.25rem;
    padding: 0.5rem;
  }
}

/* Móvil (576px) */
@media (max-width: 576px) {
  
  .logo--mobile {
    height: 40px;
    max-width: 120px;
  }
  
  .header__actions {
    gap: 0.5rem;
  }
  
  /* Ocultamos el texto de los botones si es necesario */
  .header__notif-btn span,
  .header__user-toggle span {
    display: none;
  }
}

/* Móvil pequeño (450px) */
@media (max-width: 450px) {
  .header__container {
    padding: 0 0.5rem;
  }
  
  .logo--mobile {
    height: 36px;
    max-width: 100px;
  }
  
  .header__toggle,
  .header__button,
  .header__user-toggle,
  .header__notif-btn {
    font-size: 1.1rem;
    padding: 0.4rem;
  }
  
  /* Ajustamos el contador de notificaciones */
  #unseen_count {
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    top: -0.2rem;
    right: -0.2rem;
  }
}

/* Móvil muy pequeño (360px) */
@media (max-width: 360px) {
 
  
  .logo--mobile {
    height: 32px;
    max-width: 90px;
  }
  
  /* Simplificamos aún más */
  .header__button {
    display: none;
  }
}

/* Ajustes específicos para cuando el sidebar móvil está activo */
@media (max-width: 768px) {
  body.sidebar-mobile-active .header {
    padding-left: 260px !important;
  }
  
  body.sidebar-mobile-active .header__container {
    margin-left: 0.75rem;
  }
}

/* Asegurar que el header siempre esté encima del sidebar en móviles */
@media (max-width: 768px) {
  .header {
    z-index: 1100; /* Mayor que el sidebar (1000) */
  }
}

/* Modo oscuro - ajustes responsive */
html.dark {
  @media (max-width: 768px) {
    .header__container {
      background-color: var(--dark-bg);
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }
    
    .header__notif-dropdown,
    .header__user-dropdown {
      background-color: #2A3142;
      border-color: #3E4A63;
    }
  }
}



/* =============== DARK MODE COMPATIBLE =============== */
html.dark .header__container {
  background-color: var(--dark-bg);
}

html.dark .header__toggle i,
html.dark .header__button i,
html.dark .header__notif-btn i,
html.dark .header__user-toggle i {
  color: var(--dark-text);
  transition: color 0.3s;
}

html.dark .header__notif-btn:hover i,
html.dark .header__user-toggle:hover i {
  color: var(--highlight);
}

html.dark .header::before {
  background-color: #191F2C;
}

html.dark .header__notif-dropdown,
html.dark .header__user-dropdown {
  background-color: var(--dark-bg);
  border: 1px solid #3E4A63;
  box-shadow: 0 4px 16px var(--shadow-dark);
}

html.dark .header__notif-header,
html.dark .header__notif-list,
html.dark .header__user-info {
  color: var(--dark-text);
  border-color: #3E4A63;
}

html.dark .header__user-dropdown a {
  color: var(--dark-text);
}

html.dark .header__user-dropdown a:hover {
  background-color: rgba(122, 154, 255, 0.1);
  color: var(--highlight);
}

html.dark .header__user-dropdown i {
  color: var(--highlight);
}

html.dark .header__notif-list {
  scrollbar-color: #3E4A63 var(--dark-bg);
}

html.dark .header__notif-list::-webkit-scrollbar {
  width: 6px;
}

html.dark .header__notif-list::-webkit-scrollbar-thumb {
  background: #3E4A63;
  border-radius: 3px;
}

html.dark .header__notif-list::-webkit-scrollbar-track {
  background: var(--dark-bg);
}

html.dark .header__notif-more {
  color: var(--highlight);
}

html.dark .header__notif-more:hover {
  background-color: rgba(122, 154, 255, 0.1);
  color: #A5C1FF;
}

