:root {
  --brand-blue: #2F699F;
  --brand-blue-light: #5B9BD9;
  --bg: #0B0D10;
  --bg-elevated: #15181C;
  --bg-card: #1B1F24;
  --border: #2A2F36;
  --text: #F2F4F6;
  --text-muted: #9AA3AD;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

img { max-width: 100%; display: block; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11,13,16,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.topbar__logo {
  height: 48px;
  width: auto;
  flex-shrink: 0;
}
.topbar__search {
  flex: 1;
}
#searchInput {
  width: 100%;
  max-width: 480px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
#searchInput:focus { border-color: var(--brand-blue-light); }

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  border: none;
}
.btn--primary {
  background: linear-gradient(135deg, var(--brand-blue-light), var(--brand-blue));
  color: #fff;
}
.btn--primary:hover { filter: brightness(1.1); }
.btn--ghost {
  background: transparent;
  border: 1px solid var(--brand-blue-light);
  color: var(--brand-blue-light);
}
.btn--ghost:hover { background: rgba(91,155,217,0.12); }
.btn--full { width: 100%; text-align: center; }
.btn--secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn--secondary:hover { border-color: var(--brand-blue-light); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

.bag-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}
.bag-btn:hover { border-color: var(--brand-blue-light); }
.bag-btn__count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--brand-blue-light);
  color: #06131f;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Category strip */
.category-strip {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 20px 4px;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.category-tile {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  width: 84px;
  text-align: center;
}
.category-tile__img-wrap {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, transform 0.15s;
}
.category-tile__img-wrap img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.category-tile__img-wrap.category-tile__img-wrap--all {
  background: var(--bg-elevated);
  color: var(--brand-blue-light);
  font-size: 22px;
}
.category-tile:hover .category-tile__img-wrap { transform: translateY(-2px); }
.category-tile.is-active .category-tile__img-wrap { border-color: var(--brand-blue-light); }
.category-tile__label {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.25;
}
.category-tile.is-active .category-tile__label { color: var(--text); font-weight: 600; }

/* Filters */
.filters {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.filters__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.filters select {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
}
.filters__count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 13px;
}

.view-toggle {
  display: flex;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.view-toggle__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.view-toggle__btn.is-active {
  background: var(--brand-blue);
  color: #fff;
}

/* Grid */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  min-height: 50vh;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid--cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid--cols-2 .card__name { font-size: 17px; }
.grid--cols-2 .card__price { font-size: 22px; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 36px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.page-btn:hover:not(:disabled) { border-color: var(--brand-blue-light); }
.page-btn.is-active {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #fff;
  font-weight: 600;
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.page-ellipsis {
  color: var(--text-muted);
  padding: 0 4px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand-blue);
}
.card__img-wrap {
  aspect-ratio: 1 / 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
}
.card__img-wrap.no-img {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 13px;
}
.card__body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.card__category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-blue-light);
  font-weight: 600;
}
.card__name {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  flex: 1;
}
.card__price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}
.card__price {
  font-size: 18px;
  font-weight: 700;
}
.card__price--old {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Loading / empty */
.loading-state, .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] {
  display: none;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}
.modal__content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 780px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
}
.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.modal__img-wrap {
  background: #fff;
  border-radius: 10px;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.modal__img-wrap img { width: 100%; height: 100%; object-fit: contain; padding: 16px; }
.modal__category {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-blue-light);
  font-weight: 600;
  margin-bottom: 6px;
}
.modal__title { font-size: 22px; font-weight: 700; margin: 0 0 10px; }
.modal__price-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.modal__price { font-size: 26px; font-weight: 800; color: var(--brand-blue-light); }
.modal__price--old { font-size: 15px; color: var(--text-muted); text-decoration: line-through; }
.modal__desc { color: var(--text-muted); font-size: 14.5px; line-height: 1.6; margin-bottom: 20px; }
.modal__desc p { margin: 0 0 10px; }
.modal__meta { font-size: 12.5px; color: var(--text-muted); margin-top: 14px; }

/* Adicionar à sacola (dentro do modal de produto) */
.modal__qty-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.qty-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.qty-stepper button {
  width: 34px;
  height: 34px;
  border: none;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
}
.qty-stepper button:hover { background: var(--brand-blue); color: #fff; }
.qty-stepper span {
  min-width: 34px;
  text-align: center;
  font-weight: 600;
  font-size: 14.5px;
}
.modal__actions { display: flex; flex-direction: column; gap: 10px; }
.added-msg {
  font-size: 13px;
  color: var(--brand-blue-light);
  font-weight: 600;
  margin-top: 8px;
  display: none;
}
.added-msg.is-visible { display: block; }

/* Sacola (drawer) */
.modal__content--bag,
.modal__content--store {
  max-width: 560px;
}
.bag__title { font-size: 20px; margin: 0 0 18px; padding-right: 30px; }
.bag-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.bag-item__img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.bag-item__img img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.bag-item__info { flex: 1; min-width: 0; }
.bag-item__name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.bag-item__price { font-size: 13px; color: var(--text-muted); }
.bag-item__right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bag-item__remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
}
.bag-item__remove:hover { color: #e26a6a; }
.bag-empty { text-align: center; padding: 30px 0; color: var(--text-muted); }
.bag-summary {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.bag-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Seletor de loja */
.store-picker__hint { color: var(--text-muted); font-size: 13.5px; margin: 0 0 18px; }
.store-picker__list { display: flex; flex-direction: column; gap: 10px; }
.store-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
}
.store-option:hover { border-color: var(--brand-blue-light); }
.store-option span.store-option__sub {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12.5px;
  margin-top: 2px;
}

/* Rodapé - redes sociais */
.footer__social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-top: 22px;
}
.footer__social .footer__instagram { margin-top: 0; }

@media (max-width: 640px) {
  .modal__grid { grid-template-columns: 1fr; }
  .topbar__inner { flex-wrap: wrap; }
  .topbar__search { order: 3; width: 100%; }
  #whatsappHeaderBtn { display: none; }
}
/* Abaixo de 768px, 4 colunas reais não cabem: cada modo de visualização
   cai um degrau (2->1, 4->2) para o alternador continuar tendo efeito visível. */
@media (max-width: 768px) {
  .grid--cols-2 { grid-template-columns: 1fr; }
  .grid--cols-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 20px 60px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}
.footer__logo { height: 36px; margin: 0 auto 12px; opacity: 0.85; }

.footer__payments {
  margin-top: 26px;
}
.footer__label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.footer__payment-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.payment-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12.5px;
}

.footer__instagram {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 22px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: color 0.15s;
}
.footer__instagram:hover {
  color: var(--brand-blue-light);
}
