/* ══════════════════════════════════════════
   ZAPMEI — MOBILE CSS
   Estratégia: bottom nav bar no mobile,
   sidebar some completamente.
   ══════════════════════════════════════════ */

/* ── BOTTOM NAV (só mobile) ── */
.bottom-nav {
  display: none;
}

@media (max-width: 768px) {

  /* Reset geral */
  *, *::before, *::after { box-sizing: border-box; }
  html { overflow-x: hidden; }
  body {
    overflow-x: hidden;
    max-width: 100vw;
    padding-bottom: 64px; /* espaço pro bottom nav */
  }

  /* SIDEBAR: some totalmente no mobile */
  .sidebar {
    display: none !important;
  }

  /* MAIN: largura total */
  .main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* TOPBAR: compacta */
  .topbar {
    padding: 0 14px !important;
    height: 52px !important;
    position: sticky;
    top: 0;
    z-index: 90;
  }
  .topbar-left { min-width: 0; }
  .page-title { font-size: 15px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-subtitle { display: none !important; }
  .search-wrap { display: none !important; }
  .topbar-right { gap: 6px; }
  .topbar-right .btn-primary { font-size: 11px !important; padding: 6px 10px !important; }

  /* PAGE CONTENT */
  .page-content { padding: 12px !important; }

  /* METRICS: 2 colunas */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }
  .metric-card { padding: 12px !important; gap: 8px !important; }
  .metric-value { font-size: 18px !important; }
  .metric-label { font-size: 11px !important; }
  .metric-icon { width: 32px !important; height: 32px !important; font-size: 14px !important; }
  .metric-delta { font-size: 10px !important; }

  /* GRIDS: 1 coluna */
  .dash-grid,
  .tasks-grid,
  .config-grid,
  .docs-grid { grid-template-columns: 1fr !important; gap: 10px !important; }

  /* CARDS */
  .card { padding: 12px !important; margin-bottom: 10px !important; }
  .card-title { font-size: 13px !important; }
  .card-header { flex-wrap: wrap; gap: 6px; margin-bottom: 12px !important; }

  /* TABELAS */
  .table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 480px; font-size: 12px !important; }
  .data-table th { padding: 8px 10px !important; font-size: 10px !important; }
  .data-table td { padding: 10px 10px !important; }

  /* FILTROS */
  .filters-bar { flex-direction: column !important; align-items: flex-start !important; gap: 8px !important; }
  .filter-tabs { overflow-x: auto; width: 100%; padding-bottom: 2px; flex-wrap: nowrap !important; gap: 4px !important; }
  .filter-search { width: 100% !important; }
  .filter-tab { white-space: nowrap; font-size: 12px !important; padding: 6px 12px !important; }

  /* FORMS */
  .form-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
  .form-input { font-size: 14px !important; } /* evita zoom no iOS */

  /* MODAL */
  .modal-backdrop { align-items: flex-end !important; padding: 0 !important; }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-body { padding: 16px !important; }
  .modal-footer { padding: 12px 16px !important; }

  /* TOAST */
  .toast {
    left: 12px !important;
    right: 12px !important;
    bottom: 76px !important; /* acima do bottom nav */
    text-align: center;
    max-width: none !important;
    font-size: 12px !important;
  }

  /* VENCIMENTOS */
  .venc-item { flex-wrap: wrap; gap: 4px; }
  .venc-item .btn-primary { margin-top: 4px; width: 100%; }

  /* CLIENTES */
  .client-mini { padding: 8px !important; }

  /* CONVERSAS */
  .conversas-layout { grid-template-columns: 1fr !important; }
  .conversas-lista { max-height: 180px; }

  /* TASK CARDS */
  .task-card { padding: 12px !important; }

  /* BOTTOM NAV: aparece */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid #E2E8F0;
    z-index: 200;
    align-items: stretch;
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    border: none;
    background: none;
    padding: 6px 0;
    color: #6B7280;
    font-size: 10px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: color 0.15s;
    position: relative;
    text-decoration: none;
  }
  .bottom-nav-item .nav-icon { font-size: 20px; line-height: 1; }
  .bottom-nav-item.active { color: #128C7E; }
  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 2px;
    background: #25D366;
    border-radius: 0 0 4px 4px;
  }
  .bottom-nav-badge {
    position: absolute;
    top: 4px; right: calc(50% - 18px);
    background: #EF4444;
    color: white;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
  }
}
