/* =================================================================== */
/* SIDEBAR.CSS - SIGEGPRO Sistema de Gestión de Proyectos             */
/* Estilos específicos para la navegación lateral                     */
/* =================================================================== */

/* ==================== SIDEBAR PRINCIPAL ==================== */
.sidenav.sidenav-fixed {
  width: 260px !important;
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  box-shadow: var(--shadow-medium);
  z-index: var(--z-fixed);
}

/* ==================== HEADER DEL SIDEBAR ==================== */
.sidebar-header {
  background: linear-gradient(135deg, rgba(0, 82, 155, 0.95) 0%, rgba(0, 61, 130, 0.95) 100%);
  padding: var(--spacing-md);
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shimmer 3s infinite;
  z-index: 1;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ==================== LOGO Y WRAPPER ==================== */
.sidebar-logo-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.sidebar-logo-wrapper a {
  display: block;
  text-decoration: none;
}

.sidebar-logo-wrapper img {
  width: 100px;
  height: auto;
  margin-bottom: var(--spacing-sm);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: transform var(--transition-normal);
  position: relative;
  z-index: 2;
}

.sidebar-logo-wrapper img:hover {
  transform: scale(1.05);
}

/* ==================== INFORMACIÓN DE USUARIO ==================== */
.user-info {
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.8rem;
  line-height: 1.3;
  margin-top: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 2;
  text-align: center;
  word-wrap: break-word;
  min-height: 40px;
}

.user-name {
  font-weight: 600;
  margin-bottom: 3px;
  color: white;
  font-size: 0.85rem;
}

.user-email {
  opacity: 0.85;
  font-size: 0.75rem;
  word-break: break-all;
}

/* Forzar transparencia en todos los elementos del header */
.sidebar-header,
.sidebar-header table,
.sidebar-header tr,
.sidebar-header td,
.sidebar-header .user-info,
.sidebar-header .user-info:hover {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.sidebar-header td:hover,
.sidebar-header:hover {
  background-color: transparent !important;
  box-shadow: none !important;
}

/* ==================== NAVEGACIÓN PRINCIPAL ==================== */
.sidenav li a {
  color: white !important;
  padding: 14px 20px;
  transition: all var(--transition-normal);
  border-radius: 0;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
  font-weight: 400;
}

.sidenav li a::before {
  content: '';
  position: absolute;
  left: -100%;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left var(--transition-slow);
}

.sidenav li a:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: white !important;
  transform: translateX(8px);
}

.sidenav li a:hover::before {
  left: 100%;
}

.sidenav li a.active {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  font-weight: 600;
  border-left: 4px solid var(--secondary-color);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidenav li a.active::after {
  content: '';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid var(--secondary-color);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

/* ==================== COLLAPSIBLE MEJORADO ==================== */
.collapsible {
  border: none;
  box-shadow: none;
  margin: 0;
}

.collapsible-header {
  background: transparent !important;
  border: none;
  color: white !important;
  padding: 12px 20px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: 500;
}

.collapsible-header:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: white !important;
  transform: translateX(8px);
}

.collapsible-header.active {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  border-left: 4px solid var(--secondary-color);
  font-weight: 600;
}

/* Enlaces directos en collapsible-header */
.collapsible-header a {
  color: white !important;
  font-weight: 500;
  flex: 1;
  text-decoration: none;
}

.collapsible-header a.active {
  color: white !important;
  font-weight: 600;
}

/* ==================== CONTENIDO COLLAPSIBLE ==================== */
.collapsible-body {
  background: rgba(255, 255, 255, 0.95);
  border: none;
  padding: 0;
}

.collapsible-body ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.collapsible-body li {
  margin: 0;
  padding: 0;
}

.collapsible-body li a {
  color: var(--primary-color) !important;
  background: transparent !important;
  padding: 8px 20px 8px 55px;
  font-size: 0.9em;
  display: block;
  transition: all var(--transition-normal);
  text-decoration: none;
  position: relative;
  font-weight: 400;
}

.collapsible-body li a:before {
  content: '•';
  position: absolute;
  left: 35px;
  color: var(--secondary-color);
  font-weight: bold;
  top: 50%;
  transform: translateY(-50%);
}

.collapsible-body li a:hover {
  background: rgba(0, 82, 155, 0.1) !important;
  color: var(--primary-color) !important;
  transform: translateX(8px);
  font-weight: 500;
}

.collapsible-body li a.active {
  background: rgba(0, 82, 155, 0.15) !important;
  color: var(--primary-color) !important;
  font-weight: 600;
  border-left: 4px solid var(--primary-color);
}

/* ==================== DIVISORES ==================== */
.collapsible-body li.divider {
  height: 1px;
  background: var(--secondary-color);
  margin: 2px 20px;
  padding: 0;
  border: none;
}

/* ==================== FORMULARIO EN SIDEBAR ==================== */
.collapsible-body form {
  padding: var(--spacing-md) var(--spacing-lg);
  background: white;
}

.collapsible-body form .input-field {
  margin-bottom: var(--spacing-md);
}

.collapsible-body form .input-field input {
  color: var(--primary-color) !important;
  border-bottom: 1px solid #ccc !important;
  background: transparent;
}

.collapsible-body form .input-field input:focus {
  border-bottom: 1px solid var(--secondary-color) !important;
  box-shadow: 0 1px 0 0 var(--secondary-color) !important;
}

.collapsible-body form .input-field input::placeholder {
  color: var(--text-secondary);
}

.collapsible-body form .input-field label {
  color: var(--text-secondary) !important;
  font-size: 0.9rem;
}

.collapsible-body form .input-field label.active {
  color: var(--secondary-color) !important;
}

.collapsible-body form .btn {
  width: 100%;
  margin-top: var(--spacing-sm);
  background: var(--primary-color);
  border-radius: var(--border-radius);
}

.collapsible-body form .btn:hover {
  background: var(--secondary-color);
}

/* ==================== SCROLL PERSONALIZADO ==================== */
.sidenav::-webkit-scrollbar {
  width: 6px;
}

.sidenav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.sidenav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.sidenav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ==================== ESTADOS ESPECÍFICOS ==================== */
.sidenav li[role="none"] {
  border-bottom: none;
}

.sidenav a[role="menuitem"] {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.sidenav a[role="menuitem"] i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

/* ==================== RESPONSIVE SIDEBAR ==================== */
@media screen and (max-width: 992px) {
  .sidenav.sidenav-fixed {
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
  }
  
  .sidenav.sidenav-fixed.open {
    transform: translateX(0);
  }
  
  .sidebar-header {
    padding: var(--spacing-md) var(--spacing-sm);
  }
  
  .sidebar-logo-wrapper img {
    width: 80px;
  }
  
  .user-info {
    font-size: 0.75rem;
    padding: var(--spacing-xs) 0;
  }
  
  .user-name {
    font-size: 0.8rem;
  }
  
  .user-email {
    font-size: 0.7rem;
  }
}

@media screen and (max-width: 600px) {
  .sidebar-header {
    padding: var(--spacing-md) var(--spacing-sm) var(--spacing-sm);
  }
  
  .sidebar-logo-wrapper img {
    width: 70px;
    margin-bottom: var(--spacing-xs);
  }
  
  .user-info {
    font-size: 0.7rem;
    min-height: 35px;
  }
  
  .user-name {
    font-size: 0.75rem;
  }
  
  .user-email {
    font-size: 0.65rem;
  }
  
  .collapsible-header {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.9rem;
  }
  
  .collapsible-body li a {
    padding: var(--spacing-xs) var(--spacing-md) var(--spacing-xs) 45px;
    font-size: 0.85rem;
  }
  
  .collapsible-body li a:before {
    left: 28px;
  }
  
  .collapsible-body form {
    padding: var(--spacing-md);
  }
}

/* ==================== ACCESIBILIDAD SIDEBAR ==================== */
@media (prefers-reduced-motion: reduce) {
  .sidenav li a,
  .collapsible-header,
  .sidebar-logo-wrapper img {
    transition: none !important;
  }
  
  .sidebar-header::before {
    animation: none !important;
  }
}

/* Mejoras para lectores de pantalla */
.sidenav[role="menubar"] li[role="none"] {
  list-style: none;
}

.sidenav a[aria-haspopup="true"]::after {
  content: '▼';
  position: absolute;
  right: var(--spacing-md);
  font-size: 0.7rem;
  transition: transform var(--transition-fast);
}

.sidenav a[aria-haspopup="true"][aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* ==================== ESTADOS DE CARGA ==================== */
.sidebar-loading {
  opacity: 0.7;
  pointer-events: none;
}

.sidebar-loading .sidebar-header::before {
  animation-duration: 1s;
}

/* ==================== TEMAS Y VARIACIONES ==================== */
.sidebar-compact .sidenav.sidenav-fixed {
  width: 200px !important;
}

.sidebar-compact main {
  margin-left: 200px;
}

.sidebar-compact .sidebar-logo-wrapper img {
  width: 70px;
}

.sidebar-compact .collapsible-header,
.sidebar-compact .sidenav li a {
  padding-left: var(--spacing-md);
  padding-right: var(--spacing-md);
}

@media screen and (max-width: 992px) {
  .sidebar-compact .sidenav.sidenav-fixed {
    width: 260px !important;
  }
  
  .sidebar-compact main {
    margin-left: 0;
  }
}