/* Layout com sidebar, baseado em https://getbootstrap.com/docs/5.3/examples/sidebars/ */
:root { --sidebar-width: 280px; --sidebar-width-collapsed: 4.5rem; }

.app-sidebar {
  width: var(--sidebar-width);
  transition: width .2s ease;
}
.app-sidebar .nav-link { display: flex; align-items: center; white-space: nowrap; }
.app-sidebar .nav-link .bi { font-size: 1.15rem; flex-shrink: 0; }
.app-sidebar .brand { text-decoration: none; }

/* -------- telas grandes: sidebar presa à altura da tela; só a lista de itens rola,
   o cabeçalho (marca) e o rodapé (usuário) ficam sempre visíveis */
@media (min-width: 992px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;   /* necessário para sticky dentro do body flex */
    overflow: hidden;
  }
  .app-sidebar > .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
}

/* -------- recolhida: só ícones (apenas em telas grandes) */
@media (min-width: 992px) {
  body.sidebar-collapsed .app-sidebar { width: var(--sidebar-width-collapsed); }
  body.sidebar-collapsed .app-sidebar .sidebar-label,
  body.sidebar-collapsed .app-sidebar .brand-text { display: none; }
  body.sidebar-collapsed .app-sidebar .nav-link { justify-content: center; padding-left: .5rem; padding-right: .5rem; }
  body.sidebar-collapsed .app-sidebar .nav-link .bi { margin-right: 0 !important; }
  body.sidebar-collapsed .app-sidebar .sidebar-head { flex-direction: column; gap: .5rem; }
  body.sidebar-collapsed .app-sidebar .user-menu .dropdown-toggle::after { display: none; }
  body.sidebar-collapsed .app-sidebar .user-menu .dropdown-toggle { justify-content: center; }
  body.sidebar-collapsed #sidebarToggle .bi::before { transform: rotate(180deg); }
}
#sidebarToggle .bi::before { display: inline-block; transition: transform .2s ease; }

/* -------- submenu (Configurações > Usuários, Grupos) */
.app-sidebar .submenu-toggle { background: transparent; border: 0; text-align: left; }
.app-sidebar .submenu-chevron::before { display: inline-block; transition: transform .2s ease; }
.app-sidebar .submenu-toggle[aria-expanded="true"] .submenu-chevron::before { transform: rotate(90deg); }
.app-sidebar .submenu .nav-link { padding-top: .35rem; padding-bottom: .35rem; padding-left: 2.25rem; }
@media (min-width: 992px) {
  body.sidebar-collapsed .app-sidebar .submenu { display: none; }
  body.sidebar-collapsed .app-sidebar .submenu-chevron { display: none; }
}

/* -------- avatar / logo no rodapé da sidebar */
.avatar-stack { position: relative; width: 40px; height: 40px; display: inline-block; }
.company-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); }
.user-avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; object-fit: cover; background: var(--bs-primary); color: #fff; font-weight: 600; }
.user-avatar-lg { width: 40px; height: 40px; font-size: .9rem; }
.user-avatar-badge { position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; font-size: .55rem; border: 2px solid var(--bs-tertiary-bg); }

/* -------- prévias e recorte */
.avatar-preview { width: 96px; height: 96px; object-fit: cover; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; background: var(--bs-primary); color: #fff; font-size: 2rem; font-weight: 600; }
.logo-preview { width: 96px; height: 96px; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.crop-stage { max-height: 60vh; }
.crop-stage img { display: block; max-width: 100%; }
.crop-round .cropper-view-box, .crop-round .cropper-face { border-radius: 50%; }

.app-main { min-width: 0; }

/* -------- celular: barra fixa no topo, conteúdo começa abaixo dela */
@media (max-width: 991.98px) {
  .app-main main { padding-top: 4.5rem !important; }
}
