/* ============================================================================
   SISTEMA MOBILE - Mobile.css (Versão Corrigida e Otimizada)
   Layout otimizado para telas abaixo de 768px
   ============================================================================ */


/* ============================================================================
   CONFIGURAÇÕES GERAIS PARA CELULAR
   ============================================================================ */

/* ❗ Correção: Removido do html para liberar scroll horizontal nas tabelas */
body {
  overflow-x: hidden;
}

/* Libera scroll horizontal onde for necessário */
.table-responsive,
.table-responsive-mobile {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}



@media (max-width: 768px) {

  /* ---------------------------------------
     SIDEBAR — agora com translateX (melhor)
     --------------------------------------- */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100%;
    background: #1e1f22;
    transform: translateX(-100%);
    transition: transform 0.35s ease;
    z-index: 9999;
    padding-top: 70px;
    box-shadow: 3px 0 12px rgba(0,0,0,0.35);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar a {
    padding: 14px 20px;
    font-size: 1.05rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }


  /* ---------------------------------------
     BOTÃO MOBILE (Menu)
     --------------------------------------- */
  #mobileMenuBtn {
    display: block;
    position: fixed;
    top: 18px;
    left: 18px;
    font-size: 30px;
    background: #212529;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    z-index: 12000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.35);
    transition: transform 0.2s ease;
  }

  #mobileMenuBtn:active {
    transform: scale(0.92);
  }


  /* ---------------------------------------
     CONTEÚDO PRINCIPAL
     --------------------------------------- */
  .content {
    margin-left: 0 !important;
    padding: 20px;
    padding-top: 95px !important;
  }


  /* ---------------------------------------
     TABELAS
     --------------------------------------- */
  .table-responsive {
    scrollbar-width: thin;
  }

  .table-responsive::-webkit-scrollbar {
    height: 6px;
  }

  .table-responsive::-webkit-scrollbar-thumb {
    background: rgba(150,150,150,0.4);
    border-radius: 10px;
  }

  .table th,
  .table td {
    white-space: nowrap;
    padding: 12px;
  }


  /* ---------------------------------------
     CARDS
     --------------------------------------- */
  .card {
    margin-bottom: 22px;
    border-radius: 14px;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  }
}




/* ============================================================================
   576px — Smartphones pequenos
   ============================================================================ */

@media (max-width: 576px) {

  .sidebar {
    width: 85%;
    max-width: 330px;
  }

  .content {
    padding-top: 95px !important;
  }

  h1, h2, h3 {
    font-size: 1.25rem;
    word-wrap: break-word;
    text-wrap: balance;
  }

  /* Evitar zoom no iPhone */
  input, select, textarea {
    font-size: 17px !important;
    -webkit-text-size-adjust: 100%;
  }

  .btn {
    width: 100%;
    margin-bottom: 10px;
    font-size: 16px;
    padding: 12px;
    border-radius: 10px;
  }
}




/* ============================================================================
   480px — Smartphones muito pequenos
   ============================================================================ */

@media (max-width: 480px) {

  .table th,
  .table td {
    padding: 10px 8px;
  }

  #mobileMenuBtn {
    top: 14px;
    left: 14px;
    padding: 9px 14px;
    font-size: 28px;
  }

  .card {
    padding: 12px;
  }
}




/* ============================================================================
   360px — Telefone mini
   ============================================================================ */

@media (max-width: 360px) {

  #mobileMenuBtn {
    top: 12px;
    left: 12px;
    padding: 8px 12px;
    font-size: 26px;
  }

  .content {
    padding-top: 90px !important;
  }

  .card {
    padding: 10px;
  }
}




/* ============================================================================
   SCROLL HORIZONTAL PARA TABELAS GRANDES — SOLUÇÃO 1
   ============================================================================ */

.table-responsive-mobile {
  width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  display: block;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.table-responsive-mobile::-webkit-scrollbar {
  height: 6px;
}

.table-responsive-mobile::-webkit-scrollbar-thumb {
  background: rgba(150,150,150,0.35);
  border-radius: 10px;
}

.table-responsive-mobile::-webkit-scrollbar-track {
  background: transparent;
}

/* Evitar quebra horizontal inesperada */
.table-responsive-mobile table {
  width: max-content;
  min-width: 100%;
}

@media (max-width: 768px) {
  .table-responsive-mobile table th,
  .table-responsive-mobile table td {
    white-space: nowrap;
  }
}
