/* Panel de ayuda del botón de chat (chat-panel.js). Mismo lenguaje visual que el panel
   de soporte de la Consola: encabezado verde, tarjetas blancas y pestañas abajo. */

.io-arrow-left { --io: url("assets/icons/arrow-right.svg"); transform: rotate(180deg); }
.io-nav-down { --io: url("assets/icons/nav-arrow-right.svg"); transform: rotate(90deg); }
.io-chat-lines { --io: url("assets/icons/chat-lines.svg"); }
.io-chat-question { --io: url("assets/icons/chat-bubble-question.svg"); }

.chat-launcher[aria-busy] { cursor: progress; }

/* "Volver", al lado del botón mientras la ventana de Chatwoot está abierta. */
.chat-back {
  position: fixed;
  z-index: 94;
  right: 80px;
  bottom: 26px;
  display: inline-flex;
  height: 36px;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 12px;
  color: var(--green);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  border: 1px solid rgba(21, 63, 51, .16);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(15, 49, 40, .14);
  cursor: pointer;
}
.chat-back[hidden] { display: none; }
.chat-back:hover { background: var(--mint); }
.chat-back:focus-visible { outline: 3px solid #8fcbb0; outline-offset: 2px; }
.chat-back:disabled { cursor: progress; opacity: .7; }
.chat-back .io { width: 16px; height: 16px; }

.cp {
  position: fixed;
  z-index: 102;
  right: 22px;
  /* Sobre el botón: 20px + 48px + 12px. */
  bottom: 80px;
  display: flex;
  width: min(380px, calc(100vw - 44px));
  height: min(640px, calc(100dvh - 104px));
  overflow: hidden;
  flex-direction: column;
  color: #1f2a26;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
  background: #f5f7f6;
  border: 1px solid rgba(15, 49, 40, .08);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(15, 49, 40, .22);
  transform-origin: bottom right;
  animation: cp-in 160ms ease-out;
}
.cp[hidden] { display: none; }
@keyframes cp-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.cp a:focus-visible, .cp button:focus-visible { outline: 2px solid #1e8a63; outline-offset: 2px; }
.cp [hidden] { display: none !important; }

.cp-round {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: #fff;
  background: rgba(15, 49, 40, .42);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.cp-round:hover { background: rgba(15, 49, 40, .62); }
.cp .cp-round:focus-visible { outline-color: #fff; }
.cp-round .io { width: 18px; height: 18px; }
.cp-close { position: absolute; z-index: 3; top: 14px; right: 14px; }

.cp-scroll { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.cp-scroll:focus { outline: none; }

/* Inicio: el verde de la invitación fija; las tarjetas suben sobre él. */
.cp-hero { position: sticky; z-index: 0; top: 0; padding: 20px 64px 76px 22px; color: #fff; background: linear-gradient(110deg, #0f3128, #153f33 58%, #246f56); }
.cp-logo { display: block; width: auto; height: 24px; }
.cp-hero h2, .cp-hero p { margin: 0; color: #fff; font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.cp-hero h2 { margin-top: 28px; }

.cp-bar { position: sticky; z-index: 2; top: 0; display: flex; min-height: 62px; align-items: center; padding: 14px 60px 14px 18px; color: #fff; background: linear-gradient(110deg, #0f3128, #153f33 58%, #246f56); }
.cp-bar h2 { margin: 0; color: #fff; font-size: 17px; font-weight: 700; }
.cp-bar-plain { justify-content: center; padding: 14px 60px; background: #fff; border-bottom: 1px solid var(--line); }
.cp-bar-plain h2 { color: #1f2a26; }
.cp-mensajes .cp-close { color: #1f2a26; background: transparent; border-color: transparent; backdrop-filter: none; }
.cp-mensajes .cp-close:hover { background: #f5f7f6; }
.cp-mensajes .cp-close:focus-visible { outline-color: #1e8a63; }

.cp-cards { position: relative; z-index: 1; display: grid; align-content: start; gap: 12px; padding: 16px; }
.cp-inicio .cp-cards { margin-top: -56px; padding-top: 0; }

.cp-card { background: #fff; border: 1px solid rgba(15, 49, 40, .06); border-radius: 14px; box-shadow: 0 4px 16px rgba(15, 49, 40, .08); }
button.cp-card { width: 100%; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.cp-card:hover { border-color: rgba(30, 138, 99, .45); }

.cp-chat-slot { display: grid; }
.cp-chat { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 16px; }
button.cp-chat[aria-disabled="true"] { cursor: progress; }
.cp-chat > .io { width: 18px; height: 18px; color: #6b7570; }
.cp-chat-text { display: grid; gap: 2px; }
.cp-chat-text strong { font-size: 15px; }
.cp-chat-text > span { color: #5f6a65; font-size: 13px; }
.cp-chat a, .cp-ask-note a { color: #1e8a63; font-weight: 600; }
.cp-chat-error { border-left: 3px solid #c2410c; }
.cp-chat-error > button { padding: 4px 10px; color: #1e8a63; font: inherit; font-size: 13px; font-weight: 700; background: transparent; border: 1px solid currentColor; border-radius: 6px; cursor: pointer; }
.cp-chat-error > button:disabled { cursor: progress; opacity: .7; }

.cp-avatar { display: grid; width: 44px; height: 44px; overflow: hidden; place-items: center; background: #eef8f2; border: 1px solid #c9dfd3; border-radius: 50%; }
.cp-avatar img { width: 40px; height: auto; margin-top: 8px; }
.cp-avatar.is-large { width: 72px; height: 72px; }
.cp-avatar.is-large img { width: 64px; margin-top: 12px; }

.cp-featured { display: grid; gap: 6px; padding: 16px; }
.cp-featured strong { font-size: 15px; line-height: 1.3; }
.cp-featured span:not(.corpio-word) { display: -webkit-box; overflow: hidden; color: #5f6a65; font-size: 14px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.cp-featured span .corpio-word { display: inline; }

.cp-search-card { padding: 12px 12px 4px; }
.cp-search { position: relative; }
.cp-search .io { position: absolute; top: 50%; right: 14px; width: 18px; height: 18px; color: #1e8a63; transform: translateY(-50%); pointer-events: none; }
.cp-search input { width: 100%; height: 42px; padding: 0 42px 0 14px; color: inherit; font: inherit; font-size: 14px; background: #eef1ef; border: 1px solid transparent; border-radius: 10px; -webkit-appearance: none; appearance: none; }
.cp-search input::placeholder { color: #6b7570; }
.cp-search input:focus { background: #fff; border-color: #1e8a63; outline: 2px solid rgba(30, 138, 99, .3); outline-offset: 0; }
.cp-search input::-webkit-search-cancel-button { display: none; }
.cp-ayuda .cp-search input { background: #fff; border-color: var(--line); }

.cp-rows { margin: 6px 0 0; padding: 0; list-style: none; }
.cp-rows button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 4px; color: inherit; font: inherit; font-size: 14px; text-align: left; background: transparent; border: 0; border-radius: 6px; cursor: pointer; }
.cp-rows button:hover > span { color: #1e8a63; }
.cp-rows .io { width: 16px; height: 16px; color: #1e8a63; }

.cp-links { display: grid; padding: 4px 16px; }
.cp-links a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; color: var(--green); font-size: 14px; font-weight: 600; text-decoration: none; }
.cp-links a + a { border-top: 1px solid var(--line); }
.cp-links a:hover { color: #1e8a63; }
.cp-links .io { width: 16px; height: 16px; color: #1e8a63; }

/* Mensajes: barra blanca, Corpi y "Hacer una pregunta" sobre las pestañas. */
.cp-mensajes .cp-scroll { display: flex; flex-direction: column; background: #fff; }
.cp-mensajes .cp-view { display: flex; flex: 1 1 auto; flex-direction: column; }
.cp-messages { display: flex; flex: 1 1 auto; flex-direction: column; }
.cp-messages-empty { display: grid; flex: 1 1 auto; align-content: center; justify-items: center; gap: 12px; padding: 24px 24px 0; text-align: center; }
.cp-messages-empty p { max-width: 260px; margin: 0; color: #5f6a65; font-size: 14px; line-height: 1.5; }
.cp-ask { position: sticky; bottom: 0; display: grid; justify-items: center; gap: 8px; padding: 16px; }
.cp-ask-button { display: inline-flex; min-height: 44px; align-items: center; gap: 10px; padding: 10px 18px; color: #fff; font: inherit; font-size: 15px; font-weight: 600; background: var(--green); border: 0; border-radius: 10px; box-shadow: 0 10px 24px rgba(15, 49, 40, .22); cursor: pointer; }
.cp-ask-button:hover { background: var(--green-bright); }
.cp-ask-button[aria-disabled="true"] { cursor: progress; opacity: .85; }
.cp-ask-button .io { width: 20px; height: 20px; }
.cp-ask-note { max-width: 300px; margin: 0; color: #5f6a65; font-size: 13px; line-height: 1.45; text-align: center; }
.cp-ask-note strong { color: #1f2a26; }
.cp-ask-note.is-error strong { color: #c2410c; }

/* Ayuda: búsqueda y preguntas frecuentes en acordeón. */
.cp-section { display: grid; gap: 8px; }
.cp-section h3 { margin: 4px 0 0; color: #5f6a65; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.cp-faq { margin: 0; padding: 0; list-style: none; background: #fff; border: 1px solid rgba(15, 49, 40, .06); border-radius: 14px; box-shadow: 0 4px 16px rgba(15, 49, 40, .06); }
.cp-faq > li:not([hidden]) ~ li:not([hidden]) { border-top: 1px solid var(--line); }
.cp-faq h4 { margin: 0; }
.cp-faq h4 button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; color: inherit; font: inherit; font-size: 14px; font-weight: 500; text-align: left; background: transparent; border: 0; cursor: pointer; scroll-margin: 70px 0 12px; }
.cp-faq h4 .io { width: 18px; height: 18px; color: #6b7570; transition: transform 160ms ease; }
.cp-faq h4 button[aria-expanded="true"] .io { transform: rotate(270deg); }
.cp-answer { padding: 0 14px 14px; color: #5f6a65; font-size: 14px; line-height: 1.5; }
.cp-answer p { margin: 0; }
.cp-empty { margin: 0; color: #5f6a65; font-size: 14px; }
.cp-help-links { display: grid; justify-items: start; gap: 10px; padding: 4px 2px 8px; }
.cp-help-links a { display: inline-flex; align-items: center; gap: 6px; color: #1e8a63; font-size: 14px; font-weight: 600; text-decoration: none; }
.cp-help-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cp-help-links .io { width: 16px; height: 16px; }

/* Pestañas abajo, fijas dentro del panel. */
.cp-tabs { display: grid; flex: 0 0 auto; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid var(--line); }
.cp-tabs button { display: grid; justify-items: center; gap: 3px; padding: 8px 4px 6px; color: #6b7570; font: inherit; font-size: 12px; background: transparent; border: 0; border-radius: 6px; cursor: pointer; }
.cp-tabs button .io { width: 22px; height: 22px; }
.cp-tabs button:hover { color: var(--green); }
.cp-tabs button.active { color: #1e8a63; font-weight: 600; }

@media (max-width: 760px) {
  .chat-back { right: 68px; bottom: 19px; }
}

/* Celulares: pantalla completa sobre la página y el botón. */
@media (max-width: 720px) {
  .cp { z-index: 110; inset: 0; width: 100%; height: 100dvh; border: 0; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cp { animation: none; }
  .cp-faq h4 .io { transition: none; }
}
