:root {
  --jr-bg: #ffffff;
  --jr-border: #e5e7eb;
  --jr-muted: #6b7280;
  --jr-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --jr-radius: 16px;
  --jr-radius-sm: 12px;
  --jr-pad: 14px;
  --jr-ok: #111827;
}

/* Panel flotante (overlay) */
.jardinarium-chatbot {
  position: fixed; /* <- clave para flotar */
  right: 20px;
  bottom: 84px; /* deja hueco para el FAB (56px + margen) */
  width: 360px;
  max-width: min(92vw, 420px);
  z-index: 2147483646; /* por encima del contenido */
  display: none; /* oculto por defecto */
  transform: translateY(8px);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.jardinarium-chatbot.is-open {
  display: block;
  transform: translateY(0);
  opacity: 1;
}

/* Ajusta alto del log para panel flotante */
.jardinarium-log {
  height: 420px;
  overflow: auto;
  padding: 8px;
  background: #fafafa;
  border-radius: var(--jr-radius-sm);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.jardinarium-log::-webkit-scrollbar {
  display: none;
}

/* Caja del chat */
.jardinarium-box {
  border: 1px solid var(--jr-border);
  border-radius: var(--jr-radius);
  background: var(--jr-bg);
  box-shadow: var(--jr-shadow);
  padding: var(--jr-pad);
  position: relative;
}


/* Burbujas */
.msg {
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: 14px;
  white-space: pre-wrap;
}
.msg-user {
  background: #e8f2ff;
  margin-left: 20%;
}
.msg-bot {
  background: #f5f7fb;
  margin-right: 20%;
}

/* Input + botón enviar */
.jardinarium-form {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: flex-start;
}
.jardinarium-form input,
.jardinarium-form textarea {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--jr-border);
  border-radius: 12px;
  outline: none;
  resize: none;
  min-height: 44px;
  line-height: 1.35;
  overflow-y: hidden;
  box-sizing: border-box;
  max-height: calc(1.35em * 3 + 24px);
}

.jardinarium-form input:focus,
.jardinarium-form textarea:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.25);
}

.jardinarium-form button[type="submit"] {
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  cursor: pointer;
  align-self: flex-start;
}

.jardinarium-form button:focus-visible,
.jardinarium-fab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.35);
}

/* Botón flotante (FAB) */
.jardinarium-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 64px;
  height: 64px;
  background: transparent;
  border: 0;
  padding: 0 !important;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease;
  z-index: 2147483647;
}
.jardinarium-fab:hover {
  transform: translateY(-1px);
}

.jardinarium-fab img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25));
  object-fit: contain;
}

/* Modo oscuro automático */
@media (prefers-color-scheme: dark) {
  :root {
    --jr-bg: #0b0f16;
    --jr-border: #1f2937;
    --jr-muted: #9ca3af;
    --jr-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
  .jardinarium-chatbot {
    color: #e5e7eb;
  }
  .jardinarium-log {
    background: #0f172a;
  }
  .msg-user {
    background: #0a2a4a;
  }
  .msg-bot {
    background: #111827;
  }
  .jardinarium-form input {
    background: #0b0f16;
    color: #e5e7eb;
  }
  .jardinarium-form button {
    background: #2563eb;
  }
}

/* Accesibilidad: helper oculto */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Bloque “Guía anual (PDF)” dentro del chat */
.jr-guide .jr-guide-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.jr-guide .jr-guide-form input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--jr-border);
  border-radius: 10px;
  outline: none;
}
.jr-guide .jr-guide-form button {
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  cursor: pointer;
}
.jr-guide .jr-guide-status {
  margin-top: 6px;
  font-size: 0.92rem;
  color: var(--jr-muted);
}

/* Forzar FAB totalmente transparente y sin estilos del tema */
button.jardinarium-fab,
button.jardinarium-fab:hover,
button.jardinarium-fab:focus,
button.jardinarium-fab:active,
button.jardinarium-fab[aria-expanded="true"] {
  background: transparent !important;
  background-image: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-appearance: none;
  appearance: none;
}

/* Por si el tema usa pseudo-elementos para el fondo */
button.jardinarium-fab::before,
button.jardinarium-fab::after {
  content: none !important;
}

/* Asegurar que el <img> tampoco tiene fondo/borde/sombra */
.jardinarium-fab img {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  /* si el “halo” te lo provoca el drop-shadow, quítalo: */
  filter: none !important;
}

.jardinarium-form button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.jr-guide .jr-guide-form button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.jr-guide .jr-guide-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.jr-guide .jr-guide-form button {
  width: 100%;
}

.msg.jr-guide {
  padding-top: 6px;
  padding-bottom: 8px;
  margin: 4px 0;
}

.jr-guide .jr-guide-text {
  margin: 0 0 6px;
}

.jr-guide .jr-guide-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 4px;
}

.jr-guide .jr-guide-status {
  margin-top: 6px;
}

.msg.jr-guide.jr-guide-sent {
  padding-top: 6px;
  padding-bottom: 6px;
  margin: 4px 0;
}

.msg.jr-guide.jr-guide-sent .jr-guide-status {
  margin-top: 0;
}

.msg-bot {
  white-space: normal;
}

.msg-bot > * {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.45;
}
.msg-bot > :first-child {
  margin-top: 0;
}
.msg-bot > :last-child {
  margin-bottom: 0;
}

.msg-bot p {
  margin: 0.5rem 0;
}
.msg-bot ul,
.msg-bot ol {
  margin: 0.5rem 0 0.5rem 1.25rem;
  padding: 0;
}
.msg-bot li {
  margin: 0.25rem 0;
}

.msg-bot pre {
  white-space: pre-wrap;
}

.jr-input-wrap {
  position: relative;
  width: 100%;
  flex: 1;
}

.jr-input-wrap textarea {
  width: 100%;
  padding-right: 140px;
}

.jr-icon-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  line-height: 1;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  color: var(--jr-muted);
  display: grid;
  place-items: center;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: none !important;
}
.jr-icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}
.jr-btn-send { right: -4px; }
.jr-btn-mic  { right: 28px; }
.jr-btn-send.is-active { color: var(--jr-ok); }


.jr-icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.jr-icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.35);
}

.jr-guide .jr-guide-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--jr-muted);
}

.jr-guide .jr-guide-consent input[type="checkbox"] {
  margin-top: 3px;
}


.jr-lang {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 78px;
  width: 32px;
  min-width: 0;
  height: 32px;
  padding: 0 2px;
  border: 1px solid var(--jr-border);
  border-radius: 8px;
  background: var(--jr-bg);
  color: inherit;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  text-align: center;
}



.jr-input-wrap textarea {
  width: 100%;
  padding-right: 120px;
}


.jr-icon-btn.is-recording {
  color: var(--jr-ok);
}

.jardinarium-box {
  border: 1px solid var(--jr-border);
  border-radius: var(--jr-radius);
  background: var(--jr-bg);
  box-shadow: var(--jr-shadow);
  padding: var(--jr-pad);
  position: relative;
}

.jr-close {
  position: absolute;
  font-size: 1.6rem !important;
  top: -4px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: var(--jr-muted);
  display: grid;
  place-items: center;
  border-radius: 999px;
  cursor: pointer;
}


.jr-close:hover {
  color: var(--jr-ok);
}

.jr-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.35);
}


.jr-close:hover {
  background: #f3f4f6;
}

.jr-legal{
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--jr-muted);
}

.jr-legal a{
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.jr-legal a:hover{
  color: var(--jr-ok);
}


@media (prefers-color-scheme: dark) {
  .jr-guide .jr-guide-form input {
    background: #0b0f16;
    color: #e5e7eb;
  }
  .jardinarium-form button[type="submit"] {
    background: #2563eb;
  }
.jr-btn-send.is-active { color: var(--jr-ok); }

 .jr-close:hover {
    background: #1f2937;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jardinarium-chatbot {
    transition: none;
  }
  .jardinarium-fab {
    transition: none;
  }
}
