/* =============================================
   DASHBOARD MOBILE - VERSÃO FINAL PADRONIZADA
   Menu consistente em todo o dashboard
   ============================================= */

@media (max-width: 768px) {
  
  /* ===== OVERLAY REMOVIDO - SEM FUNDO ESCURO ===== */
  .sidebar-overlay {
    display: none !important; /* Completamente removido */
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  
  .sidebar-overlay.active {
    display: none !important; /* Nunca aparece */
  }
  
  /* ===== SIDEBAR BASE - SEMPRE POR CIMA ===== */
  .dashboard-sidebar {
    position: fixed !important;
    top: 80px !important;
    left: -100% !important;
    width: 280px !important;
    max-width: 85vw !important;
    height: calc(100vh - 80px) !important;
    background: linear-gradient(180deg, #0f0f0f 0%, #1a1a1a 100%) !important;
    border-right: 2px solid rgba(249, 115, 22, 0.3) !important;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.7) !important;
    z-index: 10000 !important; /* MAIOR que overlay */
    overflow: hidden !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* ===== NAVEGAÇÃO COM SCROLL ===== */
  .nav-group:last-child {
    padding-bottom: 60px !important;
  }
  
  .admin-group {
    padding-bottom: 80px !important;
    margin-bottom: 30px !important;
  }
  
  .dashboard-sidebar.mobile-open {
    left: 0 !important;
  }
  
  /* ===== REMOVER BARRA DE DEBUG ===== */
  .sidebar-content::before {
    display: none !important;
  }
  
  /* ===== SIDEBAR CONTENT ===== */
  .sidebar-content {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 100% !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  
  /* ===== LOGO SECTION ===== */
  .sidebar-logo {
    display: flex !important;
    align-items: center !important;
    padding: 20px 15px !important;
    background: rgba(249, 115, 22, 0.05) !important;
    border-bottom: 1px solid rgba(249, 115, 22, 0.15) !important;
  }
  
  .logo-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
  }
  
  .logo-img {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain !important;
  }
  
  .logo-text {
    display: flex !important;
    flex-direction: column !important;
  }
  
  .logo-main {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #f97316 !important;
    line-height: 1.2 !important;
  }
  
  .logo-sub {
    font-size: 11px !important;
    color: #999 !important;
    margin-top: 2px !important;
  }
  
  /* ===== USER SECTION ===== */
  .user-section {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 15px !important;
    background: rgba(249, 115, 22, 0.03) !important;
    border-bottom: 1px solid rgba(249, 115, 22, 0.1) !important;
  }
  
  .user-avatar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 45px !important;
    height: 45px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #f97316, #ff8c00) !important;
    flex-shrink: 0 !important;
  }
  
  .avatar-initial {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: white !important;
  }
  
  .user-info {
    flex: 1 !important;
    min-width: 0 !important;
  }
  
  .user-name {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #fff !important;
    margin-bottom: 4px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  
  .status-badge {
    display: inline-block !important;
    padding: 3px 8px !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    text-transform: uppercase !important;
  }
  
  .status-badge.admin {
    background: rgba(249, 115, 22, 0.15) !important;
    color: #f97316 !important;
    border: 1px solid rgba(249, 115, 22, 0.4) !important;
  }
  
  .status-badge.user {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #3b82f6 !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
  }
  
  /* ===== NAVIGATION ===== */
  .sidebar-navigation {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 15px 12px 150px 12px !important;
    min-height: 0 !important;
    max-height: 100% !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* ===== NAV GROUPS ===== */
  .nav-group {
    margin-bottom: 20px !important;
  }
  
  .nav-group-title {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    color: #888 !important;
    padding: 0 8px 8px 8px !important;
    margin-bottom: 8px !important;
    border-bottom: 1px solid rgba(249, 115, 22, 0.1) !important;
  }
  
  .nav-group-title.admin-title {
    color: #f97316 !important;
    border-bottom-color: rgba(249, 115, 22, 0.2) !important;
  }
  
  /* ===== NAV ITEMS - PADRONIZADO ===== */
  .nav-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 13px 12px !important;
    margin-bottom: 6px !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(249, 115, 22, 0.15) !important;
    border-left: 3px solid rgba(249, 115, 22, 0.4) !important;
    border-radius: 8px !important;
    color: #fff !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    min-height: 48px !important;
  }
  
  .nav-item:hover {
    background: rgba(249, 115, 22, 0.08) !important;
    border-color: rgba(249, 115, 22, 0.3) !important;
    border-left-color: #f97316 !important;
    transform: translateX(3px) !important;
  }
  
  .nav-item:active {
    transform: translateX(3px) scale(0.98) !important;
  }
  
  .nav-item.active {
    background: rgba(249, 115, 22, 0.12) !important;
    border-color: rgba(249, 115, 22, 0.4) !important;
    border-left-color: #f97316 !important;
  }
  
  .nav-item.admin-item {
    border-left-color: rgba(249, 115, 22, 0.5) !important;
  }
  
  /* ===== NAV ICONS ===== */
  .nav-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 18px !important;
    flex-shrink: 0 !important;
  }
  
  /* ===== NAV LABELS ===== */
  .nav-label {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #fff !important;
    flex: 1 !important;
    line-height: 1.3 !important;
  }
  
  /* ===== TOGGLE BUTTON - DISCRETO E ELEGANTE ===== */
  .sidebar-toggle-mobile {
    position: fixed !important;
    top: 90px !important;
    left: 15px !important;
    width: 40px !important; /* Menor */
    height: 40px !important; /* Menor */
    background: rgba(249, 115, 22, 0.9) !important; /* Mais discreto */
    border: 1px solid rgba(249, 115, 22, 0.5) !important;
    border-radius: 8px !important; /* Menos arredondado */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    z-index: 10001 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important; /* Sombra sutil */
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    opacity: 0.9 !important; /* Levemente transparente */
  }
  
  .sidebar-toggle-mobile:hover {
    opacity: 1 !important;
    transform: scale(1.02) !important; /* Menos dramático */
    box-shadow: 0 3px 10px rgba(249, 115, 22, 0.3) !important;
  }
  
  .sidebar-toggle-mobile:active {
    transform: scale(0.98) !important;
  }
  
  .sidebar-toggle-mobile span {
    width: 18px !important; /* Linhas menores */
    height: 2px !important; /* Mais finas */
    background: white !important;
    border-radius: 1px !important;
    transition: all 0.3s ease !important;
  }
  
  /* Toggle animation - X mais discreto */
  .sidebar-toggle-mobile.active {
    background: rgba(239, 68, 68, 0.8) !important; /* Vermelho suave quando aberto */
    border-color: rgba(239, 68, 68, 0.5) !important;
  }
  
  .sidebar-toggle-mobile.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px) !important;
  }
  
  .sidebar-toggle-mobile.active span:nth-child(2) {
    opacity: 0 !important;
  }
  
  .sidebar-toggle-mobile.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px) !important;
  }
  
  /* ===== MAIN CONTENT ===== */
  .dashboard-main {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 20px 15px !important;
    min-height: calc(100vh - 80px) !important;
  }
  
  .dashboard-container {
    padding-top: 80px !important;
  }
  
  /* ===== SCROLLBAR CUSTOMIZADA ===== */
  .sidebar-navigation::-webkit-scrollbar {
    width: 6px !important;
  }
  
  .sidebar-navigation::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2) !important;
  }
  
  .sidebar-navigation::-webkit-scrollbar-thumb {
    background: rgba(249, 115, 22, 0.4) !important;
    border-radius: 3px !important;
  }
  
  .sidebar-navigation::-webkit-scrollbar-thumb:hover {
    background: rgba(249, 115, 22, 0.6) !important;
  }
  
  /* ===== PREVENIR SCROLL DO BODY ===== */
  body.sidebar-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
  }
  
  /* ===== OCULTAR MENU PRINCIPAL NO DASHBOARD MOBILE ===== */
  body.dashboard-page .modern-nav {
    display: none !important; /* Oculta menu principal completamente */
  }
  
  /* Ajustar layout quando menu principal está oculto */
  body.dashboard-page .dashboard-container {
    padding-top: 0 !important;
  }
  
  body.dashboard-page .dashboard-sidebar {
    top: 0 !important; /* Sidebar começa do topo */
    height: 100vh !important; /* Altura total da tela */
  }
  
  body.dashboard-page .sidebar-toggle-mobile {
    top: 15px !important; /* Mais no topo */
  }
  
  body.dashboard-page .dashboard-main {
    padding-top: 70px !important; /* Espaço para o toggle */
    min-height: 100vh !important; /* Altura total */
  }
  
  body.dashboard-page {
    padding-top: 0 !important; /* Remove padding do body */
  }
  
  /* ===== ADMIN GROUP DESTACADO ===== */
  .admin-group {
    margin-top: 10px !important;
    padding-top: 15px !important;
    border-top: 2px solid rgba(249, 115, 22, 0.15) !important;
  }
  
  /* ===== FORMS NO DASHBOARD MOBILE ===== */
  .dashboard-main input,
  .dashboard-main select,
  .dashboard-main textarea {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px !important;
    padding: 12px !important;
    border-radius: 8px !important;
  }
  
  .dashboard-main button,
  .dashboard-main .btn {
    width: 100% !important;
    min-height: 48px !important;
    padding: 12px 20px !important;
    font-size: 15px !important;
    border-radius: 8px !important;
  }
  
  /* ===== CARDS NO DASHBOARD MOBILE ===== */
  .dashboard-main .card,
  .dashboard-main .dashboard-card {
    margin: 15px 0 !important;
    padding: 20px 15px !important;
    border-radius: 12px !important;
  }
  
  /* ===== TABLES NO DASHBOARD MOBILE ===== */
  .dashboard-main table {
    font-size: 13px !important;
  }
  
  .dashboard-main table th,
  .dashboard-main table td {
    padding: 10px 8px !important;
  }
  
  /* ===== HEADINGS NO DASHBOARD MOBILE ===== */
  .dashboard-main h1 {
    font-size: 24px !important;
    margin-bottom: 20px !important;
  }
  
  .dashboard-main h2 {
    font-size: 20px !important;
    margin-bottom: 15px !important;
  }
  
  .dashboard-main h3 {
    font-size: 18px !important;
    margin-bottom: 12px !important;
  }
}

/* ===== MOBILE PEQUENO (≤ 480px) ===== */
@media (max-width: 480px) {
  .dashboard-sidebar {
    width: 90% !important;
    max-width: 100% !important;
  }
  
  .sidebar-toggle-mobile {
    top: 85px !important;
    left: 10px !important;
    width: 44px !important;
    height: 44px !important;
  }
  
  .nav-item {
    padding: 12px 10px !important;
  }
  
  .nav-icon {
    width: 24px !important;
    height: 24px !important;
    font-size: 16px !important;
  }
  
  .nav-label {
    font-size: 13px !important;
  }
  
  .dashboard-main {
    padding: 15px 10px !important;
  }
}

/* ===== LANDSCAPE MODE ===== */
@media (max-width: 768px) and (orientation: landscape) {
  .dashboard-sidebar {
    top: 75px !important;
    height: calc(100vh - 75px) !important;
  }
  
  .sidebar-overlay {
    top: 75px !important;
  }
  
  .sidebar-logo,
  .user-section {
    padding: 10px 15px !important;
  }
  
  .nav-item {
    min-height: 42px !important;
    padding: 10px 12px !important;
  }
}

/* ===== SAFE AREA (iOS) ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .sidebar-navigation {
      padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    }
  }
}


