/*!
 * rankia-chat 1.0.2 — estilos del widget.
 *
 * Todo cuelga de .rkc y .rkc-zona: ninguna regla toca elementos del tema, y
 * ninguna usa !important. Los colores son variables sobre :root del propio
 * widget, así que una web puede reteñirlo desde Bricks sin tocar este fichero:
 *   .rkc { --rkc-acento: #123456; }
 */

.rkc {
  --rkc-acento: #2e6153;          /* cabecera, botones, chips */
  --rkc-acento-txt: #ffffff;
  --rkc-fondo: #e9e2d9;           /* papel de la conversación */
  --rkc-punto: rgba(16, 24, 33, .055);
  --rkc-in: #ffffff;
  --rkc-in-txt: #101821;
  --rkc-out: #d5eedf;
  --rkc-out-txt: #0f2a20;
  --rkc-tick: #3e9ad6;
  --rkc-super: #ffffff;           /* pie y controles */
  --rkc-linea: #d9dfe6;
  --rkc-apagado: #5b6875;         /* 5,5:1 sobre blanco. El #78889a de 1.0.1 se
                                     quedaba en 3,1:1 y lo usaba el AVISO LEGAL. */
  --rkc-radio: 12px;
  --rkc-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  font-family: var(--rkc-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--rkc-in-txt);
  background: var(--rkc-fondo);
  border: 1px solid var(--rkc-linea);
  border-radius: var(--rkc-radio);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 44px -20px rgba(16, 24, 33, .38);
  text-align: left;
}

.rkc *,
.rkc *::before,
.rkc *::after { box-sizing: border-box; }

.rkc button { font: inherit; color: inherit; margin: 0; }
.rkc :focus-visible { outline: 2px solid var(--rkc-acento); outline-offset: 2px; }

/* ------------------------------ cabecera ------------------------------ */
.rkc__head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  background: var(--rkc-acento);
  color: var(--rkc-acento-txt);
}
.rkc__avatar {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  color: var(--rkc-acento);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .02em;
}
.rkc__avatar img { width: 26px; height: 26px; object-fit: contain; display: block; }
.rkc__who { flex: 1; min-width: 0; }
.rkc__who b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.rkc__who span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  opacity: .85;
  line-height: 1.3;
}
.rkc__who span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8fe3b5;
  flex: none;
}
.rkc__close {
  background: none;
  border: 0;
  color: inherit;
  opacity: .75;
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  border-radius: 4px;
}
.rkc__close:hover { opacity: 1; background: rgba(255, 255, 255, .16); }

.rkc__progress { height: 3px; background: rgba(0, 0, 0, .10); }
.rkc__progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--rkc-acento);
  filter: brightness(1.35);
  transition: width .45s cubic-bezier(.2, .7, .3, 1);
}

/* ---------------------------- conversación ---------------------------- */
.rkc__log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background-image: radial-gradient(var(--rkc-punto) 1px, transparent 1px);
  background-size: 18px 18px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.rkc__msg {
  max-width: 84%;
  padding: 8px 11px 7px;
  border-radius: var(--rkc-radio);
  font-size: 14.5px;
  line-height: 1.42;
  box-shadow: 0 1px 2px rgba(16, 24, 33, .10);
  overflow-wrap: anywhere;
  animation: rkc-pop .22s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes rkc-pop {
  from { opacity: 0; transform: translateY(6px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.rkc__msg--in {
  align-self: flex-start;
  background: var(--rkc-in);
  color: var(--rkc-in-txt);
  border-top-left-radius: 3px;
}
.rkc__msg--out {
  align-self: flex-end;
  background: var(--rkc-out);
  color: var(--rkc-out-txt);
  border-top-right-radius: 3px;
}
.rkc__meta {
  display: block;
  text-align: right;
  font-size: 10.5px;
  opacity: .55;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.rkc__msg--out .rkc__meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 3px;
}
.rkc__tick { color: var(--rkc-tick); line-height: 0; }

.rkc__typing {
  align-self: flex-start;
  background: var(--rkc-in);
  border-radius: var(--rkc-radio);
  border-top-left-radius: 3px;
  padding: 11px 13px;
  display: flex;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(16, 24, 33, .10);
}
.rkc__typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rkc-apagado);
  display: block;
  animation: rkc-blink 1.15s infinite ease-in-out;
}
.rkc__typing i:nth-child(2) { animation-delay: .16s; }
.rkc__typing i:nth-child(3) { animation-delay: .32s; }
@keyframes rkc-blink {
  0%, 60%, 100% { opacity: .28; transform: translateY(0); }
  30% { opacity: .95; transform: translateY(-3px); }
}

/* -------------------------- resumen y envío -------------------------- */
.rkc__recap { margin: 4px 0 2px; display: grid; gap: 5px; font-size: 13.5px; }
.rkc__r { display: flex; gap: 8px; align-items: baseline; }
.rkc__lapiz {
  flex: none;
  margin-left: auto;
  background: none;
  border: 0;
  padding: 2px 4px;
  cursor: pointer;
  color: var(--rkc-apagado);
  border-radius: 4px;
  line-height: 0;
}
.rkc__lapiz:hover { color: var(--rkc-acento); background: rgba(0, 0, 0, .05); }
.rkc__r b {
  flex: none;
  width: 76px;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  opacity: .6;
}
.rkc__consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 44px;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--rkc-in-txt);   /* 1.6.0: heredaba #9e9e9e del tema (2,68:1) y parecía deshabilitada */
  cursor: pointer;
}
.rkc__consent input {
  margin: 1px 0 0;
  width: 22px;
  height: 22px;
  flex: none;
  accent-color: var(--rkc-acento);
}
.rkc__mas { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--rkc-apagado); }
.rkc__mas summary { cursor: pointer; color: var(--rkc-acento); font-weight: 600; padding: 6px 0; }
.rkc__mas div { padding-top: 4px; }
.rkc__mas a { color: inherit; text-decoration: underline; }
.rkc__sendrow { margin-top: 11px; }
.rkc__send {
  width: 100%;
  background: var(--rkc-acento);
  color: var(--rkc-acento-txt);
  border: 0;
  border-radius: 8px;
  padding: 11px;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
}
/* 🔴 2026-09-08: `.rkc button { color: inherit }` (especificidad 0,1,1) ganaba a `.rkc__send`
   (0,1,0), asi que el blanco declarado nunca se aplicaba y el boton que ENVIA EL LEAD heredaba
   el texto oscuro del cuerpo: 2,51:1 medido en produccion sobre la 1.4.0. Es el ultimo clic del
   embudo. Se sube la especificidad en vez de tocar la regla general de los botones. */
.rkc .rkc__send { color: var(--rkc-acento-txt); }
.rkc__send[disabled] { opacity: .42; cursor: not-allowed; }
.rkc__send:not([disabled]):hover { filter: brightness(1.08); }

/* ------------------------------- el pie ------------------------------- */
.rkc__foot { border-top: 1px solid rgba(0, 0, 0, .08); background: var(--rkc-super); }
.rkc__quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 11px 12px 3px; }
.rkc__quick:empty { display: none; }
.rkc__chip {
  background: var(--rkc-super);
  border: 1.5px solid var(--rkc-acento);
  color: var(--rkc-acento);
  border-radius: 999px;
  min-height: 44px;             /* 1.7.2: objetivo táctil mínimo (medía 42 px) */
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.rkc__chip:hover { background: var(--rkc-acento); color: var(--rkc-acento-txt); }
.rkc__chip--flojo { border-color: var(--rkc-linea); color: var(--rkc-apagado); }
.rkc__chip--flojo:hover { background: #f1f4f7; color: var(--rkc-in-txt); border-color: var(--rkc-apagado); }

.rkc__bar { display: flex; gap: 8px; align-items: center; padding: 10px 12px 12px; margin: 0; }
.rkc__bar input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--rkc-linea);
  background: #f1f4f7;
  border-radius: 999px;
  min-height: 44px;
  padding: 11px 15px;
  font-size: 16px;              /* 16px evita el zoom automático de iOS */
  font-family: inherit;
  color: var(--rkc-in-txt);
}
.rkc__bar input[disabled] { opacity: .6; }
.rkc__bar button {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--rkc-acento);
  color: var(--rkc-acento-txt);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rkc__bar button[disabled] { opacity: .35; cursor: not-allowed; }

.rkc__cebo {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.rkc__legal {
  margin: 0;
  padding: 0 14px 11px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--rkc-apagado);
}
.rkc__legal a { color: inherit; text-decoration: underline; }

/* ------------------------ encastradas: A y B ------------------------ */
/* 1.7.4: el chat se monta con JS después de pintar la página y empujaba todo lo de debajo
   (CLS medido: 0,61 en /portes-de/motos/, 0,26 en la home). El hueco se reserva desde el
   HTML con la altura final, y dentro la conversación se estira o encoge (flex) cuando
   aparecen los botones: por fuera ya no se mueve nada. 300 px = cabecera, botones, barra
   y aviso; la conversación nunca pasa del 62 % de la pantalla. */
.rankia-chat-mount--a,
.rankia-chat-mount--b { display: block; height: calc(min(var(--rkc-alto, 400px), 62vh) + 300px); }
.rankia-chat-mount--a > .rkc,
.rankia-chat-mount--b > .rkc { height: 100%; }
.rkc-host { display: block; }
.rkc-host--b { max-width: 520px; margin-left: auto; margin-right: auto; }

/* ------------------------ superpuestas: C y D ------------------------ */
.rkc-zona {
  position: fixed;
  z-index: 99000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: var(--rkc-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif);
}
.rkc-zona--c { right: 22px; bottom: 22px; align-items: flex-end; }
.rkc-zona--d { left: 22px; bottom: 22px; align-items: flex-start; }
.rkc-zona__panel { width: 372px; max-width: calc(100vw - 32px); }
.rkc-zona[data-abierto="false"] .rkc-zona__panel { display: none; }
.rkc-zona[data-abierto="true"] .rkc-teaser,
.rkc-zona[data-abierto="true"] .rkc-lanzador,
.rkc-zona[data-abierto="true"] .rkc-pastilla { display: none; }

.rkc-teaser {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 290px;
  background: #fff;
  color: #101821;
  border: 1px solid #d9dfe6;
  border-radius: 14px 14px 4px 14px;
  padding: 11px 14px;
  box-shadow: 0 14px 34px -16px rgba(16, 24, 33, .45);
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
}
.rkc-teaser__dot { width: 8px; height: 8px; border-radius: 50%; background: #2e6153; flex: none; }

.rkc-lanzador {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2e6153;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 13px 20px 13px 16px;
  cursor: pointer;
  box-shadow: 0 20px 44px -18px rgba(16, 24, 33, .6);
  font-weight: 600;
  font-size: 15px;
}
.rkc-lanzador:hover { filter: brightness(1.08); }
.rkc-lanzador__pip {
  background: #fff;
  color: #2e6153;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rkc-pastilla {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 0;
  background: #2e6153;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 44px -18px rgba(16, 24, 33, .6);
  transition: transform .16s cubic-bezier(.2, .8, .3, 1);
}
.rkc-pastilla:hover { transform: scale(1.06); }
.rkc-pastilla__pip {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  /* 2026-09-08: #e1502a daba 3,9:1 con blanco y el texto mide 10,5 px, que exige 4,5:1. */
  background: #c0341a;
  color: #fff;
  border: 2.5px solid #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ------------------------------- móvil ------------------------------- */
@media (max-width: 560px) {
  .rkc-zona--c,
  .rkc-zona--d { left: 14px; right: 14px; bottom: 14px; align-items: stretch; }
  .rkc-zona__panel { width: auto; max-width: none; }
  .rkc-zona[data-abierto="true"] { top: 14px; }
  .rkc-zona[data-abierto="true"] .rkc-zona__panel { height: 100%; }
  .rkc-zona[data-abierto="true"] .rkc { height: 100%; }
  .rkc-zona[data-abierto="true"] .rkc__log { height: auto !important; flex: 1; }
  .rkc-teaser { max-width: none; }
  .rkc-pastilla { align-self: flex-start; }
}

.rkc-zona { transition: transform .22s ease, opacity .22s ease; }
.rkc-zona[data-apartado="true"] { transform: translateY(140%); opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .rkc *,
  .rkc-zona * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .rkc__log { scroll-behavior: auto; }
}
