/* vitrine.css — Layout "Vitrine" da página inicial (assets/js/vitrine.js).
   Tudo aqui vale só com body.layout-vitrine, exceto o bloco "Antes do layout",
   que evita o hero clássico piscar antes de o app.js saber qual layout usar.
   As cores vêm das variáveis do tema (--accent-color etc.), então o Vitrine
   segue o tema escolhido e as cores do lojista. */

/* ---------- Antes do layout ---------- */
body:not(.layout-ready) .hero,
body:not(.layout-ready) #collections {
  visibility: hidden;
}

#vt-root[hidden],
#vt-root [hidden],
.vt-bottom-nav[hidden],
.vt-bottom-nav [hidden] {
  display: none !important;
}

/* ---------- O que o Vitrine substitui ---------- */
body.layout-vitrine .hero,
body.layout-vitrine #collections {
  display: none !important;
}

body.layout-vitrine #vt-root {
  padding-top: calc(var(--header-height) + 1.25rem);
}

/* ---------- Seções ---------- */
.vt-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 0;
}

.vt-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.vt-head h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  position: relative;
  padding-bottom: 0.45rem;
}

.vt-head h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 36px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent-color);
}

.vt-head a,
.vt-head span {
  font-size: 0.88rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.vt-head a:hover {
  color: var(--accent-color);
}

/* ---------- Carrossel ---------- */
.vt-hero {
  position: relative;
  max-width: calc(var(--max-width) - 3rem);
  margin: 0 auto;
  height: clamp(340px, 40vw, 460px);
  border-radius: 22px;
  overflow: hidden;
  background: #f4f4f5;
}

.vt-slides {
  display: flex;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.vt-slide {
  flex: 0 0 100%;
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.vt-slide-text {
  position: relative;
  z-index: 2;
  max-width: 560px;
  padding: 0 clamp(1.5rem, 6vw, 4.5rem);
}

.vt-slide-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
}

.vt-slide h1,
.vt-slide h2 {
  font-size: clamp(1.9rem, 4.2vw, 3.2rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0.8rem 0 0.6rem;
}

.vt-slide p {
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  opacity: 0.92;
  margin-bottom: 0.4rem;
}

.vt-slide-price strong {
  font-size: 1.25em;
}

.vt-btn {
  display: inline-flex;
  align-items: center;
  margin-top: 1.1rem;
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.vt-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Slide 1: capa da loja com texto por cima */
.vt-slide-cover {
  background-color: var(--accent-color);
  background-size: cover;
  background-position: center;
  color: #fff;
}

.vt-slide-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.25) 60%, rgba(0, 0, 0, 0.05) 100%);
}

.vt-slide-cover .vt-slide-tag {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  backdrop-filter: blur(6px);
}

.vt-slide-cover .vt-btn {
  background: #fff;
  color: #111;
}

/* Slides 2 e 3: categoria, com a foto do produto à direita sobre um tom da cor do tema */
.vt-slide-cat {
  background: #f4f4f5;
  background: linear-gradient(120deg,
      color-mix(in srgb, var(--accent-color) 7%, #fff) 0%,
      color-mix(in srgb, var(--accent-color) 20%, #fff) 100%);
  color: var(--text-primary);
}

.vt-slide-cat .vt-slide-text {
  max-width: 54%;
}

.vt-slide-cat .vt-slide-tag {
  background: var(--accent-color);
  color: #fff;
}

.vt-slide-cat .vt-btn {
  background: var(--accent-color);
  color: #fff;
}

.vt-slide-media {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 46%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.vt-slide-media .vt-slide-img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 18px;
  /* Foto de produto com fundo branco "some" no tom do slide */
  mix-blend-mode: multiply;
}

.vt-slide-media .img-placeholder {
  border-radius: 18px;
}

.vt-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: #111;
  font-size: 1.6rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.25s;
}

.vt-prev { left: 14px; }
.vt-next { right: 14px; }

.vt-hero:hover .vt-arrow {
  opacity: 1;
}

/* Pílula escura atrás dos pontos: aparecem tanto na capa escura quanto nos slides claros */
.vt-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(4px);
}

.vt-dots:empty,
.vt-dots:empty ~ .vt-arrow {
  display: none;
}

.vt-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  transition: width 0.3s, background 0.3s;
}

.vt-dots button.active {
  width: 24px;
  background: #fff;
}

/* ---------- Categorias ---------- */
.vt-cats-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(210px, 1fr);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.vt-cat {
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  transition: border-color 0.2s, transform 0.2s;
}

.vt-cat:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.vt-cat-thumb {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: #f4f4f5;
}

.vt-cat-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vt-cat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vt-cat-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vt-cat-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ---------- Grade de cards ---------- */
.vt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.vt-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
}

.vt-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.08);
}

.vt-card-media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  background: #f6f6f7;
  overflow: hidden;
}

body.theme-fashion .vt-card-media {
  aspect-ratio: 3 / 4;
}

.vt-card-media > img,
.vt-card-media > .img-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.35s, transform 0.5s;
}

body.theme-grocery .vt-card-media {
  background: #fff;
}

body.theme-grocery .vt-card-media > img {
  object-fit: contain;
  padding: 10px;
}

.vt-card-img-alt {
  opacity: 0;
}

.vt-card:hover .vt-card-img-alt {
  opacity: 1;
}

.vt-card:hover .vt-card-img:only-of-type {
  transform: scale(1.05);
}

.vt-card.is-out .vt-card-media > img {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.vt-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.vt-badge {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent-color);
}

.vt-badge-sale { background: #e11d48; }
.vt-badge-low  { background: #d97706; }

/* Selo de desconto nos cards do catálogo (createProductCard) */
.product-image > .vt-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.vt-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px 14px;
}

.vt-card-cat {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.vt-card-name {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.3;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vt-card-name:hover {
  color: var(--accent-color);
}

.vt-card-unit {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.vt-card-price {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}

.vt-card-price del,
.vt-mini-price del,
.price-old {
  font-size: 0.82em;
  font-weight: 500;
  color: #9ca3af;
}

.vt-card-price strong {
  font-size: 1.12rem;
  font-weight: 700;
}

.vt-add {
  display: block;
  margin-top: 10px;
  width: 100%;
  padding: 0.62rem;
  border-radius: 10px;
  border: 1.5px solid var(--accent-color);
  background: transparent;
  color: var(--accent-color);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.2s, color 0.2s;
}

.vt-add:hover {
  background: var(--accent-color);
  color: #fff;
}

.vt-add.vt-add-off,
.vt-add.vt-add-off:hover {
  border-color: var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: default;
}

/* ---------- Listas rápidas ---------- */
.vt-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.vt-list h3 {
  font-size: 1.05rem;
  font-weight: 700;
  padding-bottom: 0.6rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.vt-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 12px;
  transition: background 0.2s;
}

.vt-mini:hover {
  background: #f6f6f7;
}

.vt-mini-img {
  flex-shrink: 0;
  width: 64px !important;
  height: 64px !important;
  border-radius: 10px;
  object-fit: cover;
  background: #f4f4f5;
}

.vt-mini-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vt-mini-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vt-mini-cat {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.vt-mini-price {
  font-size: 0.9rem;
  font-weight: 700;
}

.vt-mini-price del {
  margin-right: 6px;
}

/* ---------- Catálogo e faixa de benefícios no Vitrine ---------- */
body.layout-vitrine .benefits-bar {
  margin-top: 2.5rem;
}

body.layout-vitrine .product-card {
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

body.layout-vitrine .product-image {
  overflow: hidden;
}

body.layout-vitrine .product-image img {
  transition: transform 0.5s;
}

body.layout-vitrine .product-card:hover .product-image img {
  transform: scale(1.04);
}

/* ---------- Barra inferior (celular) ---------- */
.vt-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .vt-section {
    padding: 2rem 1rem 0;
  }

  .vt-hero {
    max-width: none;
    margin: 0 1rem;
    height: 360px;
    border-radius: 18px;
  }

  .vt-arrow {
    display: none;
  }

  .vt-slide-text {
    padding: 0 1.4rem;
  }

  .vt-slide-cat .vt-slide-text {
    max-width: 62%;
    padding-right: 0;
  }

  .vt-slide-cat p:not(.vt-slide-price) {
    display: none;
  }

  .vt-slide-media {
    width: 44%;
    padding: 1rem 0.75rem 2.5rem 0;
  }

  .vt-cats-track {
    grid-auto-columns: 64%;
  }

  .vt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .vt-card-body {
    padding: 10px 10px 12px;
  }

  .vt-card-name {
    font-size: 0.88rem;
  }

  .vt-card-price strong {
    font-size: 1rem;
  }

  body.layout-vitrine .vt-bottom-nav:not([hidden]) {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1500;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
  }

  .vt-bottom-nav a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-secondary);
  }

  .vt-bottom-nav a:active {
    color: var(--accent-color);
  }

  .vt-bottom-nav svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  #vt-nav-wa {
    color: #1da851;
  }

  .vt-bottom-nav b {
    position: absolute;
    top: 0;
    left: calc(50% + 4px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent-color);
    color: #fff;
    font-size: 0.62rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vt-slides,
  .vt-card,
  .vt-card-media > img {
    transition: none;
  }
}
