/* ==========================================================================
   DRAWER LATERAL RETRÁTIL (MOBILE-OPTIMIZED OFF-CANVAS NAVIGATION)
   Versão: 0.1.0
   ========================================================================== */

/* Botão Hamburger de Abertura (no Topbar) */
.mobile-drawer-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #e5e7eb;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: manipulation;
  z-index: 100;
}

.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;
}

/* Badge de Versão */
.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 999px;
  color: #34d399;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.4;
}

/* Backdrop escurecido */
.app-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}

.app-drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* Painel Lateral Retrátil */
.app-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 86vw;
  background: rgba(10, 15, 12, 0.96);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.65);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

/* Header do Drawer */
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #ffffff;
}

.drawer-brand-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.drawer-brand-sub {
  font-size: 10.5px;
  color: #9ca3af;
}

.drawer-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #9ca3af;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
  touch-action: manipulation;
}

.drawer-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

/* Corpo do Drawer */
.drawer-body {
  flex: 1;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Seção de Perfil / Login no Drawer */
.drawer-user-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 16px;
}

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

.drawer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #042f20;
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.drawer-user-info {
  flex: 1;
  min-width: 0;
}

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

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

.drawer-user-btn {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  touch-action: manipulation;
}

.drawer-btn-login {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #042f20;
  border: none;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.drawer-btn-login:hover {
  filter: brightness(1.1);
}

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

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

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

.drawer-nav-heading {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 6px;
  padding-left: 6px;
}

.drawer-nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: #d1d5db;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  touch-action: manipulation;
}

.drawer-nav-link:hover,
.drawer-nav-link.active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.drawer-nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.drawer-nav-text {
  flex: 1;
}

.drawer-nav-text small {
  display: block;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

.drawer-nav-arrow {
  color: #6b7280;
  font-size: 14px;
}

/* Footer do Drawer */
.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-version-text {
  font-size: 11.5px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Regras Responsivas: Mobile (<= 768px) */
@media (max-width: 768px) {
  .mobile-drawer-toggle {
    display: inline-flex;
  }
  
  /* Esconder a barra de navegação horizontal no mobile */
  .topbar .nav-actions,
  .topbar nav[aria-label="Navegação principal"] {
    display: none !important;
  }
  
  .topbar {
    justify-content: space-between !important;
    padding-inline: 16px !important;
  }
}
