/* =========================================================
   COMPONENTES
   Piezas reutilizables: botones, header, cards, formularios,
   FAQ, botón flotante de WhatsApp.
   ========================================================= */

/* =========================================================
   BOTONES
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: .02em;
  line-height: 1.2;
  text-align: center;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast),
              transform var(--t-fast), box-shadow var(--t-fast);
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; flex: none; }

.btn--primary {
  background: var(--c-green);
  color: #fff;
  box-shadow: 0 6px 16px rgba(91, 185, 71, .35);
}
.btn--primary:hover { background: var(--c-green-dark); box-shadow: 0 8px 20px rgba(46, 125, 50, .35); }

.btn--outline { border-color: var(--c-green); color: var(--c-green-dark); }
.btn--outline:hover { background: var(--c-green); color: #fff; }

.btn--ghost { border-color: rgba(255, 255, 255, .8); color: #fff; }

/* Botón oscuro (se usa en el banner amarillo de la promo) */
.btn--dark { background: var(--c-dark); color: #fff; }
.btn--dark:hover { background: #000; }

/* Botón verde WhatsApp lleno (Plan Empresarial) */
.btn--wa-solid { background: #25D366; color: #fff; box-shadow: 0 8px 20px rgba(37, 211, 102, .3); }
.btn--wa-solid:hover { background: #1EBE5A; }
.btn--ghost:hover { background: #fff; color: var(--c-title); }

.btn--sm    { padding: 9px 18px; font-size: var(--fs-xs); }
.btn--lg    { padding: 16px 32px; font-size: var(--fs-base); }
.btn--block { display: flex; width: 100%; }
.btn[disabled] { opacity: .6; pointer-events: none; }

/* =========================================================
   HEADER + NAVEGACIÓN
   ========================================================= */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, .97);
  transition: box-shadow var(--t);
}
.header.is-scrolled { box-shadow: var(--shadow); }

.header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Marca (logo + nombre) */
.brand { display: flex; align-items: center; gap: 10px; }
.brand__logo { width: 48px; height: 48px; border-radius: 50%; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name {
  font-family: var(--ff-title);
  font-size: 1.3rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--c-title);
}
.brand__tag { font-size: var(--fs-xs); font-weight: 600; color: var(--c-green-dark); }

/* Menú mobile (panel desplegable) */
.nav {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px var(--gutter) 24px;
  background: #fff;
  box-shadow: var(--shadow);
  transform: translateY(-120%);
  visibility: hidden;
  transition: transform var(--t) var(--ease), visibility var(--t);
}
.nav.is-open { transform: none; visibility: visible; }

.nav__link {
  padding: 12px 4px;
  font-weight: 600;
  color: var(--c-green-dark);
  border-bottom: 1px solid var(--c-border);
  transition: color var(--t-fast);
}
.nav__link:hover, .nav__link.is-active { color: var(--c-green); }
.nav__cta { margin-top: 12px; }

/* Botón hamburguesa */
.burger {
  width: 44px; height: 44px;
  display: grid;
  place-content: center;
  gap: 5px;
}
.burger span {
  display: block;
  width: 24px; height: 2.5px;
  border-radius: 2px;
  background: var(--c-green-dark);
  transition: transform var(--t), opacity var(--t);
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* Botón "Pedir" del header: solo en celular/tablet */
.header__cta { margin-left: auto; min-height: 40px; padding: 10px 18px; }

/* Celulares chicos: achicamos la marca para que entren logo + Pedir + menú */
@media (max-width: 380px) {
  .header__inner { gap: 8px; }
  .brand { gap: 8px; }
  .brand__logo { width: 40px; height: 40px; }
  .brand__name { font-size: 1.12rem; }
  .brand__tag { font-size: .8rem; }
  .header__cta { padding: 10px 14px; }
}

@media (min-width: 960px) {
  .burger, .header__cta { display: none; }
  .nav {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 28px;
    padding: 0;
    background: none;
    box-shadow: none;
    transform: none;
    visibility: visible;
  }
  .nav__link { padding: 6px 0; border: 0; font-size: var(--fs-sm); position: relative; }
  .nav__link::after {
    content: '';
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 2px; background: var(--c-green);
    transform: scaleX(0); transition: transform var(--t-fast);
  }
  .nav__link:hover::after, .nav__link.is-active::after { transform: scaleX(1); }
  .nav__cta { margin-top: 0; }
}

/* =========================================================
   CARD genérica
   ========================================================= */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* =========================================================
   CARD DE PRODUCTO (generada por js/render.js)
   ========================================================= */
.product {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease), box-shadow var(--t);
}
.product:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.product--featured { border: 2px solid var(--c-green); }

.product__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--c-bg-alt); }
.product__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.product:hover .product__media img { transform: scale(1.05); }

/* Placeholder cuando el producto todavía no tiene foto */
.product__placeholder {
  width: 100%; height: 100%;
  display: grid; place-content: center; justify-items: center; gap: 8px;
  color: var(--c-muted);
  background: repeating-linear-gradient(45deg, #eef1ec 0 14px, #f6f8f5 14px 28px);
}
.product__placeholder svg { width: 72px; height: 72px; color: #b5bdb1; }


.badge {
  position: absolute;
  top: 14px; left: 14px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: #fff;
  background: var(--c-green);
  box-shadow: var(--shadow-sm);
}
.badge--gray { background: #7a8078; }
.badge--dark { background: var(--c-dark); }
.badge--yellow { background: #FFD25E; color: #10240C; }

.product__body { display: flex; flex-direction: column; flex: 1; padding: 22px 22px 24px; }
.product__tagline { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--c-green-dark); }
.product__name {
  margin-top: 4px;
  font-family: var(--ff-title);
  font-size: 1.6rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--c-title);
}
.product__desc { margin-top: 8px; font-size: var(--fs-sm); color: var(--c-muted); }

.product__features { margin: 16px 0 20px; display: grid; gap: 8px; font-size: var(--fs-sm); }
.product__features li { display: flex; gap: 8px; align-items: flex-start; }
.product__features svg { flex: none; width: 18px; height: 18px; margin-top: 3px; color: var(--c-green); }


.product__footer { margin-top: auto; display: grid; gap: 14px; }
.price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.price__value { font-family: var(--ff-title); font-size: 2.2rem; font-weight: 700; color: var(--c-title); line-height: 1; }
.price__unit  { font-size: var(--fs-sm); color: var(--c-muted); }
.price__label { font-family: var(--ff-title); font-size: 1.35rem; font-weight: 600; text-transform: uppercase; color: var(--c-title); }
/* Precio anterior tachado y nota de la promo ("5 packs: total $190.000") */
.price__old  { width: 100%; font-size: var(--fs-sm); font-weight: 600; color: var(--c-muted); }
.price__note { width: 100%; font-size: var(--fs-xs); font-weight: 700; color: var(--c-green-dark); }

/* =========================================================
   TARJETA OSCURA (Plan Empresarial)
   En vez de foto lleva un ícono grande arriba.
   ========================================================= */
.product--dark {
  border-color: transparent;
  color: rgba(255, 255, 255, .75);
  background:
    radial-gradient(circle at 100% 0, rgba(91, 185, 71, .28), transparent 55%),
    #161712;
}
.product__icon {
  width: 60px; height: 60px;
  margin: 24px 22px 0;
  padding: 14px;
  border-radius: 16px;
  color: var(--c-green);
  background: rgba(91, 185, 71, .15);
}
.product__icon svg { width: 100%; height: 100%; }
.product--dark .product__tagline { color: var(--c-green); }
.product--dark .product__name,
.product--dark .price__label { color: #fff; }
.product--dark .product__desc { color: rgba(255, 255, 255, .72); }
.product--dark .product__features li { color: rgba(255, 255, 255, .9); }

/* Chips (sabores, etiquetas) */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: #fff;
}

/* =========================================================
   FORMULARIOS
   ========================================================= */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field-row { display: grid; gap: 0 16px; align-items: start; }
@media (min-width: 600px) { .field-row { grid-template-columns: 1fr 1fr; } }

.field label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--c-title); }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--c-border);
  border-radius: 10px;
  background: #fff;
  font-size: var(--fs-base); /* 16px evita el zoom automático en iOS */
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field textarea { resize: vertical; min-height: 90px; }
.field select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%232E7D32' stroke-width='2'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--c-green);
  box-shadow: 0 0 0 4px rgba(91, 185, 71, .18);
}

/* Errores de validación (la clase la pone js/order-form.js) */
.field__error { display: none; font-size: var(--fs-xs); font-weight: 600; color: var(--c-error); }
.field.is-invalid input,
.field.is-invalid select { border-color: var(--c-error); }
.field.is-invalid .field__error { display: block; }

/* =========================================================
   FAQ (acordeón nativo con <details>)
   ========================================================= */
.faq { display: grid; gap: 12px; }
.faq__item {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: #fff;
  transition: box-shadow var(--t-fast);
}
.faq__item[open] { box-shadow: var(--shadow); }
.faq__q {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 20px;
  font-weight: 700;
  color: var(--c-title);
  cursor: pointer;
  list-style: none;
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q::after {
  content: '+';
  flex: none;
  display: grid; place-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 1.25rem; font-weight: 600; line-height: 1;
  color: var(--c-green-dark);
  background: var(--c-green-soft);
  transition: transform var(--t-fast);
}
.faq__item[open] .faq__q::after { transform: rotate(45deg); }
.faq__a { padding: 0 20px 20px; color: var(--c-muted); }

/* =========================================================
   DECORACIÓN DE FONDO (reutilizable)
   Se usa en Productos y en Pedido. Uso:
     <section class="section--deco">
       <div class="deco" aria-hidden="true">
         <span class="deco__blob deco__blob--green" style="..."></span>
         <svg class="doodle" style="--x --y --s --d --r"><use href="#i-..."/></svg>
       </div>
   ========================================================= */
.section--deco {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--c-bg-deco);
}
.deco { position: absolute; inset: 0; z-index: -1; pointer-events: none; }

/* Manchas de color difuminadas (posición y tamaño desde el HTML con style) */
.deco__blob {
  position: absolute;
  width: 540px; height: 540px;
  border-radius: 50%;
  /* (sin filter: blur: el degradé ya es suave y el blur animado es muy
     pesado para los celulares de gama baja) */
  animation: deco-breathe 10s ease-in-out infinite;
}
.deco__blob--green { background: radial-gradient(circle, rgba(91, 185, 71, .28), rgba(91, 185, 71, 0) 70%); }
.deco__blob--warm  { background: radial-gradient(circle, rgba(242, 153, 74, .22), rgba(242, 153, 74, 0) 70%); animation-delay: -5s; }

/* Dibujitos de línea flotando (hoja, pizza, olla, semillas…) */
.doodle {
  position: absolute;
  left: var(--x); top: var(--y);
  width: var(--s); height: var(--s);
  color: var(--c-green);
  opacity: .28;
  transform: rotate(var(--r));
  animation: deco-float 9s ease-in-out infinite;
  animation-delay: var(--d);
}
@media (max-width: 700px) { .doodle { opacity: .16; } }

@keyframes deco-float {
  0%, 100% { transform: translateY(0) rotate(var(--r)); }
  50%      { transform: translateY(-16px) rotate(calc(var(--r) + 10deg)); }
}
@keyframes deco-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* =========================================================
   BOTÓN FLOTANTE DE WHATSAPP
   ========================================================= */
.wa-float {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 90;
  display: flex; align-items: center; gap: 10px;
}
.wa-float > svg {
  width: 60px; height: 60px;
  padding: 14px;
  border-radius: 50%;
  color: #fff;
  background: var(--c-wa);
  box-shadow: 0 8px 24px rgba(37, 211, 102, .45);
  transition: transform var(--t-fast);
  animation: wa-pulse 2.6s infinite;
}
.wa-float:hover > svg { transform: scale(1.08); }

/* Se oculta cuando el formulario está en pantalla (ya tiene sus botones de WhatsApp) */
.wa-float { transition: opacity var(--t), transform var(--t) var(--ease); }
.wa-float.is-hidden { opacity: 0; transform: translateY(20px) scale(.7); pointer-events: none; }

@media (max-width: 600px) {
  .wa-float { right: 14px; bottom: 14px; }
  .wa-float > svg { width: 54px; height: 54px; padding: 12px; }
}

.wa-float__tip {
  display: none;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--c-title);
  background: #fff;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateX(8px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}
@media (min-width: 768px) {
  .wa-float__tip { display: block; }
  .wa-float:hover .wa-float__tip { opacity: 1; transform: none; }
}

@keyframes wa-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, .5), 0 8px 24px rgba(37, 211, 102, .4); }
  70%  { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0), 0 8px 24px rgba(37, 211, 102, .4); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0), 0 8px 24px rgba(37, 211, 102, .4); }
}
