/* ── mobile.css — Akino Systems ── */
/* Breakpoints: 768px (tablet) / 480px (mobile) */

/* ══════════════════════════════════════
   OVERLAY — toque fora fecha o menu
══════════════════════════════════════ */
#mob-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 108;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}
body.mob-open #mob-overlay { display: block; }

/* ══════════════════════════════════════
   BOTÃO HAMBURGER (topbar, só mobile)
══════════════════════════════════════ */
.tp-hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 4px; width: 36px; height: 36px;
  border: none; background: none; cursor: pointer;
  border-radius: 8px; flex-shrink: 0; color: var(--text);
  transition: background .12s;
}
.tp-hamburger:hover { background: var(--s2); }
.tp-hamburger span {
  display: block; width: 16px; height: 1.5px;
  background: currentColor; border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
body.mob-open .tp-hamburger span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
body.mob-open .tp-hamburger span:nth-child(2) { opacity: 0; }
body.mob-open .tp-hamburger span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ══════════════════════════════════════
   TABLET  ≤ 768px
══════════════════════════════════════ */
@media (max-width: 768px) {

  /* Sidebar: escondida fora da tela, desliza ao abrir */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.16,1,.3,1);
    z-index: 109;
  }
  body.mob-open .sidebar {
    transform: translateX(0);
  }

  /* Sub-panel: some com sidebar */
  .sub-panel {
    display: none !important;
  }

  /* Main: ocupa 100% sem offset da sidebar */
  .main {
    margin-left: 0 !important;
    width: 100% !important;
  }

  /* Topbar: mostrar hamburger, ocultar elementos desnecessários */
  .tp-hamburger { display: flex; }
  .tp-search-wrap { display: none !important; }
  .tp-breadcrumb .tp-bc-sep,
  .tp-breadcrumb .tp-bc-root { display: none; }

  /* Botão Membros: só ícone no tablet */
  .tp-btn-outline { padding: 6px 10px; font-size: 0; gap: 0; }
  .tp-btn-outline svg { margin: 0; }

  /* Views: padding menor */
  .view { padding: 16px 14px; }
  .page-hd { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-hd-r { width: 100%; }

  /* Cards em coluna */
  .dash-kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .dash-grid { grid-template-columns: 1fr !important; }
}

/* ══════════════════════════════════════
   MOBILE  ≤ 480px
══════════════════════════════════════ */
@media (max-width: 480px) {

  /* Topbar mais compacta */
  .topbar { padding: 0 12px; gap: 8px; }
  .tp-btn-outline { display: none; } /* oculta botão Membros — acessível via sidebar */
  .tp-profile .tp-uname { display: none; } /* só avatar no perfil */

  /* KPI cards em coluna única */
  .dash-kpi-grid { grid-template-columns: 1fr !important; }

  /* Tabs do dashboard: scroll horizontal */
  .dash-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    padding-bottom: 2px;
  }
  .dash-tabs::-webkit-scrollbar { display: none; }

  /* Views */
  .view { padding: 12px 10px; }

  /* Kanban: scroll horizontal */
  .kanban-board {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
  }

  /* CRM table: scroll */
  .crm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Chat */
  .chat-sidebar { display: none; }
  .chat-main { width: 100% !important; }

  /* Modal: full-screen no mobile */
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    border-radius: 20px 20px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    margin: 0 !important;
  }
  .modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  /* Preferências: avatar + fields em coluna */
  .pref-av-wrap { width: 56px; height: 56px; }
}

/* ══════════════════════════════════════
   SAFE AREA (iPhone com notch/home bar)
══════════════════════════════════════ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .sidebar { padding-bottom: env(safe-area-inset-bottom); }
    .main    { padding-bottom: env(safe-area-inset-bottom); }
  }
}
