/* =====================================================================
   AgroConsent — banner de cookies de AgroDent (estilos)
   ---------------------------------------------------------------------
   Diseño cálido de la Propuesta 1 (papel, cinta adhesiva y sello), pero
   tematizable con variables en :root de la página:
     --ck-accent --ck-accent-ink   botones e interruptor activado
     --ck-bg --ck-surface          tarjeta y recuadros de categorías
     --ck-ink --ck-muted --ck-line texto, texto secundario y bordes
     --ck-radius --ck-font --ck-font-display
     --ck-seal --ck-seal-ink       sello (fondo e icono)
     --ck-tape                     cinta adhesiva decorativa (transparent para quitarla)
     --ck-focus                    contorno de foco
     --ck-overlay                  fondo oscuro de la configuración
     --ck-offset-bottom            px libres abajo (barras fijas propias)
   Por defecto toman las --as-* del motor de tienda y, si no, los colores
   de AgroDent.
   ===================================================================== */
.agc {
  --_accent: var(--ck-accent, var(--as-accent, #55651f));
  --_accent-ink: var(--ck-accent-ink, var(--as-accent-ink, #fffaf0));
  --_bg: var(--ck-bg, var(--as-bg, #fffaf0));
  --_surface: var(--ck-surface, var(--as-surface, #f4ead3));
  --_ink: var(--ck-ink, var(--as-ink, #2e2114));
  --_muted: var(--ck-muted, var(--as-muted, #6b5641));
  --_line: var(--ck-line, var(--as-line, rgba(59, 42, 26, .14)));
  --_radius: var(--ck-radius, 22px);
  --_font: var(--ck-font, var(--as-font, "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif));
  --_display: var(--ck-font-display, var(--as-font-display, "Fraunces", Georgia, serif));
  --_seal: var(--ck-seal, var(--as-dark, #3b2a1a));
  --_seal-ink: var(--ck-seal-ink, #f2c230);
  --_tape: var(--ck-tape, rgba(242, 194, 48, .62));
  --_focus: var(--ck-focus, #1f5a66);
  --_off: var(--ck-offset-bottom, 0px);
  font-family: var(--_font);
  color: var(--_ink);
  -webkit-font-smoothing: antialiased;
}
.agc *, .agc *::before, .agc *::after { box-sizing: border-box; }
.agc [hidden] { display: none !important; }
.agc .agc-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.agc :focus-visible { outline: 3px solid var(--_focus); outline-offset: 3px; }
.agc .agc-t:focus { outline: none; }

/* los «Configurar cookies» de la página solo se ven si este banner funciona */
html:not(.agc-on) [data-consent-open],
html:not(.agc-on) [data-consent-item] { display: none !important; }
html.agc-lock, html.agc-lock body { overflow: hidden !important; }

/* ---------- piezas comunes ---------- */
.agc .agc-seal { position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; transform: rotate(-8deg); }
.agc .agc-seal__ring { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.agc .agc-seal__bg { fill: var(--_seal); }
.agc .agc-seal__dash { fill: none; stroke: var(--_seal-ink); stroke-width: 1; stroke-dasharray: 1.6 2.4; opacity: .85; }
.agc .agc-seal__ico { position: relative; display: block; width: 22px; height: 22px; color: var(--_seal-ink); }

.agc .agc-t {
  margin: 0; font: 650 21px/1.15 var(--_display); letter-spacing: -.01em; color: var(--_ink);
  font-variation-settings: "SOFT" 50, "WONK" 0; text-wrap: balance;
}
.agc .agc-d { margin: 0; font: 400 14.5px/1.5 var(--_font); color: var(--_muted); }
.agc .agc-a {
  color: var(--_ink); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px;
  text-underline-offset: 3px; border-radius: 4px;
}
.agc .agc-a:hover { color: var(--_accent); }

.agc .agc-btn {
  -webkit-appearance: none; appearance: none; display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; margin: 0; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--_accent); color: var(--_accent-ink); font: 600 15px/1.15 var(--_font); text-align: center;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); transition: background-color .2s, transform .2s;
}
.agc .agc-btn:hover {
  background: var(--_accent);
  background: color-mix(in srgb, var(--_accent) 86%, #fff);
  transform: translateY(-1px);
}
.agc .agc-btn:active { transform: none; }
.agc .agc-btn:focus-visible { border-radius: 999px; }
.agc .agc-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* ---------- primera capa ---------- */
.agc .agc-bar {
  position: fixed; z-index: 8850; left: 24px; bottom: calc(24px + var(--_off));
  width: min(460px, calc(100vw - 48px)); padding: 22px 22px 20px;
  background: var(--_bg); color: var(--_ink); border-radius: var(--_radius);
  box-shadow: 0 0 0 1px var(--_line), 0 2px 6px rgba(59, 42, 26, .06), 0 28px 54px -22px rgba(59, 42, 26, .55);
  animation: agc-in .6s cubic-bezier(.2, .8, .2, 1) .45s both;
}
/* cinta adhesiva, como las notas de la historia */
.agc .agc-bar::before, .agc .agc-dlg::before {
  content: ""; position: absolute; top: -11px; left: 50%; width: 96px; height: 24px; margin-left: -48px;
  background: var(--_tape); transform: rotate(-3deg); border-radius: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  pointer-events: none;
}
.agc .agc-bar__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.agc .agc-actions--bar { margin-top: 16px; }

/* ---------- segunda capa (configuración) ---------- */
.agc .agc-dlg {
  position: fixed; inset: 0; margin: auto; width: min(624px, calc(100vw - 32px)); max-width: none; height: fit-content;
  max-height: none; padding: 0; border: 0; border-radius: 24px; overflow: visible;
  background: var(--_bg); color: var(--_ink); font: 400 15px/1.5 var(--_font);
  box-shadow: 0 0 0 1px var(--_line), 0 30px 80px -20px rgba(30, 22, 14, .6);
}
.agc .agc-dlg[open] { animation: agc-pop .35s cubic-bezier(.2, .8, .2, 1); }
.agc .agc-dlg::backdrop { background: rgba(46, 33, 20, .55); background: var(--ck-overlay, rgba(46, 33, 20, .55)); }
.agc .agc-dlg__in {
  position: relative; max-height: 88vh; max-height: min(88dvh, 780px); overflow: auto; overscroll-behavior: contain;
  padding: 28px 28px 22px; border-radius: inherit;
}
.agc .agc-dlg__head { display: flex; align-items: center; gap: 12px; padding-right: 48px; margin-bottom: 10px; }
.agc .agc-dlg .agc-t { font-size: 26px; }
.agc .agc-x {
  position: absolute; top: 18px; right: 18px; width: 42px; height: 42px; margin: 0; padding: 0; border: 0;
  border-radius: 50%; background: var(--_surface); color: var(--_ink); display: grid; place-items: center; cursor: pointer;
  transition: background-color .2s;
}
.agc .agc-x:hover { background: color-mix(in srgb, var(--_surface) 80%, var(--_ink)); }
.agc .agc-x:focus-visible { border-radius: 50%; }
.agc .agc-x svg { display: block; width: 18px; height: 18px; }

.agc .agc-cats { display: grid; gap: 12px; margin: 18px 0 20px; }
.agc .agc-cat { padding: 16px 18px 17px; border-radius: 16px; background: var(--_surface); box-shadow: inset 0 0 0 1px var(--_line); }
.agc .agc-cat__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.agc .agc-cat__t { margin: 0; font: 650 17px/1.25 var(--_display); letter-spacing: -.005em; color: var(--_ink); font-variation-settings: "SOFT" 50, "WONK" 0; }
.agc .agc-cat__t label { cursor: pointer; }
.agc .agc-cat__d { margin: 8px 0 0; font: 400 14px/1.5 var(--_font); color: var(--_muted); }
.agc .agc-always {
  flex: none; padding: 6px 11px; border-radius: 999px; background: color-mix(in srgb, var(--_accent) 16%, var(--_bg));
  color: var(--_ink); font: 700 12.5px/1.2 var(--_font); white-space: nowrap;
}
.agc .agc-toggle { flex: none; display: inline-flex; align-items: center; gap: 8px; }
.agc .agc-state { min-width: 2ch; font: 700 13.5px/1 var(--_font); color: var(--_ink); }

/* interruptor (casilla con role="switch") */
.agc .agc-switch {
  -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 52px; height: 30px; margin: 0;
  border-radius: 999px; background: #8c7a62; cursor: pointer; transition: background-color .2s;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .18);
}
.agc .agc-switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .28); transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
.agc .agc-switch:checked { background: var(--_accent); }
.agc .agc-switch:checked::before { transform: translateX(22px); }
.agc .agc-switch:focus-visible { border-radius: 999px; }

.agc .agc-links { margin: 14px 0 0; font: 400 13.5px/1.5 var(--_font); color: var(--_muted); text-align: center; }

/* ---------- tabletas y móviles: hoja inferior ancha ---------- */
@media (max-width: 899px) {
  .agc .agc-bar {
    left: 10px; right: 10px; width: auto; max-width: 640px; margin: 0 auto;
    bottom: calc(10px + var(--_off) + env(safe-area-inset-bottom, 0px)); padding: 18px 16px 16px; border-radius: 20px;
  }
}
/* tabletas: deja libre el botón del chat (abajo a la derecha) */
@media (min-width: 641px) and (max-width: 899px) {
  .agc .agc-bar { left: 16px; right: 96px; }
}
@media (max-width: 640px) {
  .agc .agc-bar__head { gap: 10px; margin-bottom: 8px; }
  .agc .agc-seal { width: 36px; height: 36px; }
  .agc .agc-seal__ico { width: 18px; height: 18px; }
  .agc .agc-t { font-size: 18px; }
  .agc .agc-d { font-size: 14px; line-height: 1.45; }
  .agc .agc-actions--bar { margin-top: 12px; gap: 6px; }
  .agc .agc-btn { min-height: 46px; padding: 0 8px; font-size: 14.5px; }
  /* configuración como hoja que sube desde abajo */
  .agc .agc-dlg { width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .agc .agc-dlg[open] { animation-name: agc-sheet; }
  .agc .agc-dlg__in { max-height: 92vh; max-height: 92dvh; padding: 24px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .agc .agc-dlg .agc-t { font-size: 22px; }
  .agc .agc-x { top: 14px; right: 14px; }
  .agc .agc-cat { padding: 14px 14px 15px; }
  .agc .agc-cat__t { font-size: 16px; }
  .agc .agc-cat__d { font-size: 13.5px; }
  .agc .agc-actions--dlg { grid-template-columns: 1fr; }
}
/* texto corto de la primera capa: solo en móviles muy estrechos o bajos (así no tapa el botón de compra de la portada) */
.agc .agc-d__short { display: none; }
@media (max-width: 359px), (max-width: 640px) and (max-height: 640px) {
  .agc .agc-d__long { display: none; }
  .agc .agc-d__short { display: inline; }
  .agc .agc-bar { padding: 14px 14px 14px; }
  .agc .agc-bar__head { margin-bottom: 6px; }
  .agc .agc-seal { width: 32px; height: 32px; }
  .agc .agc-seal__ico { width: 16px; height: 16px; }
  .agc .agc-t { font-size: 17px; }
  .agc .agc-d { font-size: 13.5px; }
  .agc .agc-actions--bar { margin-top: 10px; }
}
/* móviles muy estrechos: los tres botones siguen en fila e iguales, con letra algo menor */
@media (max-width: 359px) {
  .agc .agc-actions--bar .agc-btn { padding: 0 4px; font-size: 13.5px; }
}

@keyframes agc-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes agc-pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes agc-sheet { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  .agc .agc-bar, .agc .agc-dlg[open] { animation: none; }
  .agc .agc-btn, .agc .agc-switch, .agc .agc-switch::before, .agc .agc-x { transition: none; }
  .agc .agc-btn:hover { transform: none; }
}
@media (forced-colors: active) {
  .agc .agc-bar, .agc .agc-dlg, .agc .agc-cat { border: 1px solid CanvasText; }
  .agc .agc-btn { border: 1px solid ButtonText; }
  .agc .agc-switch { border: 1px solid ButtonText; background: Canvas; }
  .agc .agc-switch::before { background: ButtonText; top: 2px; left: 2px; }
  .agc .agc-switch:checked { background: Highlight; }
}
@media print { .agc { display: none !important; } }
