/* ============================================================
   FarmaSystem Pro — Loja Online
   Identidade: "selo de bula" — verde-cipreste + areia + terracota
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700;9..144,800&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --g: var(--cor-primaria, #1B4332);
  --g2: #2D6A4F;
  --glt: #E7F0EA;
  --areia: #F7F3E9;
  --areia-escura: #EFE8D6;
  --terracota: #C1502E;
  --terracota-lt: #F4E2D8;
  --ambar: #B8842A;
  --ambar-lt: #F6EBD6;
  --white: #fff;
  --border: #E3DCC9;
  --text: #20261F;
  --muted: #6B7263;
  --rd: 14px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--areia);
  color: var(--text);
  font-size: 15px;
}

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

/* ---------- TOPBAR ---------- */
.topbar {
  background: var(--g);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 500;
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--brand-size, 1.15rem);
}
.brand .seal {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--terracota);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cart-btn {
  position: relative;
  background: rgba(255,255,255,.14);
  border: none;
  color: #fff;
  width: var(--cart-size, 40px); height: var(--cart-size, 40px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--cart-size, 40px) * 0.275);
  cursor: pointer;
}
.cart-count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--terracota);
  color: #fff;
  font-size: .62rem;
  font-weight: 800;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- BANNER ---------- */
.banner-loja {
  position: relative;
  min-height: 200px;
  background: var(--g);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
}
.banner-loja::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,42,32,.15), rgba(15,42,32,.65));
}
.banner-content { position: relative; z-index: 1; padding: 20px; }
.banner-content h1 {
  font-family: var(--font-display);
  font-size: var(--banner-title-size, 1.7rem);
  font-weight: 700;
  margin: 0 0 6px;
  text-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.banner-content p { opacity: .9; font-size: var(--banner-sub-size, .9rem); margin: 0; }

/* ---------- FILTROS ---------- */
.filtros-wrap {
  max-width: 1180px;
  margin: -22px auto 0;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}
.filtros-card {
  background: var(--white);
  border-radius: var(--rd);
  box-shadow: 0 8px 30px rgba(15,42,32,.12);
  padding: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.filtros-card input[type=search] {
  flex: 1;
  min-width: 200px;
  padding: 11px 16px;
  border-radius: 100px;
  border: 1px solid var(--border);
  font-size: .88rem;
  font-family: var(--font-body);
}
.filtros-card select {
  padding: 11px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  font-size: .85rem;
  background: var(--white);
  font-family: var(--font-body);
}

.chips-categoria {
  max-width: 1180px;
  margin: 16px auto 0;
  padding: 0 20px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chip {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 100px;
  background: var(--white);
  border: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.chip.ativo { background: var(--g); color: #fff; border-color: var(--g); }

/* ---------- GRID DE PRODUTOS ---------- */
.produtos-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.produtos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.produto-card {
  background: var(--white);
  border-radius: var(--rd);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
}
.produto-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(15,42,32,.12);
}

.produto-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--glt);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem;
  overflow: hidden;
}
.produto-img-wrap img { width: 100%; height: 100%; object-fit: cover; }

.produto-badge-receita {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--terracota);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
}
.produto-badge-promo {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--ambar);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 100px;
}

.produto-info { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.produto-cat { font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.produto-nome {
  font-size: .87rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}

.produto-precos { margin-top: auto; display: flex; align-items: baseline; gap: 6px; }
.preco-de { font-size: .74rem; color: var(--muted); text-decoration: line-through; }
.preco-por { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--g); }

.produto-add-btn {
  margin-top: 8px;
  width: 100%;
  padding: 9px;
  border-radius: 8px;
  border: none;
  background: var(--g);
  color: #fff;
  font-weight: 600;
  font-size: .8rem;
  cursor: pointer;
}
.produto-add-btn:hover { filter: brightness(1.08); }

.sem-estoque-tag {
  font-size: .68rem;
  font-weight: 700;
  color: var(--terracota);
  text-transform: uppercase;
}

.sem-resultados {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  grid-column: 1 / -1;
}

/* ---------- MODAL DE PRODUTO ---------- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,20,16,.6);
  z-index: 2000;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-produto {
  background: var(--white);
  border-radius: 18px;
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: rgba(0,0,0,.4);
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  z-index: 5;
}

.modal-galeria { position: relative; background: var(--glt); }
.modal-img-principal {
  width: 100%; height: 280px;
  object-fit: cover;
  cursor: zoom-in;
}
.modal-img-placeholder {
  width: 100%; height: 280px;
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
}
.modal-thumbs { display: flex; gap: 6px; padding: 10px; flex-wrap: wrap; }
.modal-thumb { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; cursor: pointer; border: 2px solid transparent; }
.modal-thumb.ativo { border-color: var(--g); }

.modal-detalhes { padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.modal-cat { font-size: .68rem; text-transform: uppercase; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.modal-nome { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; line-height: 1.3; }
.modal-principio { font-size: .8rem; color: var(--muted); }
.modal-descricao { font-size: .84rem; line-height: 1.6; color: var(--text); white-space: pre-line; }

.modal-precos { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.modal-preco-por { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--g); }
.modal-preco-de { font-size: .9rem; color: var(--muted); text-decoration: line-through; }

.modal-receita-aviso {
  background: var(--terracota-lt);
  color: #7A2E18;
  font-size: .76rem;
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.modal-qtd-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.qtd-control { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 100px; }
.qtd-control button {
  width: 32px; height: 32px;
  border: none; background: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--g);
}
.qtd-control span { min-width: 28px; text-align: center; font-weight: 700; }

.modal-add-btn {
  margin-top: 10px;
  padding: 13px;
  border-radius: 100px;
  border: none;
  background: var(--g);
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  cursor: pointer;
}

@media (max-width: 640px) {
  .modal-produto { grid-template-columns: 1fr; }
}

/* ---------- CARRINHO LATERAL ---------- */
.cart-drawer {
  position: fixed;
  top: 0; right: -420px;
  width: 400px;
  max-width: 92vw;
  height: 100vh;
  background: var(--white);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0,0,0,.2);
  transition: right .25s ease;
}
.cart-drawer.open { right: 0; }

.cart-drawer-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 2999;
}
.cart-drawer-overlay.open { display: block; }

.cart-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-header h2 { font-family: var(--font-display); font-size: 1.1rem; margin: 0; }
.cart-header .close-cart { cursor: pointer; font-size: 1.3rem; color: var(--muted); }

.cart-items { flex: 1; overflow-y: auto; padding: 12px 16px; }
.cart-empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.cart-empty .ce-icon { font-size: 2.4rem; margin-bottom: 10px; }

.cart-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.cart-item-img {
  width: 56px; height: 56px;
  border-radius: 8px;
  background: var(--glt);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  overflow: hidden;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-nome { font-size: .8rem; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.cart-item-preco { font-size: .78rem; color: var(--muted); }
.cart-item-qtd { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.cart-item-qtd button {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-size: .8rem;
}
.cart-item-remove { color: var(--terracota); font-size: .7rem; text-align: right; cursor: pointer; }

.cart-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.cart-total-row { display: flex; justify-content: space-between; font-weight: 700; font-size: 1rem; margin-bottom: 12px; }
.cart-total-row .valor { font-family: var(--font-display); color: var(--g); font-size: 1.2rem; }

.cart-nome-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  font-size: .85rem;
  font-family: var(--font-body);
}

.btn-finalizar {
  width: 100%;
  padding: 14px;
  border-radius: 100px;
  border: none;
  background: #25D366;
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cart-receita-aviso {
  background: var(--terracota-lt);
  color: #7A2E18;
  font-size: .74rem;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}

/* ---------- LIGHTBOX ---------- */
.lb-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,20,16,.94);
  z-index: 9000;
  align-items: center; justify-content: center;
}
.lb-overlay.open { display: flex; }
.lb-overlay img { max-width: 90vw; max-height: 85vh; border-radius: 8px; }
.lb-close { position: absolute; top: 18px; right: 24px; color: #fff; font-size: 2rem; cursor: pointer; }

/* ---------- FOOTER ---------- */
.loja-footer {
  background: var(--g);
  color: rgba(255,255,255,.8);
  text-align: center;
  padding: 24px 20px;
  font-size: .8rem;
}
.loja-footer strong { color: #fff; }

/* ---------- WHATSAPP FLOAT ---------- */
.wa-float {
  position: fixed;
  bottom: 20px; right: 20px;
  width: var(--wa-size, 56px); height: var(--wa-size, 56px);
  background: #25D366;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  z-index: 400;
  cursor: pointer;
}

@media (max-width: 600px) {
  .produtos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .banner-content h1 { font-size: 1.3rem; }
}
