/* ============================================
   MENU DROPDOWN - CSS COMPATÍVEL
   Adicionar ao final do sidebar.css existente
   ============================================ */

/* Dropdown Toggle */
.sidebar__nav .has-submenu > a {
  position: relative;
}

.sidebar__nav .menu-toggle .arrow {
  position: absolute;
  right: 1.5rem;
  font-size: 1rem;
  transition: transform 0.3s ease;
  opacity: 0.6;
}

.sidebar__nav .has-submenu.open .arrow {
  transform: rotate(180deg);
}

/* Badge (já existe, mas garantir compatibilidade) */
.sidebar__nav .badge {
  margin-left: auto;
  margin-right: 2.5rem; /* Espaço para a seta */
}

/* Submenu */
.sidebar__nav .submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out, opacity 0.3s ease;
  opacity: 0;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
  margin-left: 0.5rem;
  margin-right: 0.5rem;
}

.sidebar__nav .has-submenu.open .submenu {
  max-height: 1000px;
  opacity: 1;
  margin-top: 0.3rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0;
}

/* Links do Submenu */
.sidebar__nav .submenu li {
  margin: 0;
}

.sidebar__nav .submenu a {
  padding: 0.8rem 1rem 0.8rem 2.5rem !important;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  position: relative;
}

.sidebar__nav .submenu a::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.5;
}

.sidebar__nav .submenu a:hover {
  padding-left: 3rem !important;
  background: rgba(111, 66, 193, 0.1);
}

.sidebar__nav .submenu a.active {
  background: rgba(111, 66, 193, 0.15);
  font-weight: 600;
}

.sidebar__nav .submenu i {
  font-size: 1.1rem;
  margin-right: 0.8rem;
  opacity: 0.7;
  width: 1.6rem;
  text-align: center;
}

/* Animação de entrada dos itens */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sidebar__nav .has-submenu.open .submenu li {
  animation: slideIn 0.3s ease forwards;
}

.sidebar__nav .has-submenu.open .submenu li:nth-child(1) { animation-delay: 0.05s; }
.sidebar__nav .has-submenu.open .submenu li:nth-child(2) { animation-delay: 0.1s; }
.sidebar__nav .has-submenu.open .submenu li:nth-child(3) { animation-delay: 0.15s; }
.sidebar__nav .has-submenu.open .submenu li:nth-child(4) { animation-delay: 0.2s; }
.sidebar__nav .has-submenu.open .submenu li:nth-child(5) { animation-delay: 0.25s; }
.sidebar__nav .has-submenu.open .submenu li:nth-child(6) { animation-delay: 0.3s; }
.sidebar__nav .has-submenu.open .submenu li:nth-child(7) { animation-delay: 0.35s; }
.sidebar__nav .has-submenu.open .submenu li:nth-child(8) { animation-delay: 0.4s; }
.sidebar__nav .has-submenu.open .submenu li:nth-child(9) { animation-delay: 0.45s; }
.sidebar__nav .has-submenu.open .submenu li:nth-child(10) { animation-delay: 0.5s; }
.sidebar__nav .has-submenu.open .submenu li:nth-child(11) { animation-delay: 0.55s; }

/* Hover no item pai quando tem submenu aberto */
.sidebar__nav .has-submenu.open > a {
  background: rgba(111, 66, 193, 0.1);
}

/* Scroll na sidebar se necessário */
.sidebar__nav {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 20rem);
}

.sidebar__nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar__nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar__nav::-webkit-scrollbar-thumb {
  background: rgba(111, 66, 193, 0.3);
  border-radius: 10px;
}

.sidebar__nav::-webkit-scrollbar-thumb:hover {
  background: rgba(111, 66, 193, 0.5);
}

/* Responsivo */
@media (max-width: 768px) {
  .sidebar__nav .submenu a {
    padding: 0.7rem 0.8rem 0.7rem 2rem !important;
    font-size: 1.2rem;
  }

  .sidebar__nav .submenu a:hover {
    padding-left: 2.5rem !important;
  }
}

/* Tema Escuro (se existir) */
[data-theme="dark"] .sidebar__nav .submenu {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .sidebar__nav .submenu a:hover {
  background: rgba(111, 66, 193, 0.2);
}

[data-theme="dark"] .sidebar__nav .submenu a.active {
  background: rgba(111, 66, 193, 0.3);
}
