/* =============================================
   DASHBOARD SIDEBAR - MOBILE FIX
   Correção completa para visualização mobile
   ============================================= */

/* =============================================
   SIDEBAR MOBILE - ESTRUTURA BASE
   ============================================= */
@media (max-width: 768px) {
  /* Sidebar container */
  .dashboard-sidebar {
    position: fixed !important;
    top: 80px !important;
    left: -100% !important;
    width: 85% !important;
    max-width: 320px !important;
    height: calc(100vh - 80px) !important;
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.98) 0%, rgba(20, 20, 20, 0.98) 100%) !important;
    border-right: 2px solid rgba(249, 115, 22, 0.4) !important;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5) !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 1100 !important;
    overflow-y: hidden !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  .dashboard-sidebar.mobile-open {
    left: 0 !important;
  }
  
  /* Sidebar content wrapper */
  .sidebar-content {
    width: 100%;
    height: 100%;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
  }
  
  /* Logo section */
  .sidebar-logo {
    padding: 20px 15px !important;
    border-bottom: 2px solid rgba(249, 115, 22, 0.2) !important;
    margin-bottom: 0 !important;
    background: rgba(249, 115, 22, 0.05);
  }
  
  .logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
  }
  
  .logo-img {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain;
  }
  
  .logo-text {
    display: flex;
    flex-direction: column;
  }
  
  .logo-main {
    font-size: 16px !important;
    font-weight: 700;
    color: #87CEEB;
    line-height: 1;
  }
  
  .logo-sub {
    font-size: 11px !important;
    color: #bbb;
    line-height: 1;
    margin-top: 2px;
  }
  
  /* User section */
  .user-section {
    padding: 15px !important;
    margin: 0 !important;
    background: rgba(135, 206, 235, 0.08) !important;
    border-bottom: 1px solid rgba(135, 206, 235, 0.15) !important;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .user-avatar {
    width: 45px !important;
    height: 45px !important;
    border-radius: 50%;
    background: linear-gradient(135deg, #87CEEB, #4682B4);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  
  .avatar-initial {
    font-size: 18px !important;
    font-weight: 700;
    color: white;
  }
  
  .user-info {
    flex: 1;
    min-width: 0;
  }
  
  .user-name {
    font-size: 14px !important;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .user-status {
    display: flex;
    align-items: center;
  }
  
  .status-badge {
    display: inline-block;
    padding: 3px 8px !important;
    border-radius: 12px;
    font-size: 10px !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .status-badge.admin {
    background: rgba(249, 115, 22, 0.2);
    color: #87CEEB;
    border: 1px solid #f97316;
  }
  
  .status-badge.user {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid #3b82f6;
  }
  
  /* Navigation section */
  .sidebar-navigation {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px 12px 150px 12px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }
  
  /* Nav groups */
  .nav-group {
    margin-bottom: 25px;
  }
  
  .nav-group:last-child {
    padding-bottom: 80px;
    margin-bottom: 20px;
  }
  
  .admin-group {
    padding-bottom: 120px !important;
    margin-bottom: 40px !important;
  }
  
  .nav-group-title {
    font-size: 11px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    padding: 8px 12px !important;
    margin-bottom: 8px !important;
    border-bottom: 1px solid rgba(249, 115, 22, 0.1);
  }
  
  .nav-group-title.admin-title {
    color: #87CEEB;
    border-bottom-color: rgba(249, 115, 22, 0.2);
  }
  
  /* Nav items (buttons) */
  .nav-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 14px 12px !important;
    margin-bottom: 6px !important;
    border-radius: 10px !important;
    background: rgba(249, 115, 22, 0.03) !important;
    border: 1px solid rgba(249, 115, 22, 0.1) !important;
    color: #fff !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    min-height: 48px !important;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
  }
  
  .nav-item:hover,
  .nav-item:active {
    background: rgba(249, 115, 22, 0.15) !important;
    border-color: rgba(249, 115, 22, 0.3) !important;
    transform: translateX(4px);
  }
  
  .nav-item.active {
    background: rgba(249, 115, 22, 0.2) !important;
    border-color: rgba(249, 115, 22, 0.4) !important;
  }
  
  /* Admin items */
  .nav-item.admin-item {
    background: rgba(249, 115, 22, 0.05) !important;
    border-color: rgba(249, 115, 22, 0.15) !important;
  }
  
  .nav-item.admin-item:hover,
  .nav-item.admin-item:active {
    background: rgba(249, 115, 22, 0.2) !important;
    border-color: rgba(249, 115, 22, 0.35) !important;
  }
  
  /* Nav icons */
  .nav-icon {
    font-size: 20px !important;
    width: 28px !important;
    height: 28px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 8px;
  }
  
  /* Nav labels */
  .nav-label {
    font-size: 14px !important;
    font-weight: 600;
    color: #fff;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  /* Main content adjustment */
  .dashboard-main {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 20px 15px !important;
    min-height: calc(100vh - 80px);
  }
  
  /* Sidebar overlay */
  .sidebar-overlay {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }
  
  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  /* Toggle button */
  .sidebar-toggle-mobile {
    display: flex !important;
    position: fixed;
    top: 90px;
    left: 15px;
    z-index: 1000;
    background: linear-gradient(135deg, #87CEEB, #4682B4);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
  }
  
  .sidebar-toggle-mobile:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.7);
  }
  
  .sidebar-toggle-mobile:active {
    transform: scale(0.95);
  }
  
  .sidebar-toggle-mobile span {
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
  }
  
  /* Toggle button animation when open */
  .sidebar-toggle-mobile.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }
  
  .sidebar-toggle-mobile.active span:nth-child(2) {
    opacity: 0;
  }
  
  .sidebar-toggle-mobile.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }
  
  /* Dashboard container */
  .dashboard-container {
    padding-top: 80px !important;
  }
  
  .dashboard-wrapper {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
  }
}

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

/* =============================================
   SCROLLBAR CUSTOMIZADA PARA SIDEBAR
   ============================================= */
@media (max-width: 768px) {
  .sidebar-navigation::-webkit-scrollbar {
    width: 6px;
  }
  
  .sidebar-navigation::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
  }
  
  .sidebar-navigation::-webkit-scrollbar-thumb {
    background: rgba(249, 115, 22, 0.5);
    border-radius: 3px;
  }
  
  .sidebar-navigation::-webkit-scrollbar-thumb:hover {
    background: rgba(249, 115, 22, 0.7);
  }
  
  /* Firefox scrollbar */
  .sidebar-navigation {
    scrollbar-width: thin;
    scrollbar-color: rgba(249, 115, 22, 0.5) rgba(0, 0, 0, 0.2);
  }
}

/* =============================================
   ANIMAÇÕES SUAVES
   ============================================= */
@media (max-width: 768px) {
  .nav-item {
    animation: fadeInLeft 0.3s ease-out;
  }
  
  .nav-item:nth-child(1) { animation-delay: 0s; }
  .nav-item:nth-child(2) { animation-delay: 0.05s; }
  .nav-item:nth-child(3) { animation-delay: 0.1s; }
  .nav-item:nth-child(4) { animation-delay: 0.15s; }
  .nav-item:nth-child(5) { animation-delay: 0.2s; }
  .nav-item:nth-child(6) { animation-delay: 0.25s; }
  
  @keyframes fadeInLeft {
    from {
      opacity: 0;
      transform: translateX(-10px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
}

/* =============================================
   TOUCH FEEDBACK
   ============================================= */
@media (max-width: 768px) {
  .nav-item:active {
    transform: translateX(4px) scale(0.98);
  }
  
  .sidebar-toggle-mobile:active {
    transform: scale(0.9);
  }
}

/* =============================================
   PREVENT BODY SCROLL WHEN SIDEBAR OPEN
   ============================================= */
@media (max-width: 768px) {
  body.sidebar-open {
    overflow: hidden;
  }
}

/* =============================================
   LANDSCAPE MODE
   ============================================= */
@media (max-width: 768px) and (orientation: landscape) {
  .sidebar-logo {
    padding: 12px 15px !important;
  }
  
  .user-section {
    padding: 10px !important;
  }
  
  .user-avatar {
    width: 35px !important;
    height: 35px !important;
  }
  
  .avatar-initial {
    font-size: 14px !important;
  }
  
  .nav-item {
    padding: 10px 12px !important;
    min-height: 42px !important;
  }
  
  .nav-group {
    margin-bottom: 15px;
  }
}

/* =============================================
   FIX PARA iOS SAFE AREA
   ============================================= */
@supports (padding: env(safe-area-inset-top)) {
  @media (max-width: 768px) {
    .dashboard-sidebar {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}

/* =============================================
   END OF DASHBOARD MOBILE FIX
   ============================================= */

