/* Estrutura visual compartilhada por todas as lojas. Cada loja troca as
   variaveis de cor (definidas inline no header.ejs a partir do config.json)
   e o logo/tema/override.css - o layout em si nao muda. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--cor-texto, #1f2937);
  background: var(--cor-fundo, #ffffff);
}

a { color: inherit; text-decoration: none; }

/* Cabecalho */
.cabecalho {
  background: var(--cor-primaria, #0ea5e9);
  color: #ffffff;
}
.cabecalho-conteudo {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; font-weight: bold; }
.logo img { height: 40px; }
.nav-categorias { display: flex; gap: 1.25rem; flex: 1; flex-wrap: wrap; align-items: center; }
.nav-categorias a { opacity: 0.9; }
.nav-categorias a:hover { opacity: 1; text-decoration: underline; }
.link-carrinho {
  border: 1px solid rgba(255,255,255,0.6); padding: 0.4rem 0.9rem; border-radius: 6px;
  position: relative; display: inline-flex; align-items: center; gap: 0.4rem;
}
.badge-carrinho {
  background: var(--cor-destaque, #f97316); color: #fff;
  font-size: 0.7rem; font-weight: bold; line-height: 1;
  padding: 0.25rem 0.45rem; border-radius: 999px; min-width: 1.1em; text-align: center;
}

/* Busca */
.busca-form { display: flex; gap: 0.4rem; }
.busca-form input[type=search] {
  padding: 0.45rem 0.7rem; border-radius: 6px; border: none;
  min-width: 200px; font-size: 0.9rem;
}
.busca-form button {
  padding: 0.45rem 0.8rem; border-radius: 6px; border: none;
  background: rgba(255,255,255,0.2); color: #fff; cursor: pointer;
}
.busca-form button:hover { background: rgba(255,255,255,0.3); }

/* Menu hamburguer (so aparece no mobile, via media query abaixo) */
.menu-toggle-entrada { display: none; }
.menu-toggle-botao {
  display: none; font-size: 1.5rem; cursor: pointer; padding: 0.2rem 0.5rem;
  border: 1px solid rgba(255,255,255,0.6); border-radius: 6px; line-height: 1;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--cor-primaria, #0ea5e9), var(--cor-destaque, #f97316));
  color: #ffffff;
  padding: 3rem 1.5rem;
  text-align: center;
}
.hero-conteudo h1 { margin: 0 0 0.5rem; font-size: 2rem; }

/* Secoes gerais */
.secao {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.secao h2 { margin-bottom: 1rem; }

/* Filtros de produto (cor/potencia/tamanho) */
.filtros-produto { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin-bottom: 1.5rem; }
.filtros-produto label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.filtros-produto select { padding: 0.45rem 0.6rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; }

/* Grade de produtos */
.grade-produtos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}
.card-produto {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  display: block;
  transition: box-shadow 0.15s ease;
}
.card-produto:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.1); }
.card-produto-imagem { position: relative; aspect-ratio: 1 / 1; background: #f3f4f6; }
.card-produto-imagem img { width: 100%; height: 100%; object-fit: cover; }
.selo-desconto {
  position: absolute; top: 8px; right: 8px;
  background: var(--cor-destaque, #f97316); color: #fff;
  font-size: 0.75rem; font-weight: bold; padding: 0.2rem 0.5rem; border-radius: 4px;
}
.card-produto-info { padding: 0.75rem; }
.card-produto-info h3 { font-size: 0.95rem; margin: 0 0 0.4rem; }
.preco-original { text-decoration: line-through; color: #9ca3af; font-size: 0.85rem; margin-right: 0.4rem; }
.preco-atual { font-weight: bold; font-size: 1.1rem; color: var(--cor-primaria, #0ea5e9); }
.preco-atual.grande { font-size: 1.6rem; display: block; margin: 0.5rem 0; }

/* Selos de confianca */
.selos-confianca {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center;
  border-top: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb;
}
.selos-confianca .selo {
  padding: 0.75rem 1.25rem; background: #f9fafb; border-radius: 6px; font-size: 0.9rem;
}

/* Migalhas de pao (breadcrumb) */
.migalhas { font-size: 0.85rem; color: #6b7280; padding: 1rem 1.5rem 0; max-width: 1200px; margin: 0 auto; }
.migalhas a { color: #6b7280; }
.migalhas a:hover { text-decoration: underline; }
.migalhas-separador { margin: 0 0.4rem; }
.migalhas span[aria-current] { color: var(--cor-texto, #1f2937); font-weight: 600; }

/* Pagina de produto */
.pagina-produto { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.produto-imagem img { width: 100%; border-radius: 8px; }
.produto-miniaturas { display: flex; gap: 0.6rem; margin-top: 0.75rem; flex-wrap: wrap; }
.produto-miniaturas img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 2px solid transparent; opacity: 0.7; }
.produto-miniaturas img:hover { opacity: 1; }
.produto-miniaturas img.ativa { border-color: var(--cor-primaria, #0ea5e9); opacity: 1; }
.form-adicionar { display: flex; flex-direction: column; gap: 0.75rem; max-width: 260px; margin-top: 1rem; }
.form-adicionar label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }

.produto-selos-mini {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; margin-top: 1.25rem;
  font-size: 0.8rem; color: #6b7280;
}

.ficha-tecnica { border-collapse: collapse; margin-top: 1.5rem; max-width: 480px; width: 100%; }
.ficha-tecnica caption { text-align: left; font-weight: bold; margin-bottom: 0.5rem; }
.ficha-tecnica th, .ficha-tecnica td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid #e5e7eb; font-size: 0.9rem; }
.ficha-tecnica th { color: #6b7280; font-weight: 600; width: 45%; }

/* Botoes */
.botao {
  display: inline-block; padding: 0.7rem 1.4rem; border-radius: 6px; border: none;
  cursor: pointer; font-size: 1rem; text-align: center;
}
.botao-primario { background: var(--cor-primaria, #0ea5e9); color: #fff; }
.botao-secundario { background: #e5e7eb; color: #1f2937; }
.botao-link { background: none; color: #ef4444; text-decoration: underline; padding: 0; }

/* Carrinho */
.tabela-carrinho { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.tabela-carrinho th, .tabela-carrinho td { border-bottom: 1px solid #e5e7eb; padding: 0.6rem; text-align: left; }
.form-inline { display: inline; }
.form-inline input[type=number] { width: 60px; }
.resumo-carrinho { text-align: right; }
.calculo-frete { text-align: left; max-width: 320px; margin: 0.75rem 0 0.75rem auto; }
.calculo-frete label { display: block; font-size: 0.85rem; margin-bottom: 0.3rem; }
.calculo-frete-linha { display: flex; gap: 0.5rem; }
.calculo-frete-linha input { flex: 1; padding: 0.5rem; border: 1px solid #d1d5db; border-radius: 6px; }
.mensagem-frete { font-size: 0.85rem; color: #6b7280; min-height: 1.2em; margin-top: 0.35rem; }
.resumo-carrinho .total { font-size: 1.2rem; font-weight: bold; }

/* Checkout */
.checkout-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
.form-checkout { display: flex; flex-direction: column; gap: 0.85rem; }
.form-checkout label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; }
.form-linha { display: flex; gap: 0.85rem; }
.form-linha label { flex: 1; }
.form-pagamento-opcoes { display: flex; gap: 1.25rem; flex-direction: row; }
.opcao-pagamento { flex-direction: row !important; align-items: center; gap: 0.4rem !important; font-size: 0.95rem !important; }
.aviso-dados-salvos {
  margin: -0.3rem 0 0; font-size: 0.8rem; color: #6b7280;
  background: #f9fafb; padding: 0.5rem 0.75rem; border-radius: 6px;
}
.botao-link-inline {
  background: none; border: none; padding: 0; color: var(--cor-primaria, #0ea5e9);
  text-decoration: underline; cursor: pointer; font-size: inherit;
}
.resumo-checkout { background: #f9fafb; padding: 1.25rem; border-radius: 8px; align-self: start; }
.mensagem-erro { color: #ef4444; font-weight: bold; }

/* Pagamento PIX */
.qrcode-pix { width: 220px; height: 220px; display: block; margin: 1rem 0; }
.campo-codigo-pix { width: 100%; max-width: 480px; }

/* Pagina de erro (produto nao encontrado) */
.pagina-404 { text-align: center; padding: 4rem 1.5rem; }
.pagina-404 h1 { margin-bottom: 0.5rem; }
.pagina-404 p { color: #6b7280; margin-bottom: 1.5rem; }

/* Rodape */
.rodape { border-top: 1px solid #e5e7eb; margin-top: 2rem; background: #f9fafb; }
.rodape-conteudo { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 1rem; font-size: 0.85rem; color: #6b7280; }
.rodape-colunas {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem;
  padding-bottom: 1.5rem; border-bottom: 1px solid #e5e7eb; margin-bottom: 1rem;
}
.rodape-colunas strong { display: block; margin-bottom: 0.5rem; color: #1f2937; }
.rodape-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.rodape-links a:hover { text-decoration: underline; }
.rodape-copyright { text-align: center; margin: 0; }

/* Botao flutuante do WhatsApp */
.whatsapp-flutuante {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 50;
  width: 56px; height: 56px; border-radius: 50%;
  background: #25d366; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.whatsapp-flutuante:hover { filter: brightness(1.05); }

@media (max-width: 720px) {
  .pagina-produto, .checkout-grid { grid-template-columns: 1fr; }
  .rodape-colunas { grid-template-columns: 1fr; }

  /* Menu hamburguer: esconde a navegacao e a busca por padrao, mostra so o
     botao de toggle; marcar o checkbox (via clique no label) revela ambos. */
  .cabecalho-conteudo { gap: 0.75rem; }
  .menu-toggle-botao { display: inline-block; order: 1; }
  .logo {
    order: 0; font-size: 1rem; max-width: 55vw; flex-shrink: 1;
  }
  .logo img { height: 28px; flex-shrink: 0; }
  .logo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .link-carrinho { order: 2; margin-left: auto; }
  .busca-form,
  .nav-categorias {
    flex-basis: 100%; display: none; order: 3;
  }
  .menu-toggle-entrada:checked ~ .busca-form,
  .menu-toggle-entrada:checked ~ .nav-categorias {
    display: flex;
  }
  .busca-form input[type=search] { min-width: 0; flex: 1; }
}
