/* style.css — Vidriera. Estética sobria y atractiva, mobile-first.
   Los colores vienen de las variables que inyecta index.php desde config.php. */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Fondo del cuerpo (capa fija, slideshow) ---------- */
.page-bg { position: fixed; inset: 0; z-index: 0; }
.page-bg .slide {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.4s ease-in-out;
}
.page-bg .slide.is-active { opacity: 1; }
.page-bg::after { /* oscurecido para que los productos se lean (opacidad la setea el JS) */
  content: ""; position: absolute; inset: 0;
  background: var(--bg); opacity: var(--page-overlay, .75);
}

/* ---------- Encabezado ---------- */
.header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  overflow: hidden; /* recorta el slideshow del fondo */
}

/* Slideshow del encabezado: capas que hacen crossfade. */
.header__bg { position: absolute; inset: 0; z-index: 0; }
.header__bg .slide {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.2s ease-in-out;
}
.header__bg .slide.is-active { opacity: 1; }
.header__bg::after { /* oscurecido para que el texto se lea (la opacidad la setea el JS) */
  content: ""; position: absolute; inset: 0;
  background: #000; opacity: var(--hero-overlay, .6);
}
/* el contenido del encabezado queda por encima del fondo */
.header__inner, .cats { position: relative; z-index: 1; }
.header__inner {
  max-width: 1100px; margin: 0 auto;
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__logo { height: 46px; width: auto; border-radius: 8px; }
.brand__name {
  font-size: 1.35rem; font-weight: 700;
  color: var(--primary); letter-spacing: .3px;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.brand__tagline { font-size: .82rem; color: var(--text); text-shadow: 0 1px 6px rgba(0,0,0,.7); }

.cart-btn {
  position: relative;
  background: var(--primary); color: #1a1424;
  border: 0; border-radius: 10px;
  font-size: 1rem; font-weight: 700;
  padding: 9px 14px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.cart-btn__count {
  background: #1a1424; color: var(--primary);
  border-radius: 999px; font-size: .75rem;
  min-width: 20px; padding: 1px 6px; text-align: center;
}

/* ---------- Categorías ---------- */
.cats {
  max-width: 1100px; margin: 0 auto;
  padding: 0 12px 12px;
  display: flex; gap: 8px; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.cats__item {
  flex: 0 0 auto;
  background: rgba(15, 10, 22, .9); color: var(--text);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  padding: 8px 17px; font-size: .9rem; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: .15s;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  box-shadow: 0 3px 10px rgba(0,0,0,.6);
}
.cats__item:hover { border-color: var(--primary); background: rgba(15, 10, 22, .98); }
.cats__item.is-active {
  background: var(--primary); color: #1a1424; border-color: var(--primary); font-weight: 700;
  box-shadow: 0 3px 12px rgba(0,0,0,.6);
}

/* ---------- Contenido ---------- */
.content {
  flex: 1;
  max-width: 1100px; width: 100%; margin: 0 auto;
  padding: 22px 18px 40px;
  position: relative; z-index: 1; /* por encima del fondo fijo */
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.card__media {
  position: relative; aspect-ratio: 1/1; background: rgba(0,0,0,.2);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: var(--accent); opacity: .5;
}
.card__badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,.7); color: #fff;
  font-size: .72rem; padding: 3px 9px; border-radius: 999px;
}
.card__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card__cat { font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); }
.card__name { font-size: 1.02rem; font-weight: 600; }
.card__desc { font-size: .85rem; color: var(--muted); }
.card__foot {
  margin-top: auto; padding-top: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card__price { font-weight: 700; color: var(--primary); }

.add-btn {
  background: var(--accent); color: #fff;
  border: 0; border-radius: 8px;
  padding: 7px 14px; font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: .15s;
}
.add-btn:hover { filter: brightness(1.1); }
.add-btn.is-disabled { background: rgba(255,255,255,.1); color: var(--muted); cursor: not-allowed; }

/* ---------- Avisos ---------- */
.notice {
  background: var(--surface); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; padding: 20px; color: var(--muted);
}
.notice strong { color: var(--text); }
.notice code { background: rgba(0,0,0,.3); padding: 1px 6px; border-radius: 4px; color: var(--primary); }

/* ---------- Pie ---------- */
.footer {
  background: var(--surface);
  border-top: 1px solid rgba(255,255,255,.07);
  text-align: center; padding: 10px; font-size: .82rem; color: var(--muted);
  position: relative; z-index: 1; /* por encima del fondo fijo */
}

/* ---------- Carrito ---------- */
.cart { position: fixed; inset: 0; z-index: 50; }
.cart[hidden] { display: none; }
.cart__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.cart__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: var(--bg); border-left: 1px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column;
  animation: slidein .2s ease;
}
@keyframes slidein { from { transform: translateX(100%); } to { transform: translateX(0); } }
.cart__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.cart__x { background: none; border: 0; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.cart__items { flex: 1; overflow-y: auto; padding: 12px 18px; }
.cart__empty { color: var(--muted); text-align: center; padding: 30px 0; }

.ci { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.ci__name { flex: 1; font-size: .92rem; }
.ci__qty { display: flex; align-items: center; gap: 8px; }
.ci__qty button {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--surface); color: var(--text); border: 1px solid rgba(255,255,255,.15);
  cursor: pointer; font-size: 1rem; line-height: 1;
}
.ci__qty span { min-width: 18px; text-align: center; }

.cart__foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 8px; }
.cart__send {
  background: #25D366; color: #06371b;
  border: 0; border-radius: 10px; padding: 13px; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.cart__send:disabled { opacity: .5; cursor: not-allowed; }
.cart__clear { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .85rem; }

/* ---------- Popup de promoción ---------- */
.promo { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 18px; }
.promo__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(2px); }
.promo__box {
  position: relative; z-index: 1;
  background: var(--surface); border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; overflow: hidden;
  width: min(420px, 100%); max-height: 90vh;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
  animation: promoin .25s ease;
  display: flex; flex-direction: column;
}
@keyframes promoin { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.promo__close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 34px; height: 34px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; border: 0; cursor: pointer;
  font-size: 1.1rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.promo__close:hover { background: rgba(0,0,0,.8); }
.promo__img { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: cover; }
.promo__body { padding: 18px 20px 20px; text-align: center; }
.promo__title { font-size: 1.25rem; color: var(--primary); margin-bottom: 6px; }
.promo__text { font-size: .92rem; color: var(--muted); }
.promo__cta {
  display: inline-block; margin-top: 14px;
  background: var(--primary); color: #1a1424; font-weight: 700;
  border: 0; border-radius: 10px; padding: 11px 22px; cursor: pointer; font-size: .95rem;
}
.promo__cta:hover { filter: brightness(1.08); text-decoration: none; }

/* ============ Vidriera V2: info dentro de la imagen + lightbox ============ */
.v2grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.v2card { border-radius: 16px; overflow: hidden; }
.v2card__img {
  position: relative;
  aspect-ratio: 3/4;
  background-size: cover; background-position: center;
  background-color: var(--surface);
  cursor: pointer;
  display: flex; align-items: flex-end;
  transition: transform .18s, box-shadow .18s;
}
.v2card__img:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,.45); }
.v2card__ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--accent); opacity: .5;
}
.v2card__badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: rgba(0,0,0,.75); color: #fff; font-size: .72rem; padding: 4px 10px; border-radius: 999px;
}
.v2card__overlay {
  position: relative; z-index: 1; width: 100%;
  padding: 38px 14px 14px;
  background: linear-gradient(to top, rgba(0,0,0,.92) 0%, rgba(0,0,0,.7) 45%, rgba(0,0,0,0) 100%);
  color: #fff;
  display: flex; flex-direction: column; gap: 5px;
}
.v2card__cat { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; color: var(--primary); }
.v2card__name { font-size: 1.05rem; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.v2card__desc {
  font-size: .82rem; color: #e7e1ea;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.v2card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.v2card__price { font-weight: 700; color: var(--primary); text-shadow: 0 1px 4px rgba(0,0,0,.7); }

/* Lightbox */
.lb { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 18px; }
.lb[hidden] { display: none; }
.lb__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.85); backdrop-filter: blur(3px); }
.lb__box {
  position: relative; z-index: 1; margin: 0;
  background: var(--surface); border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; overflow: hidden;
  width: min(560px, 100%); max-height: 92vh; display: flex; flex-direction: column;
  animation: promoin .25s ease;
}
.lb__x {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border-radius: 999px;
  background: rgba(0,0,0,.6); color: #fff; border: 0; cursor: pointer; font-size: 1.15rem;
}
.lb__x:hover { background: rgba(0,0,0,.85); }
.lb__img { width: 100%; max-height: 62vh; object-fit: contain; background: #000; cursor: zoom-out; display: block; }
.lb__info { padding: 16px 20px 20px; text-align: left; }
.lb__name { font-size: 1.35rem; margin: 4px 0 8px; }
.lb__desc { color: var(--muted); font-size: .95rem; }
.lb__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.lb__price { font-size: 1.2rem; font-weight: 700; color: var(--primary); }

@media (max-width: 480px) {
  .brand__tagline { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .v2grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .v2card__name { font-size: .92rem; }
}
