/* GBM AUTO PARTS — Mobile Responsivo */

/* ── HEADER PUBLIC ──────────────────────────────────────────── */
@media (max-width: 640px) {
  header .logo-text { display: none !important; }
  header nav { gap: 12px !important; font-size: 12px !important; }
  header nav a { white-space: nowrap; }
}

/* ── INDEX / PRODUTOS ───────────────────────────────────────── */
@media (max-width: 480px) {
  .bannerwrap { border-radius: 12px !important; }
  .bannerwrap img { height: 140px !important; }
  .hero-title { font-size: 1.5rem !important; }
  .hero-form { flex-direction: column !important; }
  .hero-form input, .hero-form button { width: 100% !important; }
  .produtos-grid { grid-template-columns: repeat(2,1fr) !important; gap: 10px !important; }
  .produtos-grid .panel { width: 100% !important; padding: 10px !important; }
  .produtos-grid img { height: 120px !important; }
  .lista-grid { grid-template-columns: repeat(2,1fr) !important; gap: 10px !important; }
  .lista-grid .panel { padding: 10px !important; }
}
@media (max-width: 640px) {
  .filtro-form { flex-direction: column !important; }
  .filtro-form > * { width: 100% !important; }
}

/* ── CARRINHO LATERAL ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .carrinho-aside { display: none !important; }
}

/* ── PRODUTO DETALHE ────────────────────────────────────────── */
@media (max-width: 768px) {
  .produto-grid { grid-template-columns: 1fr !important; gap: 20px !important; }
  .produto-foto { max-width: 220px !important; margin: 0 auto !important; }
  .produto-titulo { font-size: 1.4rem !important; }
  .produto-actions { grid-template-columns: 1fr !important; gap: 8px !important; }
  .produto-actions input[type="number"],
  .produto-actions button,
  .produto-actions a { width: 100% !important; }
  .produto-btns { flex-direction: column !important; gap: 8px !important; }
  .produto-btns button, .produto-btns a { width: 100% !important; text-align: center !important; }
  .modal-overlay { padding: 0 !important; align-items: flex-end !important; }
  .modal-box { border-radius: 16px 16px 0 0 !important; max-height: 92vh; }
  .modal-body { padding: 14px !important; }
  .table-sky { min-width: 560px; }
  .sim-card { flex-wrap: wrap !important; gap: 10px !important; }
  .sim-right { flex-direction: row !important; flex-wrap: wrap !important; width: 100% !important; }
}

/* ── CARRINHO PAGE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .carrinho-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; }
  .carrinho-table-wrap table { min-width: 580px !important; }
  .col-estoque { display: none !important; }
}
@media (max-width: 480px) {
  .cliente-form { grid-template-columns: 1fr !important; }
  .carrinho-footer { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
  .carrinho-footer > div,
  .carrinho-footer > a,
  .carrinho-footer form,
  .carrinho-footer button { width: 100% !important; text-align: center !important; }
}

/* ── CHAT WIDGET ────────────────────────────────────────────── */
@media (max-width: 480px) {
  #gbm-chat-box { right: 8px !important; left: 8px !important; width: auto !important; bottom: 88px !important; border-radius: 16px !important; }
  #gbm-chat-btn { bottom: 16px !important; right: 16px !important; width: 52px !important; height: 52px !important; font-size: 22px !important; }
}

/* ── PAGINAÇÃO ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .paginacao { gap: 4px !important; }
  .paginacao a, .paginacao span { padding: 6px 10px !important; font-size: 12px !important; }
}

/* ── ADMIN: tabelas ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .gbm-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; }
  .gbm-table { min-width: 500px !important; }
  .gbm-table .col-hide { display: none !important; }
  .gbm-btn-edit,
  .gbm-btn-addr,
  .gbm-btn-detail { padding: 6px 8px !important; font-size: 10px !important; }
}
@media (max-width: 480px) {
  .gbm-table th { font-size: 9px !important; padding: 8px !important; }
  .gbm-table td { font-size: 11px !important; padding: 8px !important; }
  .kpi-bar-4, .kpi-bar-3 { grid-template-columns: repeat(2,1fr) !important; }
  .kpi-value { font-size: 15px !important; }
  .page-count { display: none; }
}

/* ── ADMIN: filter-bar — scroll horizontal no mobile ────────── */
@media (max-width: 900px) {
  .filter-bar { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; }
  .filter-bar form { min-width: 700px !important; }
}

* { -webkit-tap-highlight-color: transparent; }

/* ── vendas.php topbar mobile ───────────────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 0 8px !important; height: auto !important; min-height: 44px !important; flex-wrap: wrap !important; gap: 4px !important; padding-top: 6px !important; padding-bottom: 6px !important; }
  .topbar .divider { display: none !important; }
  .topbar .page-title { font-size: 11px !important; }
  .topbar .vend-badge { font-size: 10px !important; padding: 2px 6px !important; }
  .topbar .tbtn { font-size: 10px !important; padding: 4px 8px !important; }
  .topbar-right { gap: 4px !important; flex-wrap: wrap !important; }

  /* main-grid: empilha no mobile */
  .main-grid { grid-template-columns: 1fr !important; height: auto !important; }
  .col-orc { display: none !important; }
  .col-search { min-width: unset !important; width: 100% !important; }
  .col-pedido { width: 100% !important; min-width: unset !important; border-left: none !important; border-top: 1px solid var(--border) !important; }
}

/* ── vendas.php main-grid mobile ────────────────────────────── */
@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr !important;
    overflow: visible !important;
    height: auto !important;
  }
  .col-orc {
    display: none !important;
  }
  .col-pedido {
    border-left: none !important;
    border-top: 1px solid var(--border) !important;
    overflow: visible !important;
    min-height: 300px !important;
  }
  /* col-search ocupa tela toda */
  .main-grid > div:nth-child(2) {
    min-width: unset !important;
    width: 100% !important;
    overflow: visible !important;
  }
}

/* ── vendas.php body + layout fixes ─────────────────────────── */
@media (max-width: 768px) {
  body {
    overflow: auto !important;
    height: auto !important;
    min-height: 100vh !important;
  }
  .main-grid {
    grid-template-columns: 1fr !important;
    overflow: visible !important;
    height: auto !important;
    min-height: calc(100vh - 44px) !important;
  }
  .col-orc {
    display: none !important;
  }
  /* col-search: busca */
  .main-grid > div:nth-child(2) {
    overflow: visible !important;
    height: auto !important;
    min-height: 50vh !important;
  }
  /* col-pedido */
  .col-pedido {
    width: 100% !important;
    border-left: none !important;
    border-top: 1px solid rgba(255,255,255,.07) !important;
    overflow: visible !important;
    height: auto !important;
    min-height: 400px !important;
  }
  /* statusbar de atalhos */
  .statusbar, .kbd-bar {
    display: none !important;
  }
}
