/* Centro de ayuda flotante — agregos-theme. Paleta WhatsApp. Sin Tailwind. */

.agregos-help {
  position: fixed;
  z-index: 300; /* bajo cajones (500) y modales (600) */
  --wa-green: #25D366;
  --wa-green-dark: #1ebe5b;
  --wa-teal: #075E54;
  --wa-teal-light: #128C7E;
  --wa-bg: #ECE5DD;
  --wa-out: #DCF8C6;
  --wa-ink: #111b21;
  --wa-muted: #667781;
  --wa-line: #e9edef;
  --wa-error: #b42318;
  --wa-ok: #1f7a3f;
  font-size: 14px;
  line-height: 1.45;
  color: var(--wa-ink);
}
.agregos-help.whatsapp-widget--bottom-right { bottom: 5rem; right: 1rem; }
.agregos-help.whatsapp-widget--bottom-left  { bottom: 5rem; left: 1rem; }
@media (min-width: 1024px) {
  .agregos-help.whatsapp-widget--bottom-right { bottom: 1.5rem; right: 1.5rem; }
  .agregos-help.whatsapp-widget--bottom-left  { bottom: 1.5rem; left: 1.5rem; }
}

/* Botón flotante (verde WhatsApp, logo) */
.agregos-help__fab {
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: var(--wa-green); color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
  transition: transform .15s ease, box-shadow .15s ease;
}
.agregos-help__fab svg { width: 30px; height: 30px; }
.agregos-help__fab:hover { transform: scale(1.06); box-shadow: 0 6px 20px rgba(0, 0, 0, .28); }
.agregos-help__fab:focus-visible { outline: 3px solid rgba(37, 211, 102, .45); outline-offset: 2px; }

/* Panel */
.agregos-help__panel {
  position: absolute;
  bottom: calc(100% + .75rem);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 2rem);
  max-height: min(600px, calc(100vh - 8rem));
  display: flex; flex-direction: column;
  background: var(--wa-bg);
  border-radius: 16px;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .35);
  overflow: hidden;
  animation: agregos-help-pop .2s ease;
}
.agregos-help.whatsapp-widget--bottom-left .agregos-help__panel { right: auto; left: 0; }
.agregos-help__panel[hidden] { display: none; }
@keyframes agregos-help-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 639px) {
  .agregos-help__panel {
    position: fixed; left: .5rem; right: .5rem; bottom: .5rem;
    width: auto; max-width: none;
    max-height: calc(100vh - 1rem); max-height: calc(100dvh - 1rem);
  }
}

/* Cabecera (verde oscuro de WhatsApp) */
.agregos-help__head {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  background: var(--wa-teal); color: #fff;
}
.agregos-help__avatar {
  position: relative; flex: none;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff;
}
.agregos-help__avatar svg { width: 24px; height: 24px; }
.agregos-help__online { position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--wa-green); border: 2px solid var(--wa-teal); }
.agregos-help__head-text { flex: 1; min-width: 0; }
.agregos-help__title { margin: 0; font-size: .95rem; font-weight: 600; line-height: 1.2; color: #fff; }
.agregos-help__hours { margin: .1rem 0 0; font-size: .75rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agregos-help__close {
  flex: none; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: #fff; opacity: .8; cursor: pointer;
}
.agregos-help__close:hover { opacity: 1; background: rgba(255, 255, 255, .15); }

/* Cuerpo (fondo de chat) */
.agregos-help__body {
  flex: 1 1 auto; overflow-y: auto;
  padding: .9rem .9rem;
  background: var(--wa-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23d8d0c6' stroke-width='1.2' opacity='.55'%3E%3Ccircle cx='20' cy='20' r='6'/%3E%3Cpath d='M70 15l6 6-6 6-6-6z'/%3E%3Ccircle cx='100' cy='60' r='4'/%3E%3Cpath d='M30 80h12M36 74v12'/%3E%3Ccircle cx='80' cy='100' r='7'/%3E%3C/g%3E%3C/svg%3E");
}

/* Burbujas */
.agregos-help__bubble {
  position: relative;
  max-width: 92%;
  padding: .55rem .75rem;
  border-radius: 10px;
  font-size: .875rem;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
  margin-bottom: .6rem;
  word-wrap: break-word;
}
.agregos-help__bubble--in { background: #fff; border-top-left-radius: 2px; margin-right: auto; }
.agregos-help__bubble--out { background: var(--wa-out); border-top-right-radius: 2px; margin-left: auto; font-weight: 600; }
.agregos-help__bubble--in::before {
  content: ''; position: absolute; top: 0; left: -6px;
  border: 6px solid transparent; border-top-color: #fff; border-right-color: #fff;
}
.agregos-help__bubble--out::before {
  content: ''; position: absolute; top: 0; right: -6px;
  border: 6px solid transparent; border-top-color: var(--wa-out); border-left-color: var(--wa-out);
}
.agregos-help__answer p { margin: 0 0 .5rem; }
.agregos-help__answer p:last-child { margin-bottom: 0; }

/* Buscador (barra de escribir de WhatsApp) */
.agregos-help__search {
  display: flex; align-items: center; gap: .5rem;
  height: 42px; padding: 0 .85rem;
  margin: .25rem 0 .6rem;
  border-radius: 21px;
  background: #fff; color: var(--wa-muted);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}
.agregos-help__search:focus-within { box-shadow: 0 0 0 2px rgba(37, 211, 102, .45); }
.agregos-help__search input {
  flex: 1; min-width: 0;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  padding: 0 !important; margin: 0 !important;
  font: inherit !important; font-size: 16px !important; /* evita el zoom de iOS */
  color: var(--wa-ink) !important;
}
.agregos-help__search input:focus { outline: none; }
.agregos-help__results { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .6rem; }
.agregos-help__results[hidden] { display: none; }
.agregos-help__result {
  width: 100%; text-align: left;
  padding: .55rem .75rem;
  border: 0; border-radius: 10px;
  background: #fff; color: var(--wa-ink);
  font: inherit; font-size: .85rem; cursor: pointer;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}
.agregos-help__result:hover { background: #f5fbf7; }

/* Temas (opciones) */
.agregos-help__label { margin: .2rem 0 .45rem; font-size: .75rem; color: var(--wa-muted); }
.agregos-help__label[hidden] { display: none; }
.agregos-help__topics { display: flex; flex-direction: column; gap: .4rem; }
.agregos-help__topics[hidden] { display: none; }
.agregos-help__topic {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; text-align: left;
  padding: .6rem .75rem;
  border: 1px solid transparent; border-radius: 10px;
  background: #fff; color: var(--wa-ink);
  font: inherit; font-size: .875rem; font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
  transition: border-color .15s, background-color .15s;
}
.agregos-help__topic:hover { border-color: var(--wa-green); background: #f5fbf7; }
.agregos-help__topic-icon { font-size: 1.1rem; line-height: 1; width: 1.4rem; text-align: center; }
.agregos-help__skeleton { height: 40px; border-radius: 10px; background: linear-gradient(90deg, #fff 25%, #f3efe9 50%, #fff 75%); background-size: 200% 100%; animation: agregos-help-shimmer 1.2s infinite; }
@keyframes agregos-help-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Vista de tema */
.agregos-help__back {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: 0; margin-bottom: .6rem;
  border: 0; background: none;
  color: var(--wa-teal-light); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.agregos-help__link { color: var(--wa-teal-light); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.agregos-help__muted { color: var(--wa-muted); font-size: .8rem; margin: .4rem 0 0; }
.agregos-help__error { color: var(--wa-error); font-weight: 600; margin: .4rem 0; }
.agregos-help__thanks { color: var(--wa-ok); font-weight: 600; margin: 0; }

.agregos-help__card { margin-top: .5rem; padding: .7rem .8rem; border-radius: 10px; background: #f7f8fa; }
.agregos-help__card-title { margin: 0 0 .35rem; font-weight: 700; }
.agregos-help__card-title small { font-weight: 500; color: var(--wa-muted); }
.agregos-help__facts { list-style: none; margin: 0 0 .4rem; padding: 0; display: grid; gap: .2rem; }
.agregos-help__facts li { font-size: .85rem; }
.agregos-help__status { margin: 0 0 .5rem; font-size: 1rem; font-weight: 700; color: var(--wa-teal-light); }
.agregos-help__order--completed .agregos-help__status { color: var(--wa-ok); }
.agregos-help__order--delivery-failed .agregos-help__status,
.agregos-help__order--cancelled .agregos-help__status,
.agregos-help__order--failed .agregos-help__status { color: var(--wa-error); }

.agregos-help__provinces { list-style: none; margin: .5rem 0 0; padding: 0; }
.agregos-help__provinces li { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .85rem; border-top: 1px solid var(--wa-line); padding: .35rem 0; }
.agregos-help__provinces a, .agregos-help__provinces strong { color: var(--wa-ink); font-weight: 600; text-decoration: none; }
.agregos-help__provinces a:hover { color: var(--wa-teal-light); }
.agregos-help__provinces span { color: var(--wa-muted); font-size: .78rem; text-align: right; }

/* Pasos del pedido */
.agregos-help__steps { list-style: none; margin: .25rem 0 .6rem; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; }
.agregos-help__steps li { position: relative; font-size: .7rem; text-align: center; color: var(--wa-muted); padding-top: 1.2rem; }
.agregos-help__steps li span { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; background: var(--wa-line); }
.agregos-help__steps li::before { content: ''; position: absolute; top: 6px; left: -50%; width: 100%; height: 2px; background: var(--wa-line); }
.agregos-help__steps li:first-child::before { display: none; }
.agregos-help__steps li.is-done span, .agregos-help__steps li.is-current span,
.agregos-help__steps li.is-done::before, .agregos-help__steps li.is-current::before { background: var(--wa-green); }
.agregos-help__steps li.is-current { color: var(--wa-ink); font-weight: 700; }

/* Formulario */
.agregos-help__form { display: grid; gap: .55rem; margin-bottom: .5rem; }
.agregos-help__field { display: grid; gap: .25rem; font-size: .8rem; color: var(--wa-muted); }
.agregos-help__field input, .agregos-help__field select {
  height: 40px; padding: 0 .7rem;
  border: 1px solid var(--wa-line) !important; border-radius: 8px !important;
  background: #fff !important; color: var(--wa-ink) !important;
  font: inherit !important; font-size: 16px !important;
  box-shadow: none !important;
}
.agregos-help__field input:focus, .agregos-help__field select:focus { outline: none; border-color: var(--wa-green) !important; box-shadow: 0 0 0 3px rgba(37, 211, 102, .25) !important; }

/* Botones y chips */
.agregos-help__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 40px; padding: 0 1rem;
  border: 0; border-radius: 8px;
  background: var(--wa-green); color: #fff;
  font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: background-color .15s;
}
.agregos-help__btn:hover { background: var(--wa-green-dark); }
.agregos-help__btn[disabled] { opacity: .7; cursor: progress; }
.agregos-help__chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.agregos-help__chip {
  display: inline-flex; align-items: center; gap: .35rem;
  min-height: 34px; padding: 0 .8rem;
  border: 1px solid var(--wa-teal-light); border-radius: 17px;
  background: #fff; color: var(--wa-teal-light);
  font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.agregos-help__chip:hover { background: #eef8f4; }
.agregos-help__chip--wa { background: var(--wa-green); border-color: var(--wa-green); color: #fff; }
.agregos-help__chip--wa:hover { background: var(--wa-green-dark); }
.agregos-help__chip svg { width: 16px; height: 16px; }

/* Feedback */
.agregos-help__feedback { margin-top: .5rem; }
.agregos-help__feedback[hidden] { display: none; }

/* Pie */
.agregos-help__foot { padding: .55rem 1rem; background: #f0f2f5; border-top: 1px solid var(--wa-line); text-align: center; }
.agregos-help__foot-wa { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 600; color: var(--wa-teal-light); text-decoration: none; }
.agregos-help__foot-wa svg { width: 16px; height: 16px; }
.agregos-help__foot-wa:hover { text-decoration: underline; }

/* Fuera de la vista mientras hay un cajón abierto */
.agregos-help.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s ease, visibility .15s ease; }

@media (prefers-reduced-motion: reduce) {
  .agregos-help__panel, .agregos-help__skeleton { animation: none; }
  .agregos-help__fab, .agregos-help__topic { transition: none; }
}
