:root {
  --bg-main:       #fff8f5;
  --bg-card:       #ffffff;
  --bg-input:      #f3f4f6;
  --primary:       #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --primary-pale:  #f5f3ff;
  --branco:        #ffffff;
  --texto:         #1f2937;
  --texto-leve:    #6b7280;
  --cinza-claro:   #f3f4f6;
  --cinza-medio:   #9ca3af;
  --cinza-escuro:  #374151;
  --vermelho:      #ef4444;
  --azul:          #3b82f6;
  --verde-ok:      #22c55e;
  --sombra:        0 4px 24px rgba(0,0,0,0.08);
  --sombra-card:   0 2px 12px rgba(0,0,0,0.06);
  --radius:        10px;
  --radius-sm:     6px;
  --transicao:     all 0.2s ease;
  --font-base:     'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-base); background-color: var(--bg-main); color: var(--texto); min-height: 100vh; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; transition: var(--transicao); }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; display: block; }

.hidden { display: none !important; }
.flex { display: flex; }

/* === SPLASH / HOME === */
.splash-page {
  min-height: 100dvh;
  background: linear-gradient(160deg, #1c0800 0%, var(--primary) 55%, #ffb347 100%);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 2rem 1rem;
  position: relative; overflow: hidden;
}
.splash-circle {
  position: fixed; border-radius: 50%;
  background: rgba(255,255,255,0.04); pointer-events: none;
}
.splash-wrap {
  position: relative; z-index: 10; text-align: center;
  animation: fadeSlideUp 0.9s cubic-bezier(.22,1,.36,1) both;
}
@keyframes fadeSlideUp { from { opacity:0; transform:translateY(40px); } to { opacity:1; transform:translateY(0); } }
.logo-ring {
  display: inline-flex; align-items: center; justify-content: center;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(255,255,255,0.1); backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 0 0 12px rgba(255,255,255,0.04), 0 20px 60px rgba(0,0,0,0.3);
  margin-bottom: 1.75rem;
}
.logo-ring img { width: 120px; height: 120px; object-fit: contain; border-radius: 50%; }
.logo-ring-icone { font-size: 4rem; }
.splash-label { font-size: 0.78rem; letter-spacing: 0.28em; text-transform: uppercase; color: rgba(255,255,255,0.6); margin-bottom: 0.3rem; }
.splash-nome { font-size: clamp(1.8rem, 7vw, 2.8rem); font-weight: 800; color: #fff; line-height: 1.1; margin-bottom: 0.5rem; }
.splash-divider { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin: 0.75rem 0 1rem; color: rgba(255,255,255,0.35); }
.splash-divider::before, .splash-divider::after { content: ''; flex: 1; max-width: 70px; height: 1px; background: rgba(255,255,255,0.25); }
.splash-msg { font-size: clamp(0.95rem, 3vw, 1.15rem); color: rgba(255,255,255,0.88); line-height: 1.65; margin-bottom: 2rem; }
.btn-entrar {
  display: inline-block; background: #fff; color: #333;
  font-weight: 700; font-size: 1rem; letter-spacing: 0.03em;
  padding: 0.9rem 2.5rem; border-radius: 50px; border: none; cursor: pointer;
  box-shadow: 0 6px 28px rgba(0,0,0,0.2); transition: all 0.22s ease;
  text-decoration: none;
}
.btn-entrar:hover { transform: translateY(-3px); box-shadow: 0 12px 36px rgba(0,0,0,0.28); }
.splash-rodape { position: fixed; bottom: 1rem; font-size: 0.7rem; color: rgba(255,255,255,0.3); letter-spacing: 0.06em; }

/* Grid de fornecedores (quando há mais de um) */
.forn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; max-width: 680px; width: 100%; margin-top: 1.5rem; }
.forn-card {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(6px); border-radius: var(--radius);
  padding: 1.5rem 1rem; text-align: center; cursor: pointer;
  transition: var(--transicao); color: #fff;
}
.forn-card:hover { background: rgba(255,255,255,0.22); transform: translateY(-3px); }
.forn-card-logo { width: 64px; height: 64px; object-fit: contain; margin: 0 auto 0.75rem; border-radius: 10px; background: rgba(255,255,255,0.15); }
.forn-card-icone { font-size: 2.5rem; margin-bottom: 0.75rem; }
.forn-card-nome { font-size: 0.95rem; font-weight: 700; }

/* === CABEÇALHO CATÁLOGO === */
.catalogo-header {
  background: var(--primary); color: #fff;
  padding: 0.875rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.catalogo-header-esq { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.catalogo-header-logo { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,0.15); }
.catalogo-header-nome { font-size: 1rem; font-weight: 800; color: #fff; line-height: 1.2; }
.catalogo-header-forn { font-size: 0.72rem; color: rgba(255,255,255,0.75); }

/* === PILLS DE CATEGORIA === */
.cat-pills-wrap {
  background: #fff; border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 62px; z-index: 90;
}
.cat-pills { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; padding: 0.55rem 1rem; }
.cat-pills::-webkit-scrollbar { display: none; }
.cat-pill {
  background: transparent; border: 1.5px solid #e5e7eb;
  color: var(--cinza-escuro); border-radius: 20px;
  padding: 0.28rem 0.85rem; font-size: 0.8rem; font-weight: 500;
  white-space: nowrap; flex-shrink: 0; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.cat-pill.ativo, .cat-pill:hover { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }

/* Barra de busca */
.busca-wrap { background: #fff; padding: 0.6rem 1rem; border-bottom: 1px solid #f3f4f6; }
.busca-input {
  width: 100%; padding: 0.55rem 1rem;
  border: 1px solid #e5e7eb; border-radius: 20px;
  font-size: 0.9rem; outline: none; background: var(--bg-main);
  font-family: inherit; transition: border-color 0.15s;
}
.busca-input:focus { border-color: var(--primary); background: #fff; }

/* === GRID DE PRODUTOS === */
.produto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem; padding: 1rem; padding-bottom: 5rem;
}
.produto-card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--sombra-card); border: 1px solid #e5e7eb;
  overflow: hidden; cursor: pointer; transition: var(--transicao);
}
.produto-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
.produto-foto-wrapper { position: relative; padding-top: 72%; overflow: hidden; background: var(--cinza-claro); }
.produto-foto-wrapper img { position: absolute; top:0; left:0; width:100%; height:100%; object-fit: cover; }
.produto-foto-placeholder { position: absolute; top:50%; left:50%; transform: translate(-50%,-50%); font-size: 2.5rem; }
.produto-info { padding: 0.65rem 0.75rem; }
.produto-nome { font-size: 0.82rem; font-weight: 700; color: var(--texto); margin-bottom: 0.2rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.produto-cat { font-size: 0.7rem; color: var(--cinza-medio); margin-bottom: 0.4rem; }
.produto-preco { font-size: 0.95rem; font-weight: 800; color: var(--primary); margin-bottom: 0.5rem; }
.produto-add {
  width: 100%; background: var(--primary); color: #fff;
  border: none; padding: 0.45rem; border-radius: 6px;
  cursor: pointer; font-size: 0.8rem; font-weight: 600;
  font-family: inherit; transition: background 0.15s;
}
.produto-add:hover { background: var(--primary-hover); }
.produto-qty { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.qty-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--primary); background: transparent;
  color: var(--primary); font-size: 1rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; font-family: inherit;
}
.qty-btn:hover { background: var(--primary); color: #fff; }
.qty-val { font-weight: 700; font-size: 0.9rem; min-width: 1.5rem; text-align: center; }

/* FAB carrinho */
.carrinho-fab {
  position: fixed; bottom: 1.25rem; right: 1.25rem;
  background: var(--primary); color: #fff;
  border: none; border-radius: 50px;
  padding: 0.9rem 1.4rem; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  display: flex; align-items: center; gap: 0.5rem;
  transition: var(--transicao); z-index: 200; font-family: inherit;
}
.carrinho-fab:hover { background: var(--primary-hover); transform: scale(1.04); }
.carrinho-fab-badge {
  background: #ef4444; color: #fff; border-radius: 50%;
  width: 20px; height: 20px; font-size: 0.7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

/* === PAINEL DO CARRINHO === */
.carrinho-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 380; display: none; backdrop-filter: blur(2px);
}
.carrinho-overlay.visivel { display: block; }
.carrinho-painel {
  position: fixed; top:0; right:0; width: 400px; max-width: 100vw;
  height: 100dvh; background: #fff; z-index: 390;
  transform: translateX(105%); transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  box-shadow: -4px 0 30px rgba(0,0,0,0.15);
}
.carrinho-painel.aberto { transform: translateX(0); }
.carrinho-painel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; height: 60px; flex-shrink: 0;
  background: var(--primary); color: #fff;
}
.carrinho-painel-header h3 { font-size: 1rem; font-weight: 700; color: #fff; margin: 0; }
.btn-fechar-painel {
  background: rgba(255,255,255,0.18); border: none; color: #fff;
  font-size: 1.1rem; width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.18s; font-family: inherit;
}
.btn-fechar-painel:hover { background: rgba(255,255,255,0.32); }
.carrinho-itens { flex: 1; overflow-y: auto; padding: 0.5rem 0.75rem; }
.carrinho-vazio { text-align: center; padding: 3rem 1rem; color: var(--texto-leve); }
.carrinho-vazio .icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.carrinho-item { display: flex; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid #f3f4f6; align-items: flex-start; }
.carrinho-item-foto { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #f3f4f6; }
.carrinho-item-info { flex: 1; min-width: 0; }
.carrinho-item-nome { font-weight: 600; font-size: 0.85rem; color: var(--texto); margin-bottom: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carrinho-item-preco { font-size: 0.75rem; color: var(--texto-leve); margin-bottom: 0.3rem; }
.carrinho-item-ctrl { display: flex; align-items: center; gap: 0.4rem; }
.btn-remover { background: none; border: none; color: #d1d5db; cursor: pointer; font-size: 0.85rem; flex-shrink: 0; transition: color 0.15s; font-family: inherit; }
.btn-remover:hover { color: #ef4444; }
.carrinho-footer { padding: 0.75rem 1rem 1rem; border-top: 1px solid #e5e7eb; flex-shrink: 0; }
.carrinho-total { display: flex; justify-content: space-between; font-size: 1rem; font-weight: 800; color: var(--texto); margin-bottom: 0.75rem; padding-top: 0.5rem; border-top: 1px solid #e5e7eb; }
.cart-input {
  width: 100%; padding: 0.6rem 0.875rem;
  border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 0.9rem; font-family: inherit; outline: none;
  background: var(--bg-main); margin-bottom: 0.5rem; transition: border-color 0.15s;
}
.cart-input:focus { border-color: var(--primary); background: #fff; }
.btn-wapp {
  width: 100%; background: #25D366; color: #fff;
  border: none; padding: 0.875rem; border-radius: 10px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  transition: background 0.2s; font-family: inherit; margin-top: 0.5rem;
}
.btn-wapp:hover { background: #20bd5a; }

/* === SPINNER === */
.spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 3px solid var(--primary-light); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; flex-direction: column; gap: 1rem; color: var(--texto-leve); }

/* === TOAST === */
#toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; max-width: 340px; }
.toast {
  background: #1f2937; color: #fff; padding: 0.8rem 1rem;
  border-radius: 8px; font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex; align-items: center; gap: 0.5rem;
  animation: slideIn 0.25s ease; border-left: 4px solid var(--primary);
}
.toast.ok    { border-left-color: var(--verde-ok); }
.toast.erro  { border-left-color: var(--vermelho); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === RODAPÉ === */
.promo-290 { background: #1e293b; color: rgba(255,255,255,0.5); text-align: center; padding: 1.25rem; margin-top: 2rem; font-size: 0.78rem; }
.promo-290 a { color: #818cf8; font-weight: 600; }

/* === RESPONSIVO === */
@media (max-width: 480px) {
  .produto-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; padding: 0.75rem; }
  .carrinho-painel { width: 100vw; }
}
