:root {
  --verde: #2e7d32;
  --verde-osc: #1b5e20;
  --verde-claro: #e8f5e9;
  --naranja: #ef6c00;
  --rojo: #c62828;
  --amarillo: #f9a825;
  --texto: #1f2a1f;
  --gris: #6b7280;
  --borde: #e5e7eb;
  --fondo: #f7f8f4;
  --blanco: #fff;
  --radio: 14px;
  --sombra: 0 2px 10px rgba(0, 0, 0, .06);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texto);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.oculto { display: none !important; }
.contenedor { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- Barra superior ---------- */
.barra-sup { background: var(--verde-osc); color: #fff; font-size: .9rem; }
.barra-sup .contenedor { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; padding-top: 6px; padding-bottom: 6px; }
.barra-sup a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; opacity: .95; }
.barra-sup a:hover { opacity: 1; text-decoration: underline; }
.redes, .contacto { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.redes svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Encabezado ---------- */
.encabezado { background: var(--blanco); box-shadow: var(--sombra); position: sticky; top: 0; z-index: 20; }
.encabezado .contenedor { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
/* Encabezado de la tienda con la foto de la mesa de verduras de fondo.
   Un degradé oscuro detrás del nombre asegura que se lea; el contenido queda al frente, en el mismo lugar. */
.encabezado.con-fondo {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .38) 45%, rgba(0, 0, 0, .15) 100%),
    url("../img/fondo-encabezado.png") center / cover no-repeat,
    #2b2118;
}
.encabezado.con-fondo .contenedor { position: relative; z-index: 1; padding-top: 16px; padding-bottom: 16px; }
.encabezado.con-fondo .marca h1 { color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .55); }
.encabezado.con-fondo .marca small { color: #e8f5e9; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.encabezado.con-fondo .logo { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.encabezado.con-fondo .btn { box-shadow: 0 3px 10px rgba(0, 0, 0, .35); }

.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.marca .logo { font-size: 2rem; line-height: 1; }
.marca h1 { font-size: 1.25rem; margin: 0; color: var(--verde-osc); line-height: 1.1; }
.marca small { color: var(--gris); font-size: .8rem; }
.acciones-enc { display: flex; gap: 8px; }
.btn { border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 700; background: var(--verde); color: #fff; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { background: var(--verde-osc); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sec { background: var(--verde-claro); color: var(--verde-osc); }
.btn-sec:hover { background: #d7ecd8; }
.btn-peligro { background: #fdecea; color: var(--rojo); }
.btn-peligro:hover { background: #f9d6d2; }
.btn-chico { padding: 6px 12px; font-size: .88rem; }
.btn-mp { background: #009ee3; width: 100%; justify-content: center; padding: 13px; font-size: 1.05rem; }
.btn-mp:hover { background: #0086c3; }
.contador { background: var(--naranja); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .8rem; min-width: 20px; text-align: center; }

/* ---------- Video de fondo ---------- */
/* Fijo detrás de todo: oscurecido y apenas desenfocado para que resalten las tarjetas blancas. */
.fondo-video { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #1b2a1b; }
.fondo-video video {
  width: 100%; height: 100%; object-fit: cover;
  filter: blur(3px) brightness(.55) saturate(1.15);
  transform: scale(1.06);                 /* evita bordes claros por el desenfoque */
}
.fondo-video::after {                     /* velo verde oscuro para unificar con la marca */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(27, 94, 32, .25), rgba(0, 0, 0, .35));
}
body:has(.fondo-video) { background: transparent; }
body:has(.fondo-video) .tarjeta { box-shadow: 0 10px 28px rgba(0, 0, 0, .35); }
body:has(.fondo-video) .vacio { color: #fff; }
@media (prefers-reduced-motion: reduce) { .fondo-video video { display: none; } }

/* ---------- Solapas y filtros ---------- */
.solapas { display: flex; gap: 8px; margin: 18px 0 12px; overflow-x: auto; }
.solapa { border: 2px solid var(--borde); background: var(--blanco); border-radius: 999px; padding: 8px 16px; font-weight: 700; white-space: nowrap; color: var(--texto); }
.solapa.activa { border-color: var(--verde); background: var(--verde); color: #fff; }
.filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.buscador { flex: 1 1 220px; border: 1px solid var(--borde); border-radius: 999px; padding: 9px 16px; background: var(--blanco); }
.chip { border: 1px solid var(--borde); background: var(--blanco); border-radius: 999px; padding: 6px 12px; font-size: .9rem; color: var(--texto); }
.chip.activa { background: var(--verde-claro); border-color: var(--verde); color: var(--verde-osc); font-weight: 700; }

/* ---------- Tarjetas ---------- */
.grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; margin-bottom: 30px; }
.tarjeta { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.tarjeta.sin-stock { opacity: .6; }
.foto { aspect-ratio: 4 / 3; background: linear-gradient(135deg, #f1f8e9, #fffde7); display: grid; place-items: center; font-size: 3.6rem; overflow: hidden; }
.foto img { width: 100%; height: 100%; object-fit: cover; }

/* Emoji sobre un "plato" con fondo según la categoría */
.foto { position: relative; }
.foto-fruta   { background: radial-gradient(circle at 30% 20%, #fff3e0, #ffe0b2 70%); }
.foto-verdura { background: radial-gradient(circle at 30% 20%, #f1f8e9, #c5e1a5 70%); }
.foto-hierba  { background: radial-gradient(circle at 30% 20%, #e0f2f1, #a5d6a7 70%); }
.foto-otros   { background: radial-gradient(circle at 30% 20%, #fffde7, #ffe082 70%); }
/* Escena 3D: el producto "flota" sobre una mesada con luz de arriba y sombra en el piso */
.grilla { perspective: 900px; }
.foto:not(.con-foto)::after {           /* línea de la mesada */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 28%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, .35), rgba(0, 0, 0, .06));
  border-top: 1px solid rgba(255, 255, 255, .6);
}
.escena {
  position: relative; z-index: 1; width: 100%; height: 100%;
  display: grid; place-items: center;
  transform-style: preserve-3d;
}
.foto .objeto3d {
  width: 64%; height: 64%; object-fit: contain;
  transform: translateZ(40px) translateY(-6%);
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .22)) drop-shadow(0 2px 2px rgba(0, 0, 0, .12));
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
  animation: flotar 4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -0.7s);
}
.foto .objeto3d.emoji { width: auto; height: auto; font-size: 1.6em; line-height: 1; display: block; }
.sombra-piso {
  position: absolute; bottom: 14%; left: 50%; width: 46%; height: 9%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .28), transparent 70%);
  animation: sombra 4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -0.7s);
}
@keyframes flotar { 50% { translate: 0 -5px; } }
@keyframes sombra { 50% { scale: .85; opacity: .7; } }

/* La tarjeta se inclina hacia el mouse (las variables --rx/--ry las pone tienda.js) */
.tarjeta {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform .25s ease, box-shadow .25s ease;
}
@media (hover: hover) {
  .tarjeta:hover { box-shadow: 0 16px 30px rgba(0, 0, 0, .14); }
  .tarjeta:hover .foto .objeto3d { transform: translateZ(70px) translateY(-10%) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .objeto3d, .sombra-piso { animation: none; }
  .tarjeta { transform: none !important; }
}
/* Foto real "de estudio": fondo gris cálido, luz suave de arriba y sombra natural en el piso */
.foto.foto-estudio::after { display: none; }
/* El fondo va en la misma capa que la foto para que el "multiply" tenga contra qué fundirse */
.escena.estudio {
  transform-style: flat;
  background:
    linear-gradient(to bottom, transparent 55%, rgba(0, 0, 0, .06) 100%),
    radial-gradient(ellipse 90% 70% at 50% 35%, #fbfaf7 0%, #ecebe6 55%, #dcdad3 100%);
}
.foto .producto-real {
  width: 84%; height: 80%; object-fit: contain;
  mix-blend-mode: multiply;               /* el fondo blanco de la foto se funde con el gris */
  filter: contrast(1.04) saturate(1.06);
  transform: translateY(-4%);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}
/* Fotos con fondo gris (no blanco): se esfuman los bordes para que no se vea el recuadro */
.foto .producto-real.difuminar {
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at center, #000 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at center, #000 55%, transparent 100%);
}
.foto-estudio .sombra-piso {
  bottom: 12%; width: 62%; height: 10%;
  background: radial-gradient(ellipse at center, rgba(40, 30, 20, .22), transparent 70%);
  animation: none;
}
@media (hover: hover) {
  .tarjeta:hover .foto .producto-real { transform: translateY(-7%) scale(1.05); }
}
.foto.con-foto img { transition: transform .5s ease; }
@media (hover: hover) { .tarjeta:hover .foto.con-foto img { transform: scale(1.06); } }
.creditos { margin-top: 18px; font-size: .75rem; opacity: .8; }
.creditos summary { cursor: pointer; }
.creditos a { color: inherit; }

.tarjeta.sin-stock .escena { filter: grayscale(1); opacity: .8; }
.etiquetas { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.etq { font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 6px; color: #fff; letter-spacing: .3px; }
.etq-nuevo { background: var(--amarillo); color: #3e2700; }
.etq-oferta { background: var(--rojo); }
.etq-stock { background: #555; }
.etq-dest { background: var(--verde); }
.cuerpo { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.cuerpo h3 { margin: 0; font-size: 1rem; }
.cat { color: var(--gris); font-size: .8rem; }
.precio { font-size: 1.15rem; font-weight: 800; color: var(--verde-osc); margin-top: auto; }
.precio small { font-size: .78rem; color: var(--gris); font-weight: 600; }
.precio s { color: var(--gris); font-size: .85rem; font-weight: 600; margin-right: 4px; }
.cantidad { display: flex; align-items: center; justify-content: space-between; background: var(--verde-claro); border-radius: 999px; padding: 3px; }
.cantidad button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--verde); color: #fff; font-size: 1.2rem; font-weight: 800; }
.cantidad span { font-weight: 800; color: var(--verde-osc); font-size: .92rem; }
.vacio { text-align: center; color: var(--gris); padding: 40px 0; grid-column: 1 / -1; }

/* ---------- Carrito ---------- */
.velo { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 40; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--blanco); z-index: 50; display: flex; flex-direction: column; box-shadow: -4px 0 20px rgba(0, 0, 0, .15); }
.panel header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--borde); }
.panel header h2 { margin: 0; font-size: 1.2rem; }
.cerrar { border: 0; background: transparent; font-size: 1.6rem; line-height: 1; }
.panel .contenido { overflow-y: auto; padding: 12px 16px; flex: 1; }
.linea { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px dashed var(--borde); }
.linea .nom { font-weight: 700; }
.linea .imp { font-weight: 800; text-align: right; }
.linea .cantidad { grid-column: 1 / 2; max-width: 170px; }
.linea .quitar { border: 0; background: transparent; color: var(--rojo); font-size: .85rem; }
.totales { margin: 14px 0; }
.totales div { display: flex; justify-content: space-between; padding: 3px 0; }
.totales .total { font-size: 1.2rem; font-weight: 800; border-top: 2px solid var(--texto); margin-top: 6px; padding-top: 8px; }
.form label { display: block; font-weight: 700; font-size: .88rem; margin: 10px 0 4px; }
.form input, .form select, .form textarea { width: 100%; border: 1px solid var(--borde); border-radius: 10px; padding: 9px 11px; background: #fff; }
.opciones { display: flex; gap: 8px; }
.opciones label { flex: 1; margin: 0; border: 2px solid var(--borde); border-radius: 10px; padding: 9px; text-align: center; cursor: pointer; font-weight: 700; }
.opciones input { display: none; }
.opciones label:has(input:checked) { border-color: var(--verde); background: var(--verde-claro); color: var(--verde-osc); }
.nota { font-size: .8rem; color: var(--gris); text-align: center; margin-top: 8px; }
.error { color: var(--rojo); font-weight: 700; font-size: .9rem; margin-top: 8px; }

/* ---------- Pie ---------- */
.pie { background: var(--verde-osc); color: #e8f5e9; padding: 28px 0; margin-top: 20px; }
.pie .contenedor { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; align-items: start; }
.pie h4 { margin: 0 0 8px; color: #fff; }
.pie p { margin: 4px 0; }
.pie .credito { margin-top: 14px; font-size: .78rem; letter-spacing: .5px; opacity: .75; line-height: 1.5; }
.credito-dev { margin-top: 12px; display: inline-block; background: #f5f5f3; border-radius: 10px; padding: 6px 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.credito-dev img { display: block; width: 220px; max-width: 100%; height: auto; }
.qr-pie { background: #fff; padding: 8px; border-radius: 10px; width: 130px; }

/* ---------- Avisos ---------- */
#avisos { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); }
.aviso { background: var(--texto); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--sombra); font-weight: 600; }
.aviso-error { background: var(--rojo); }

/* ---------- Página de pedido ---------- */
.caja { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 22px; margin: 24px auto; max-width: 560px; }
.estado-grande { text-align: center; }
.estado-grande .icono { font-size: 3.4rem; }
.estado-grande h2 { margin: 6px 0; }
.pasos { display: flex; justify-content: space-between; margin: 20px 0; font-size: .78rem; text-align: center; color: var(--gris); }
.pasos div { flex: 1; position: relative; }
.pasos div::before { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; background: var(--borde); margin: 0 auto 6px; }
.pasos div.hecho { color: var(--verde-osc); font-weight: 700; }
.pasos div.hecho::before { background: var(--verde); }

@media (max-width: 560px) {
  .marca h1 { font-size: 1.05rem; }
  .marca small { display: none; }
  .btn-admin span { display: none; }
  .grilla { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .foto { font-size: 2.8rem; }
}
