/* Modelo do site das lojas (aem-sites). Fonte: aem-platform/sites/template. */
/* ============================================================
   ESTILO BASE – VARIÁVEIS CSS (valores padrão para fallback)
   Após carregar o catalog.json, as variáveis serão sobrescritas
   pelas cores extraídas do style.qss.
============================================================ */
:root {
  --bg-main:          #F5F5F5;      /* fundo do cabeçalho/página (neutro) */
  --surface:          #FFFFFF;      /* fundo dos cards */
  --surface2:         #F5F5F5;      /* fundo secundário */
  --border:           #E0E0E0;      /* cor das bordas */
  --text:             #212121;      /* texto principal (escuro) */
  --text-dim:         color-mix(in srgb, var(--text) 62%, transparent); /* texto secundário (derivado do --text) */
  --accent:           #424242;      /* cor de destaque (preços, etc.) */
  --whatsapp:         #25D366;
  --radius:           12px;
  --font-head:        'Syne', sans-serif;
  --font-body:        'DM Sans', sans-serif;
  --cart-w:           380px;
  /* Botões pill (verde e amarelo) */
  --pill-green:       #424242;
  --pill-green-hover: #212121;
  --pill-yellow:      #EEEEEE;
  --pill-yellow-hover:#E0E0E0;
  --pill-text:        #212121;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100dvh;
}

/* HEADER (semi-transparente) */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245, 245, 245, 0.94);   /* fallback p/ navegadores sem color-mix */
  background: color-mix(in srgb, var(--bg-main) 94%, transparent);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.logo {
  font-family: var(--font-head);
  font-weight: 800; font-size: 20px;
  display: flex; align-items: center; gap: 8px;
}
.logo img { height: 32px; width: auto; }
.header-right { display: flex; align-items: center; gap: 10px; }

/* Seletor de moedas (fundo claro) */
.currency-selector {
  display: flex; gap: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 3px;
}
.currency-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim);
  font-family: var(--font-head); font-weight: 700; font-size: 11px;
  padding: 4px 10px; border-radius: 5px;
}
.currency-btn.active {
  background: var(--pill-yellow);
  color: var(--pill-text);
  font-weight: 800;
}

.cart-btn {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  padding: 8px 14px;
  font-size: 18px;
}
.cart-btn:hover { border-color: var(--accent); }
.cart-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--pill-green);
  color: white;
  font-family: var(--font-head);
  font-weight: 800; font-size: 10px;
  width: 18px; height: 18px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
}

/* HERO */
.hero {
  background: #111;
  border-bottom: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  color: #f0ede8;
}
.hero p { color: rgba(255,255,255,0.6) !important; }
.hero::before {
  content: '';
  position: absolute;
  left: 50%; bottom: -60px;
  transform: translateX(-50%);
  width: 80%; height: 200px;
  background: var(--pill-yellow);
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  pointer-events: none;
}
.hero-tag {
  display: inline-block;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 14px;
  margin-bottom: 16px;
}
.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
}
.hero h1 span { color: var(--accent); }
.hero h1 em { font-style: normal; }
.hero h1 em span { color: var(--accent); }
.hero p { color: var(--text-dim); }

/* LAYOUT PRINCIPAL */
.page {
  display: flex;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 28px;
}

/* SIDEBAR (CATEGORIAS) */
.sidebar { width: 190px; flex-shrink: 0; padding-top: 28px; }
.sidebar-title {
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding-left: 12px;
}
.cat-list { display: flex; flex-direction: column; gap: 2px; }
.cat-item {
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-dim);
  transition: all .15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cat-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.cat-item.active {
  background: var(--pill-yellow);
  color: var(--pill-text);
  font-weight: 700;
}
.cat-count {
  font-size: 10px;
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-dim);
}
.cat-item.active .cat-count {
  background: rgba(0,0,0,0.1);
  color: var(--pill-text);
}

/* CONTEÚDO */
.content { flex: 1; padding: 28px 0; min-width: 0; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.search-wrap { flex: 1; position: relative; }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 15px;
}
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 16px 10px 38px;
  outline: none;
}
.search-input:focus { border-color: var(--accent); }
.results-count { font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* Seletor mobile */
.mobile-cat-select {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
}

/* GRID DE PRODUTOS */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 14px;
}

/* CARD (fundo claro) */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 20px rgba(0,0,0,0.1);
}
.product-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface2);
}
.product-img {
  width: 100%;
  height: 100%;
  object-fit: contain;   /* foto de produto inteira, sem cortar */
  background: #fff;
  transition: transform .3s;
}
.product-card:hover .product-img { transform: scale(1.04); }
.product-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-dim);
}
.product-img-placeholder span { font-size: 36px; opacity: .5; }
.product-img-placeholder small { font-size: 10px; text-transform: uppercase; }

.product-body { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.product-category {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.product-name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
}
.product-brand { font-size: 11px; color: var(--text-dim); }
.product-price {
  margin-top: auto;
  padding-top: 10px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 17px;
  color: var(--accent);
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}
.price-currency { font-size: 11px; font-weight: 600; opacity: .7; }
.product-price-na {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: auto;
  padding-top: 10px;
}
.discount-badge {
  background: red;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 20px;
  margin-left: 6px;
}
.old-price {
  text-decoration: line-through;
  font-size: 12px;
  color: var(--text-dim);
  margin-right: 6px;
}

/* Botão adicionar (verde pill) */
.add-btn {
  margin: 0 12px 12px;
  background: var(--pill-green);
  color: white;
  border: none;
  border-radius: 28px;
  padding: 9px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, transform .1s;
  width: calc(100% - 24px);
}
.add-btn:hover { background: var(--pill-green-hover); }
.add-btn:active { transform: scale(.97); }
.add-btn.in-cart {
  background: transparent;
  color: var(--pill-green);
  border: 1px solid var(--pill-green);
}

/* CARRINHO (drawer) */
.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.cart-overlay.open { opacity: 1; pointer-events: all; }
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 201;
  width: var(--cart-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s;
}
.cart-drawer.open { transform: none; }
.cart-drawer { height: 100vh; height: 100dvh; }
.cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cart-header h2 { font-family: var(--font-head); font-weight: 700; font-size: 17px; flex: 1; }
.cart-back {
  display: none;
  background: none; border: none; color: var(--text);
  font-size: 26px; line-height: 1; cursor: pointer;
  width: 32px; height: 32px; border-radius: 6px;
}
.cart-back:hover { background: var(--surface2); }
.cart-drawer[data-step="checkout"] .cart-back { display: block; }

/* Duas telas dentro do drawer: 1) itens  2) dados + envio */
.cart-view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.cart-drawer[data-step="cart"] .cart-view-items { display: flex; }
.cart-drawer[data-step="checkout"] .cart-view-checkout { display: flex; }
.cart-drawer[data-empty="1"] .cart-footer { display: none; }
.checkout-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.checkout-bar { flex-shrink: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); background: var(--surface); }
.checkout-bar .whatsapp-btn { width: 100%; }
.co-summary {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font-size: 13px;
}
.co-summary .row { display: flex; justify-content: space-between; gap: 12px; color: var(--text-dim); }
.co-summary .row b { color: var(--text); font-family: var(--font-head); }
.co-summary .row.total b { font-size: 18px; }
.co-edit { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; }
.continue-btn {
  background: var(--pill-green, #25D366); border: none; border-radius: 28px; color: #fff;
  font-family: var(--font-head); font-weight: 700; font-size: 15px; padding: 13px; cursor: pointer;
}
.continue-btn:hover { background: var(--pill-green-hover, var(--pill-green, #1fb957)); }
.cart-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
}
.cart-close:hover { background: var(--surface2); color: var(--text); }
.cart-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px; }
.cart-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-dim);
}
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item-img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cart-item-total { font-family: var(--font-head); font-weight: 700; font-size: 13px; margin-top: 2px; }
.cart-item-price { font-size: 12px; color: var(--accent); margin-top: 2px; }
.cart-qty { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 16px;
}
.qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.qty-num { font-family: var(--font-head); font-weight: 700; font-size: 14px; min-width: 22px; text-align: center; }

.cart-footer {
  flex-shrink: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
}
.cart-total-label { font-size: 13px; color: var(--text-dim); }
.cart-total-value { font-family: var(--font-head); font-weight: 800; font-size: 22px; }

.clear-cart-btn {
  background: #FF4746;
  border: none;
  border-radius: 28px;
  color: white;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 12px;
  padding: 8px;
  cursor: pointer;
}
.clear-cart-btn:hover { background: #FF6A68; }
.clear-cart-btn { background: none; color: #FF4746; border: 1px solid #FF4746; }
.clear-cart-btn:hover { background: #FF4746; color: #fff; }

.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.client-fields { display: flex; flex-direction: column; gap: 8px; }
.client-fields input,
.client-fields select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 12px;
}
.client-fields input:focus,
.client-fields select:focus { border-color: var(--accent); }

/* ── Entrega por zona ── */
.addr-block { display: flex; flex-direction: column; gap: 8px; }
.addr-row { display: flex; gap: 8px; }
.addr-row input { flex: 1; min-width: 0; }
.cart-hint { font-size: 11px; color: var(--text-dim); text-align: right; margin-top: -8px; }
.delivery-box { display: flex; flex-direction: column; gap: 8px; }
.delivery-row { display: flex; gap: 8px; }
.delivery-row select { flex: 1; min-width: 0; }
.locate-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 9px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.locate-btn:hover { border-color: var(--accent); }
.delivery-info { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.delivery-info:empty { display: none; }
#addrMapBox { display: none; flex-direction: column; gap: 6px; }
#addrMap { height: 220px; border-radius: 10px; border: 1px solid var(--border); isolation: isolate; }
.addr-pin { background: none; border: none; }
.cart-sub-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-dim); }
.cart-sub-row span:last-child { color: var(--text); font-weight: 600; text-align: right; }
.hero .hero-address { font-size: 13px; margin-top: 8px; }
.whatsapp-btn {
  background: #25D366;
  border: none;
  border-radius: 28px;
  color: white;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.whatsapp-btn svg { width: 20px; height: 20px; }

/* TOAST */
.toast-notify {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pill-green);
  color: white;
  padding: 10px 20px;
  border-radius: 40px;
  font-size: 14px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 400;
  white-space: nowrap;
}
.toast-notify.show { opacity: 1; }

.loading-state, .error-state {
  grid-column: 1/-1;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-dim);
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* MOBILE */
@media (max-width: 740px) {
  .sidebar { display: none; }
  .hero { padding: 28px 16px; }
  header, .page { padding-left: 16px; padding-right: 16px; }
  :root { --cart-w: 100vw; }
  .client-fields input, .client-fields select { font-size: 16px; } /* evita zoom automático no iOS */
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .mobile-cat-select { display: block; flex: 1; min-width: 120px; }
  .toolbar { flex-direction: row; flex-wrap: wrap; }
  .search-wrap { flex: 1 1 100%; }
}

/* ── HORÁRIOS: aviso de loja fechada / produto indisponível ── */
.closed-banner {
  padding: 12px 20px; text-align: center; font-size: 14px; line-height: 1.4;
  background: color-mix(in srgb, #F59E0B 18%, var(--surface));
  color: var(--text);
  border-bottom: 1px solid color-mix(in srgb, #F59E0B 45%, var(--border));
}
.closed-banner[hidden] { display: none; }
.closed-banner strong { font-family: var(--font-head); }
.closed-banner .closed-next { display: block; font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.closed-note {
  padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.35;
  background: color-mix(in srgb, #F59E0B 18%, var(--surface)); color: var(--text);
}
.closed-note[hidden] { display: none; }
.checkout-bar .closed-note { margin-bottom: 10px; }
.product-card.unavail .product-img-wrap, .product-card.unavail .product-body { opacity: .5; filter: grayscale(.7); }
.unavail-tag { margin: 0 12px 8px; font-size: 12px; font-weight: 600; color: var(--text-dim); text-align: center; }
.add-btn:disabled, .continue-btn:disabled, .whatsapp-btn:disabled { opacity: .45; cursor: not-allowed; }
.add-btn:disabled:hover { background: var(--pill-green); }
.cart-item.unavail .cart-item-name { opacity: .6; }
.cart-item-warn { font-size: 12px; font-weight: 600; color: #B45309; margin-top: 2px; }
