/* ==========================================================================
   MOBILE.CSS - Imeraki — site público + admin
   ==========================================================================
   Estratégia: Mobile First reset.
   Aplicado em todas as telas com max-width: 768px.
   Sempre acompanha style.css (carregado DEPOIS dele).
   ========================================================================== */

/* ==========================================================================
   1. BASE TÉCNICA (todas as telas, não só mobile)
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Anti-overflow universal — nada pode estourar */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

/* MOBILE: limita TODOS os containers e elementos */
@media (max-width: 768px) {
  /* Inputs nunca estouram */
  input, textarea, select {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  /* Tabelas com scroll horizontal se forem largas demais */
  table:not(.table) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Imagens nunca estouram */
  img { max-width: 100%; height: auto; }
  /* Qualquer div com min-width fixo em px é forçada a 0 */
  div[style*="min-width:"][style*="px"]:not([style*="min-width:0"]) {
    min-width: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   2. LOGO — solução definitiva pro fundo escuro
   ========================================================================== */

/* Aplica em qualquer header escuro do projeto */
.site-header__logo img,
.admin-header__logo img {
  background: transparent !important;
  mix-blend-mode: screen;
  isolation: isolate;
}

/* ==========================================================================
   3. HAMBURGER + DRAWERS (compartilhado público e admin)
   ========================================================================== */

/* Botão hambúrguer escondido em desktop */
.site-header__hamburger,
.header-hamburger,
.admin-hamburger {
  display: none;
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}
.site-header__hamburger:hover,
.header-hamburger:hover,
.admin-hamburger:hover {
  background: rgba(255,255,255,0.1);
}

/* Drawer overlay (escurece fundo) */
.drawer-overlay,
.adm-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.drawer-overlay.open,
.adm-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer principal (site público) */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: #fff;
  color: #281B39;
  z-index: 999;
  transform: translateX(-100%);
  transition: transform 0.25s ease-out;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 20px rgba(0,0,0,0.3);
  overflow-y: auto;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.drawer.open { transform: translateX(0); }

/* Drawer do admin (fundo escuro) */
.adm-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: #281B39;
  color: white;
  z-index: 999;
  transform: translateX(-100%);
  transition: transform 0.25s ease-out;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 20px rgba(0,0,0,0.3);
}
.adm-drawer.open { transform: translateX(0); }

.adm-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.2);
  padding-top: calc(18px + env(safe-area-inset-top));
}
.adm-drawer__head strong {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  letter-spacing: 0.5px;
}
.adm-drawer__close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 4px;
  min-width: 44px;
  min-height: 44px;
}

.adm-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.adm-drawer__user {
  padding: 14px 20px;
  background: rgba(0,0,0,0.15);
  margin-bottom: 8px;
}
.adm-drawer__user strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}
.adm-drawer__user small {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

.adm-drawer__group {
  font-size: 10px;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.45);
  padding: 14px 20px 4px;
  font-weight: 600;
}
.adm-drawer__link {
  display: block;
  color: white;
  text-decoration: none;
  padding: 12px 20px;
  font-size: 14px;
  border-left: 3px solid transparent;
  min-height: 44px;
}
.adm-drawer__link:hover {
  background: rgba(255,255,255,0.08);
}
.adm-drawer__link.active {
  background: rgba(200,20,60,0.15);
  border-left-color: #C8143C;
  font-weight: 600;
}
.adm-drawer__link--danger {
  color: #ff8a99;
}
.adm-drawer__sep {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 12px 16px;
}

/* ==========================================================================
   3.5. DRAWER DO PÚBLICO (fundo branco)
   ========================================================================== */

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #eee;
  background: #281B39;
  color: white;
  padding-top: calc(18px + env(safe-area-inset-top));
}
.drawer__header strong {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  letter-spacing: 0.5px;
}
.drawer__close {
  background: transparent;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 4px;
  min-width: 44px;
  min-height: 44px;
}
.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.drawer__body > a {
  display: block;
  padding: 14px 20px;
  font-size: 14px;
  color: #281B39;
  text-decoration: none;
  border-bottom: 1px solid #f4f4f4;
  min-height: 44px;
}
.drawer__body > a:hover {
  background: #faf7f9;
}
.drawer__body > a.drawer__sub {
  padding-left: 36px;
  font-size: 13px;
  color: #666;
}
.drawer__group {
  font-size: 10px;
  letter-spacing: 1.2px;
  color: #999;
  padding: 14px 20px 4px;
  font-weight: 600;
  background: #faf7f9;
  border-top: 1px solid #eee;
}

/* ==========================================================================
   3.6. EDIÇÃO EM MASSA — cards de produtos (sempre, não só mobile)
   ========================================================================== */

.massa-selecao-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.massa-selecao-acoes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.massa-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
}
.massa-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #eee;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.massa-item:hover {
  background: #faf7f9;
  border-color: #ddd;
}
.massa-item--ativo {
  background: #fff5f7 !important;
  border-color: #C8143C !important;
}
.massa-item input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.massa-item__corpo {
  flex: 1;
  min-width: 0;
}
.massa-item__nome {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.massa-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11px;
  color: #666;
}
.massa-item__meta code {
  font-family: 'Courier New', monospace;
  background: #f4f4f6;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
}

/* ==========================================================================
   4. MOBILE: ≤ 768px — APLICA TUDO
   ========================================================================== */

@media (max-width: 768px) {

  /* ---------- 4.1. INPUTS (anti-zoom iOS) ---------- */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="tel"], input[type="number"], input[type="search"],
  input[type="url"], input[type="date"], input[type="datetime-local"],
  input[type="month"], input[type="time"], textarea, select {
    font-size: 16px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ---------- 4.2. TOUCH TARGETS ---------- */
  button, .btn, a.btn,
  input[type="submit"], input[type="button"] {
    min-height: 44px;
  }
  .btn.sm, button.sm { min-height: 36px; }

  /* ---------- 4.3. TIPOGRAFIA RESET ---------- */
  h1 { font-size: 22px !important; line-height: 1.2 !important; }
  h2 { font-size: 18px !important; line-height: 1.3 !important; }
  h3 { font-size: 15px !important; line-height: 1.3 !important; }

  /* ---------- 4.4. CONTAINERS ---------- */
  .container {
    padding-left: 14px !important;
    padding-right: 14px !important;
    max-width: 100% !important;
  }

  /* ==========================================================================
     5. SITE PÚBLICO ESPECÍFICO
     ========================================================================== */

  /* Header do site público: hambúrguer + logo + carrinho — só isso */
  .site-header {
    padding: 10px 14px !important;
    padding-top: calc(10px + env(safe-area-inset-top)) !important;
    min-height: 56px !important;
    height: auto !important;
    gap: 8px !important;
  }
  .site-header__hamburger,
  .header-hamburger {
    display: inline-flex !important;
    order: 1;
  }
  .site-header__logo {
    order: 2;
    flex: 1;
    justify-content: center;
    margin: 0 !important;
  }
  .site-header__logo img {
    height: 28px !important;
    width: auto !important;
  }
  /* Esconde nav central, conta texto, "Brunna" textual etc */
  .site-header__nav,
  .site-header__conta,
  .site-header__user-text,
  .site-header__user-name {
    display: none !important;
  }
  /* Mantém só os ícones de busca e carrinho */
  .site-header__actions {
    order: 3;
    display: flex;
    gap: 4px;
    align-items: center;
  }
  /* Esconde search-form (estoura overflow) + texto "Entrar" + nome usuário */
  .site-header__actions .search-form,
  .site-header__actions .user-submenu,
  .site-header__actions a.ico-link {
    display: none !important;
  }
  .site-header__actions a,
  .site-header__actions button,
  .site-header__search,
  .site-header__cart {
    width: 40px;
    height: 40px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
  }

  /* Hero / banner principal */
  .hero {
    padding: 30px 16px !important;
  }
  .hero h1 {
    font-size: 24px !important;
  }
  .hero p {
    font-size: 14px !important;
  }

  /* Páginas internas — título não cabe em 48px */
  .pagina-titulo,
  .page-titulo,
  h1.titulo {
    font-size: 24px !important;
    line-height: 1.2 !important;
    margin: 16px 0 !important;
  }

  /* Catálogo: grid 2 col */
  .catalogo-grid,
  .produtos-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* Footer */
  .site-footer__inner {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    padding: 24px 16px !important;
    text-align: center;
  }
  .site-footer h4 {
    font-size: 13px !important;
  }
  .site-footer p,
  .site-footer a {
    font-size: 13px !important;
  }

  /* Newsletter form */
  .newsletter-form {
    flex-direction: column !important;
    gap: 8px;
  }
  .newsletter-form input,
  .newsletter-form button {
    width: 100% !important;
  }

  /* ==========================================================================
     6. CONTA DO CLIENTE
     ========================================================================== */

  /* Olá + botão Sair: empilha */
  .conta-saudacao {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px;
  }

  /* Abas (Meus dados / Meus pedidos / Endereços) — scroll horizontal */
  .conta-tabs,
  .tabs-conta {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    flex-wrap: nowrap !important;
    border-bottom: 1px solid #eee;
    padding-bottom: 0 !important;
  }
  .conta-tabs > a,
  .conta-tabs > button,
  .tabs-conta > a,
  .tabs-conta > button {
    flex-shrink: 0;
    font-size: 13px !important;
    padding: 10px 14px !important;
  }

  /* ==========================================================================
     7. ADMIN ESPECÍFICO
     ========================================================================== */

  /* Header do admin: hambúrguer + logo (sem "ADMIN" texto, sem "Ver site", sem nome) */
  .admin-header {
    padding: 10px 14px !important;
    padding-top: calc(10px + env(safe-area-inset-top)) !important;
    min-height: 56px !important;
    height: auto !important;
    gap: 8px !important;
  }
  .admin-hamburger {
    display: inline-flex !important;
  }
  .admin-header__logo img {
    height: 26px !important;
    max-height: 26px !important;
  }
  /* Esconde nav inteira + "ADMIN" tag + área direita */
  .admin-header__nav,
  .admin-header__right,
  .admin-header__logo-tag {
    display: none !important;
  }

  /* ==========================================================================
     8. PAGE-HEAD (admin)
     ========================================================================== */

  .page-head {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding-bottom: 16px !important;
    margin-bottom: 16px !important;
  }
  .page-head h1 {
    font-size: 22px !important;
    margin: 0 !important;
    word-break: break-word;
  }
  .page-head__sub {
    font-size: 12px !important;
    color: #888;
  }
  /* Botões à direita ocupam linha cheia */
  .page-head > div:last-child {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .page-head > div:last-child > a,
  .page-head > div:last-child > button {
    flex: 1;
    min-width: 0;
    font-size: 13px !important;
    padding: 10px 12px !important;
    text-align: center;
    justify-content: center;
  }

  /* ==========================================================================
     9. TOOLBAR (filtros) — empilha
     ========================================================================== */

  .toolbar {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-bottom: 16px;
  }
  .toolbar input,
  .toolbar select {
    width: 100% !important;
  }

  /* ==========================================================================
     10. FORM CARDS
     ========================================================================== */

  .form-card {
    padding: 14px !important;
    margin-bottom: 14px !important;
  }
  .form-grid,
  .form-grid-3 {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
  .form-row {
    margin-bottom: 12px !important;
  }
  .form-row label {
    font-size: 12px !important;
  }

  /* ==========================================================================
     11. TABELAS → CARDS (regra geral, opt-out com .no-mobile-cards)
     ========================================================================== */

  table.table:not(.no-mobile-cards) {
    border: none !important;
    background: transparent !important;
  }
  table.table:not(.no-mobile-cards) thead {
    display: none;
  }
  table.table:not(.no-mobile-cards) tbody {
    display: block;
  }
  table.table:not(.no-mobile-cards) tr {
    display: block;
    background: #fff;
    border: 1px solid #e8e8ec;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  table.table:not(.no-mobile-cards) td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none !important;
    padding: 5px 0 !important;
    gap: 10px;
    font-size: 13px;
    text-align: right;
    min-height: auto;
  }
  table.table:not(.no-mobile-cards) td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #888;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    flex-shrink: 0;
  }
  table.table:not(.no-mobile-cards) td:empty::before {
    display: none;
  }
  /* Primeira célula em destaque (nome/título) */
  table.table:not(.no-mobile-cards) td:first-child {
    flex-direction: column;
    align-items: flex-start !important;
    text-align: left;
    border-bottom: 1px solid #f0f0f0 !important;
    padding-bottom: 10px !important;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
  }
  table.table:not(.no-mobile-cards) td:first-child::before {
    display: none;
  }
  /* Última célula (botões) — linha cheia */
  table.table:not(.no-mobile-cards) td:last-child {
    flex-direction: column !important;
    align-items: stretch !important;
    border-top: 1px solid #f0f0f0;
    padding-top: 10px !important;
    margin-top: 4px;
    gap: 6px;
  }
  table.table:not(.no-mobile-cards) td:last-child::before {
    display: none;
  }
  table.table:not(.no-mobile-cards) td:last-child > * {
    width: 100%;
    text-align: center;
  }

  /* ==========================================================================
     12. CARDS DE RESUMO (dashboard, totais, etc.)
     ========================================================================== */

  /* Grids inline com auto-fit ou colunas fixas */
  [style*="grid-template-columns: repeat(auto-fit"],
  [style*="grid-template-columns: 1fr 1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: 1fr 360px"],
  [style*="grid-template-columns: 1fr 320px"] {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* ==========================================================================
     13. MODALS (admin + público)
     ========================================================================== */

  .modal-overlay.open {
    padding: 0 !important;
    align-items: stretch !important;
  }
  .modal-body {
    max-width: 100% !important;
    width: 100% !important;
    min-height: 100vh;
    border-radius: 0 !important;
    padding: 16px !important;
    padding-top: calc(16px + env(safe-area-inset-top)) !important;
    padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
    overflow-y: auto;
  }
  .modal-actions {
    position: sticky;
    bottom: 0;
    background: white;
    margin: 16px -16px -16px !important;
    padding: 12px 16px !important;
    padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-actions .btn {
    flex: 1;
    min-width: 100px;
  }

  /* ==========================================================================
     14. ALERTAS / BADGES / TAGS
     ========================================================================== */

  .alert {
    font-size: 13px !important;
    padding: 10px 12px !important;
    margin-bottom: 12px !important;
  }
  .status-badge {
    font-size: 10px !important;
    padding: 2px 6px !important;
    white-space: normal !important;
  }

  /* ==========================================================================
     15. BANNER SANDBOX
     ========================================================================== */

  body > div[style*="MODO SANDBOX"] {
    font-size: 11px !important;
    padding: 6px 10px !important;
  }

  /* ==========================================================================
     16. PÁGINA DE PRODUTO (público)
     ========================================================================== */

  .produto-galeria-wrap {
    width: 100%;
  }
  .produto-info {
    margin-top: 16px !important;
  }
  .produto-info__nome {
    font-size: 22px !important;
  }
  .produto-info__preco {
    font-size: 26px !important;
  }
  .produto-galeria__thumbs {
    justify-content: center;
    gap: 6px !important;
  }

  /* Esconde zoom-pane que é só pra desktop */
  .produto-galeria__zoom-pane {
    display: none !important;
  }

  /* Sticky comprar */
  .sticky-comprar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: white;
    padding: 12px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
    transform: translateY(110%);
    transition: transform 0.25s ease-out;
  }
  .sticky-comprar.visivel {
    transform: translateY(0);
  }
  .sticky-comprar .btn {
    width: 100%;
  }
  body.tem-sticky {
    padding-bottom: 100px;
  }
  body.tem-sticky .wa-float {
    bottom: 100px !important;
  }

  /* ==========================================================================
     17. CARRINHO / CHECKOUT
     ========================================================================== */

  .checkout-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .carrinho-item {
    flex-direction: column !important;
    gap: 10px;
  }

  /* ==========================================================================
     18. PEDIDO ADMIN — bloco com cards de cliente/endereço/entrega
     ========================================================================== */

  .pedido-grid-topo {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .pedido-grid-bottom {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
}

/* ==========================================================================
   19. TELA EXTRA-ESTREITA: ≤ 380px
   ========================================================================== */

@media (max-width: 380px) {
  .container {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .form-card {
    padding: 12px !important;
  }
  h1 { font-size: 20px !important; }
  .page-head h1 { font-size: 19px !important; }
  /* Cards em 1 coluna */
  [style*="grid-template-columns: 1fr 1fr"]:not([style*="2fr"]) {
    grid-template-columns: 1fr !important;
  }
  .catalogo-grid,
  .produtos-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   20. DESKTOP: ≥ 769px — esconde elementos só de mobile
   ========================================================================== */

@media (min-width: 769px) {
  .site-header__hamburger,
  .header-hamburger,
  .admin-hamburger,
  .drawer,
  .adm-drawer,
  .drawer-overlay,
  .adm-drawer-overlay {
    display: none !important;
  }
  .sticky-comprar {
    display: none !important;
  }
}
