/*=============== SIDEBAR BASE STYLES ===============*/
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 260px;
  background-color: rgb(255, 255, 255);
  box-shadow: 2px 0 24px rgba(0, 0, 0, 0.1);
  padding-block: 1.2rem;
  margin: 0.75rem;
  border-radius: 1rem;
  padding-inline: 1rem;
  transition: left 0.4s, background-color 0.4s, width 0.4s;
  z-index: 100;
  transform: translateX(0);
  visibility: visible;
}

/* Dark Mode - Debe estar después del estilo base para sobrescribir */
html.dark .sidebar {
  background-color: #2A3142 !important;
  box-shadow: 2px 0 24px rgba(0, 0, 0, 0.3) !important;
}

.sidebar.collapsed {
  width: 90px;
}

.sidebar.collapsed .sidebar__info,
.sidebar.collapsed .sidebar__link span,
.sidebar.collapsed .sidebar__title {
  display: none;
}

/*=============== SIDEBAR STRUCTURE ===============*/
.sidebar__container {
  display: flex;
  flex-direction: column;
  height: 100%;
  row-gap: 3rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  overflow: hidden;
}

.sidebar__content {
  display: flex;
  flex-direction: column;
  row-gap: 2.5rem;
  overflow: auto;
  padding-inline: 1rem;
}

.sidebar__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar__title {
  padding-left: 1rem;
  font-size: 0.75rem;
  font-weight: bold;
  color: #CF2722;
  margin-bottom: 0.8rem;
  margin-top: 0.8rem;
  border-bottom: 0.5px solid #CF2722;
  padding-bottom: 0.4rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #555;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  position: relative;
}

.sidebar__link i {
  font-size: 1.25rem;
  color: inherit;
}

/* Estados mejorados con colores más suaves */
.sidebar__link:hover {
  color: #4A4AFF;
  background-color: rgba(74, 74, 255, 0.05);
}

.sidebar__link.active-link {
  color: #4A4AFF !important;
  background-color: rgba(74, 74, 255, 0.1) !important;
  font-weight: bold;
}

.sidebar__link.active-link i {
  color: #4A4AFF !important;
}

/* Indicador visual sutil para estado activo */
.sidebar__link.active-link::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 40%;
  background-color: #4A4AFF;
  border-radius: 0 4px 4px 0;
  opacity: 0.8;
}

/* Asegurar que todos los links activos funcionen */
a.sidebar__link[href*="all_history"].active-link,
a.sidebar__link[href*="notifications_list"].active-link,
a.sidebar__link[href*="about"].active-link,
a.sidebar__link[href*="logout"].active-link,
a.sidebar__link[href*="clients_list"].active-link,
a.sidebar__link[href*="users_list"].active-link,
a.sidebar__link[href*="devices_list"].active-link,
a.sidebar__link[href*="main"].active-link {
  color: #4A4AFF !important;
  background-color: rgba(74, 74, 255, 0.1) !important;
}

.sidebar__submenu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-left: 1.5rem;
}

.sidebar__actions {
  display: flex;
  flex-direction: column;
}

.sidebar__user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  text-align: center;
}

.sidebar__img img {
  width: 38px;
  height: auto;
}

.sidebar__info h3 {
  color: #4A4AFF;
  font-weight: 600;
  border-bottom: 1.5px solid #4A4AFF;
  padding-bottom: 0.4rem;
}

/*=============== SCROLLBAR STYLES ===============*/
.sidebar__content::-webkit-scrollbar {
  width: 6px;
}

.sidebar__content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

/*=============== RESPONSIVE STYLES ===============*/
.sidebar {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 260px !important;
  background-color: rgb(255, 255, 255) !important;
  box-shadow: 2px 0 24px rgba(0, 0, 0, 0.1) !important;
  padding: 1.2rem 1rem !important;
  margin: 0.75rem !important;
  border-radius: 1rem !important;
  transition: all 0.3s ease !important;
  z-index: 1000 !important;
  transform: translateX(0) !important;
  overflow-y: auto !important;
}

.sidebar.collapsed {
  width: 90px !important;
}

.sidebar.collapsed .sidebar__info,
.sidebar.collapsed .sidebar__link span,
.sidebar.collapsed .sidebar__title {
  display: none !important;
}

/* Mobile styles */
@media (max-width: 768px) {
  .sidebar {
    width: 260px !important;
    transform: translateX(-100%) !important;
    margin: 0 !important;
    border-radius: 0 1rem 1rem 0 !important;
    z-index: 1000 !important;
  }
  
  .sidebar.show-mobile {
    transform: translateX(0) !important;
  }
  
  /* Force show text in mobile even when collapsed */
  .sidebar.collapsed .sidebar__info,
  .sidebar.collapsed .sidebar__link span,
  .sidebar.collapsed .sidebar__title {
    display: block !important;
  }
  
  .sidebar__link {
    padding: 0.75rem 1rem !important;
  }
  
  /* Dark mode en móvil */
  html.dark .sidebar {
    background-color: #2A3142 !important;
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.3) !important;
  }
}

@media (max-width: 360px) {
  .sidebar {
    width: 100% !important;
    border-radius: 0 !important;
  }
  
  .sidebar__link {
    padding: 0.75rem !important;
  }
}

/*=============== DARK MODE ===============*/
html.dark .sidebar__link {
  color: #E0E0E0 !important;
}

html.dark .sidebar__link:hover {
  color: #7A9AFF !important;
  background-color: rgba(122, 154, 255, 0.05) !important;
}

html.dark .sidebar__link.active-link {
  color: #7A9AFF !important;
  background-color: rgba(122, 154, 255, 0.1) !important;
}

html.dark .sidebar__link.active-link::after {
  background-color: #7A9AFF;
}

html.dark .sidebar__title {
  color: #FF6B6B !important;
  border-bottom-color: #FF6B6B !important;
}

html.dark .sidebar__info h3 {
  color: #7A9AFF !important;
  border-bottom-color: #7A9AFF !important;
}

html.dark .sidebar__content::-webkit-scrollbar-thumb {
  background: #3E4A63 !important;
}

html.dark .sidebar__content::-webkit-scrollbar-track {
  background: #2A3142 !important;
}






.sidebar__link--has-submenu {
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.sidebar__link-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar__submenu {
  display: none;
  flex-direction: column;
  padding-left: 1.5rem;
  gap: 0.3rem;
}

.sidebar__sublink {
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  padding: 0.3rem 0;
  color: var(--text-color);
  transition: color 0.3s;
}

.sidebar__sublink:hover {
  color: var(--first-color);
}

.active-sublink {
  font-weight: bold;
  color: var(--first-color);
}

/* Mostrar submenú cuando tiene clase open */
.sidebar__link--has-submenu.open .sidebar__submenu {
  display: flex;
}
