/* ==========================================================================
   DRAWER / SIDEBAR VERTICAL UNIFICADO (DESKTOP FIXO & MOBILE OFF-CANVAS)
   Versão: 0.1.4
   ========================================================================== */

/* Universal: reset e animação */
.app-drawer-panel,
.app-drawer-panel * {
  box-sizing: border-box;
}

/* ==========================================================================
   DESKTOP (min-width: 900px): COLUNA LATERAL VERTICAL FIXA + SEM TOPBAR
   ========================================================================== */
@media (min-width: 900px) {
  /* Remove completamente a barra horizontal superior no computador */
  .topbar {
    display: none !important;
  }

  /* Compensa o conteúdo principal para a direita da barra lateral */
  body {
    padding-left: 315px !important;
  }

  /* Barra lateral vertical permanente */
  .app-drawer-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 315px !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-left: none !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5) !important;
    z-index: 1000 !important;
    background: rgba(10, 15, 12, 0.98) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Backdrop e botões móveis desativados no desktop */
  .app-drawer-backdrop {
    display: none !important;
  }

  .drawer-close-btn {
    display: none !important;
  }

  .mobile-drawer-toggle,
  .app-drawer-toggle {
    display: none !important;
  }

  section[id], article[id], div[id] {
    scroll-margin-top: 24px;
  }
}

/* ==========================================================================
   MOBILE (max-width: 899px): TOPBAR COMPACTA + DRAWER RETRÁTIL DESLIZANTE
   ========================================================================== */
@media (max-width: 899px) {
  body {
    padding-left: 0 !important;
  }

  /* Topbar compacta apenas com logo e botão de menu */
  .topbar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 60px !important;
    min-height: 60px !important;
    padding: 0 16px !important;
    background: rgba(9, 13, 22, 0.92) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
  }

  .topbar .nav-actions,
  .topbar nav {
    display: none !important;
  }

  .topbar .brand,
  .topbar .brand-wrap {
    display: inline-flex !important;
    align-items: center !important;
    min-width: 0 !important;
    flex: 0 1 auto !important;
    text-decoration: none !important;
  }

  .topbar .brand img,
  .topbar .brand-wrap img {
    max-width: 180px !important;
    height: 32px !important;
    width: auto !important;
    object-fit: contain !important;
  }

  /* Botão Hamburger */
  .mobile-drawer-toggle,
  .app-drawer-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #e5e7eb;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    touch-action: manipulation;
    z-index: 101;
    flex-shrink: 0;
    margin-left: auto;
  }

  .mobile-drawer-toggle:hover,
  .mobile-drawer-toggle:focus-visible {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
  }

  .mobile-drawer-toggle svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }

  /* Painel deslizante no mobile */
  .app-drawer-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 300px !important;
    max-width: 88vw !important;
    background: rgba(10, 15, 12, 0.98) !important;
    backdrop-filter: blur(28px) !important;
    -webkit-backdrop-filter: blur(28px) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.09) !important;
    border-left: none !important;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.75) !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .app-drawer-panel.open {
    transform: translateX(0) !important;
  }

  /* Backdrop escuro */
  .app-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .app-drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .drawer-close-btn {
    display: inline-flex !important;
  }

  section[id], article[id], div[id] {
    scroll-margin-top: 76px;
  }
}

/* ==========================================================================
   ESTILOS INTERNOS DO DRAWER / SIDEBAR (COMUNS A DESKTOP E MOBILE)
   ========================================================================== */
.drawer-header {
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.drawer-header-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  width: 100%;
  min-width: 0;
}

.drawer-brand-icon {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 12px rgba(16, 185, 129, 0.35));
}

.drawer-brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

.drawer-brand-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: #ffffff;
  display: flex;
  flex-wrap: wrap;
  column-gap: 5px;
  row-gap: 2px;
}

.drawer-brand-title .title-main {
  color: #ffffff;
}

.drawer-brand-title .title-sub,
.drawer-brand-title .highlight {
  color: #34d399;
}

.drawer-brand-title .dot {
  color: #10b981;
}

.drawer-brand-sub {
  font-family: Archivo, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #a7f3d0;
  text-transform: uppercase;
  line-height: 1.25;
  word-break: normal;
  text-shadow: 0 0 10px rgba(52, 211, 153, 0.25);
}

.drawer-brand-logo {
  max-width: 250px;
  height: 48px;
  object-fit: contain;
}

.drawer-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #9ca3af;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.drawer-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.drawer-body {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
}

/* Card do Usuário */
.drawer-user-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.drawer-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.drawer-user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-user-email {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-user-btn {
  width: 100%;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.drawer-btn-login {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.drawer-btn-login:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.5);
}

.drawer-btn-logout {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.drawer-btn-logout:hover {
  background: rgba(239, 68, 68, 0.18);
}

/* Links de Navegação */
.drawer-nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-nav-heading {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  padding: 4px 8px 6px;
}

.drawer-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #d1d5db;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  position: relative;
}

.drawer-nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f9fafb;
}

.drawer-nav-link.active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.drawer-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: inherit;
  flex-shrink: 0;
}

.drawer-nav-text {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}

.drawer-nav-text small {
  font-size: 10.5px;
  color: #6b7280;
  font-weight: 400;
  margin-top: 1px;
}

.drawer-nav-link.active .drawer-nav-text small {
  color: rgba(52, 211, 153, 0.7);
}

.drawer-nav-arrow {
  font-size: 14px;
  color: #4b5563;
  margin-left: auto;
}

.drawer-nav-link.active .drawer-nav-arrow {
  color: #34d399;
}

/* Rodapé do Drawer */
.drawer-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-size: 11.5px;
  color: #6b7280;
}

.drawer-version-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Scrollbar estilizada */
.app-drawer-panel::-webkit-scrollbar {
  width: 5px;
}
.app-drawer-panel::-webkit-scrollbar-track {
  background: transparent;
}
.app-drawer-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
