.wp360dc-chat-ui {
  --wp360dc-primary: #24DBFF;
  --wp360dc-primary-text: #06222A;
  --wp360dc-header-bg: #0D1F24;
  --wp360dc-header-text: #FFFFFF;
  --wp360dc-bot-bg: #FFFFFF;
  --wp360dc-bot-text: #111111;
  --wp360dc-panel-bg: #F7FAFB;
  font-family: Arial, Helvetica, sans-serif;
}

.wp360dc-chat-ui--widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  width: 360px;
  max-width: calc(100vw - 24px);
  min-height: 64px;
}

body.wp360dc-iframe-body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

.wp360dc-iframe-body {
  min-height: 92px;
  overflow: hidden;
}

.wp360dc-toggle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 999px;
  background: var(--wp360dc-primary);
  color: var(--wp360dc-primary-text);
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(0,0,0,.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.wp360dc-toggle:hover {
  transform: translateY(-2px);
}

.wp360dc-toggle-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wp360dc-toggle-icon svg {
  width: 100%;
  height: 100%;
}

.wp360dc-toggle-icon--custom {
  width: 52px;
  height: 52px;
}

.wp360dc-toggle-custom-icon {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 999px;
}

.wp360dc-toggle-icon--custom .wp360dc-toggle-custom-icon {
  max-width: 52px;
  max-height: 52px;
}

.wp360dc-chat-ui--widget.is-open .wp360dc-toggle {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(.96);
}

.wp360dc-panel {
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 520px;
  margin-top: 10px;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
  border: 1px solid rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
}

.wp360dc-chat-ui--widget .wp360dc-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  margin-top: 0;
}

.wp360dc-panel--standalone {
  width: 100%;
  max-width: 100%;
  height: 100vh;
  min-height: 560px;
  margin-top: 0;
  border-radius: 0;
  box-shadow: none;
  border: 0;
}

.wp360dc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--wp360dc-header-bg);
  color: var(--wp360dc-header-text);
}


.wp360dc-header-identity {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.wp360dc-header-logo {
  width: auto;
  height: 28px;
  max-width: 110px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 4px;
}

.wp360dc-header-title {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.wp360dc-close {
  border: 0;
  background: transparent;
  color: var(--wp360dc-header-text);
  font-size: 28px;
  line-height: 1;
  width: 32px;
  height: 32px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.wp360dc-close:hover {
  background: rgba(255,255,255,.1);
}

.wp360dc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--wp360dc-panel-bg);
}

.wp360dc-message {
  margin-bottom: 12px;
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 14px;
  word-break: break-word;
}

.wp360dc-message--bot {
  background: var(--wp360dc-bot-bg);
  color: var(--wp360dc-bot-text);
  border: 1px solid rgba(0,0,0,.08);
}

.wp360dc-message--user {
  margin-left: auto;
  background: var(--wp360dc-primary);
  color: var(--wp360dc-primary-text);
}

.wp360dc-sources {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,.08);
}

.wp360dc-sources a {
  display: block;
  font-size: 12px;
  margin-top: 4px;
  color: #0A5B7A;
  text-decoration: none;
}

.wp360dc-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(0,0,0,.08);
  background: #fff;
}

.wp360dc-input {
  resize: none;
  min-height: 44px;
  max-height: 120px;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

.wp360dc-send {
  border: 0;
  border-radius: 12px;
  background: #FF5A5F;
  color: #fff;
  font-weight: 700;
  padding: 0 16px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .wp360dc-chat-ui--widget {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .wp360dc-panel,
  .wp360dc-chat-ui--widget .wp360dc-panel {
    width: calc(100vw - 24px);
    height: 70vh;
  }
}


.wp360dc-chat-ui--iframe {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 92px;
  max-width: 100%;
}

.wp360dc-chat-ui--iframe .wp360dc-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
}

.wp360dc-chat-ui--iframe .wp360dc-panel {
  position: absolute;
  inset: 12px;
  width: auto;
  max-width: none;
  height: auto;
}

.wp360dc-chat-ui--iframe.is-open .wp360dc-toggle {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(.96);
}

.wp360dc-chat-ui--iframe:not(.is-open) .wp360dc-panel {
  display: none;
}

/* v1.4.13 - Aviso legal inicial del chatbot */
.wp360dc-legal-notice {
  padding: 14px;
  background: var(--wp360dc-panel-bg);
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.wp360dc-legal-notice__box {
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(15,23,42,.05);
}
.wp360dc-legal-notice__box strong {
  display: block;
  margin-bottom: 8px;
  color: #101828;
  font-size: 15px;
}
.wp360dc-legal-notice__text {
  color: #475467;
  font-size: 13px;
  line-height: 1.45;
}
.wp360dc-legal-notice__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.wp360dc-legal-accept,
.wp360dc-legal-privacy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.wp360dc-legal-accept {
  border: 0;
  background: var(--wp360dc-primary);
  color: var(--wp360dc-primary-text);
}
.wp360dc-legal-privacy {
  border: 1px solid rgba(0,0,0,.14);
  background: #fff;
  color: #175cd3;
}
.wp360dc-legal-pending .wp360dc-messages {
  opacity: .65;
}
.wp360dc-legal-pending .wp360dc-input,
.wp360dc-legal-pending .wp360dc-send {
  cursor: not-allowed;
}
@media (max-width: 420px) {
  .wp360dc-legal-notice__actions {
    display: grid;
  }
  .wp360dc-legal-accept,
  .wp360dc-legal-privacy {
    width: 100%;
  }
}

/* v1.4.14 - Compatibilidad de apertura en iframe/widget incrustado */
.wp360dc-chat-ui--iframe.is-open {
  min-height: 680px;
}
.wp360dc-chat-ui--iframe.is-open .wp360dc-panel {
  display: flex !important;
}
.wp360dc-chat-ui--iframe:not(.is-open) {
  min-height: 92px;
}
.wp360dc-chat-ui--iframe:not(.is-open) .wp360dc-panel {
  display: none !important;
}

/* v1.4.15 - Corrección robusta de apertura/cierre en iframe incrustado */
body.wp360dc-iframe-body {
  overflow: hidden !important;
  background: transparent !important;
}

.wp360dc-chat-ui--iframe {
  position: relative !important;
  width: 100% !important;
  height: 92px;
  min-height: 92px;
  max-width: 100% !important;
  overflow: hidden !important;
  background: transparent !important;
}

.wp360dc-chat-ui--iframe.is-open {
  height: 680px;
  min-height: 680px;
}

.wp360dc-chat-ui--iframe .wp360dc-toggle {
  position: absolute !important;
  right: 12px !important;
  bottom: 14px !important;
  z-index: 20 !important;
  display: inline-flex;
}

.wp360dc-chat-ui--iframe.is-open .wp360dc-toggle,
.wp360dc-chat-ui--iframe .wp360dc-toggle[hidden] {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.wp360dc-chat-ui--iframe .wp360dc-panel,
.wp360dc-chat-ui--iframe .wp360dc-panel--iframe {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  border-radius: 18px !important;
  display: none;
  flex-direction: column !important;
  overflow: hidden !important;
  background: #fff !important;
  z-index: 10 !important;
}

.wp360dc-chat-ui--iframe.is-open .wp360dc-panel,
.wp360dc-chat-ui--iframe.is-open .wp360dc-panel--iframe {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.wp360dc-chat-ui--iframe:not(.is-open) .wp360dc-panel,
.wp360dc-chat-ui--iframe:not(.is-open) .wp360dc-panel--iframe {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.wp360dc-chat-ui--iframe .wp360dc-header {
  flex: 0 0 auto !important;
  order: 0 !important;
}

.wp360dc-chat-ui--iframe .wp360dc-legal-notice {
  flex: 0 0 auto !important;
  order: 1 !important;
}

.wp360dc-chat-ui--iframe .wp360dc-messages {
  flex: 1 1 auto !important;
  order: 2 !important;
  min-height: 0 !important;
}

.wp360dc-chat-ui--iframe .wp360dc-form {
  flex: 0 0 auto !important;
  order: 3 !important;
}


/* v1.4.16 - Estado cerrado transparente: solo se muestra el botón circular */
body.wp360dc-iframe-body,
body.wp360dc-iframe-body:not(.wp360dc-is-open) {
  background-color: transparent !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe {
  width: 92px !important;
  height: 92px !important;
  min-height: 92px !important;
  margin-left: auto !important;
  background: transparent !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe .wp360dc-toggle {
  right: 12px !important;
  bottom: 14px !important;
}

body.wp360dc-iframe-body.wp360dc-is-open .wp360dc-chat-ui--iframe {
  width: 100% !important;
}

/* v1.4.18 - Cierre real del widget flotante incrustado: sin pastilla blanca */
body.wp360dc-iframe-body:not(.wp360dc-is-open) {
  background: transparent !important;
  background-color: transparent !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui,
body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe {
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  height: 92px !important;
  min-height: 92px !important;
  max-height: 92px !important;
  margin-left: auto !important;
  margin-right: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe .wp360dc-panel,
body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe .wp360dc-panel--iframe {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  background: transparent !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe .wp360dc-toggle {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  right: 14px !important;
  bottom: 14px !important;
  background: var(--wp360dc-primary) !important;
}

body.wp360dc-iframe-body.wp360dc-is-open .wp360dc-chat-ui,
body.wp360dc-iframe-body.wp360dc-is-open .wp360dc-chat-ui--iframe {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  overflow: hidden !important;
}


/* v1.4.19 - Corrección definitiva del estado cerrado en iframe flotante.
   Objetivo: cero caja blanca, cero segunda burbuja y body interno sin margen. */
body.wp360dc-iframe-body {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  overflow: hidden !important;
}

body.wp360dc-iframe-body .wp360dc-chat-ui--widget {
  display: none !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open),
html:not(.wp360dc-is-open) body.wp360dc-iframe-body {
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  height: 92px !important;
  min-height: 92px !important;
  max-height: 92px !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe {
  position: absolute !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  top: auto !important;
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  height: 92px !important;
  min-height: 92px !important;
  max-height: 92px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe .wp360dc-toggle {
  position: absolute !important;
  right: 14px !important;
  bottom: 14px !important;
  left: auto !important;
  top: auto !important;
  width: 64px !important;
  height: 64px !important;
  min-width: 64px !important;
  min-height: 64px !important;
  margin: 0 !important;
  padding: 0 !important;
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  border-radius: 999px !important;
  background: var(--wp360dc-primary) !important;
  color: var(--wp360dc-primary-text) !important;
  z-index: 50 !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe .wp360dc-panel,
body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe .wp360dc-panel--iframe {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

body.wp360dc-iframe-body.wp360dc-is-open,
html.wp360dc-is-open body.wp360dc-iframe-body {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: none !important;
}

body.wp360dc-iframe-body.wp360dc-is-open .wp360dc-chat-ui--iframe {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
}

/* v1.4.20 - Corrección de fondo forzado por lazy-load/tema en iframe flotante cerrado */
body.wp360dc-iframe-body,
body.wp360dc-iframe-body:not(.wp360dc-is-open) {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  overflow: hidden !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open),
body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-chat-ui--iframe {
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  height: 92px !important;
  min-height: 92px !important;
  max-height: 92px !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border: 0 !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-panel,
body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-panel--iframe {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-toggle {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  background: var(--wp360dc-primary) !important;
}

/* v1.4.52 - Preguntas sugeridas configurables por bot */
.wp360dc-suggested-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px 0;
}

.wp360dc-suggested-question {
  border: 1px solid rgba(0,0,0,.10);
  background: #fff;
  color: var(--wp360dc-bot-text);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
  text-align: left;
}

.wp360dc-suggested-question:hover,
.wp360dc-suggested-question:focus {
  background: color-mix(in srgb, var(--wp360dc-primary) 12%, #fff 88%);
  border-color: var(--wp360dc-primary);
  outline: none;
  transform: translateY(-1px);
}

@supports not (background: color-mix(in srgb, #000 10%, #fff 90%)) {
  .wp360dc-suggested-question:hover,
  .wp360dc-suggested-question:focus {
    background: rgba(36, 219, 255, .10);
  }
}

@media (max-width: 480px) {
  .wp360dc-suggested-questions {
    flex-direction: column;
  }

  .wp360dc-suggested-question {
    width: 100%;
  }
}


/* v1.4.71 - Evita parpadeo/apertura accidental del widget al navegar por pestañas del área de cliente */
.wp360dc-chat-ui--widget:not(.is-open) .wp360dc-panel,
.wp360dc-chat-ui--widget:not(.is-open) .wp360dc-panel[hidden],
.wp360dc-chat-ui--widget.wp360dc-force-closed .wp360dc-panel {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.wp360dc-chat-ui--widget:not(.is-open) .wp360dc-toggle,
.wp360dc-chat-ui--widget.wp360dc-force-closed .wp360dc-toggle {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}


/* v1.4.73 - Burbuja siempre circular y compatible con iconos transparentes */
.wp360dc-toggle,
body.wp360dc-iframe-body:not(.wp360dc-is-open) .wp360dc-toggle {
  border-radius: 999px !important;
  overflow: hidden !important;
  aspect-ratio: 1 / 1;
}
.wp360dc-toggle-icon,
.wp360dc-toggle-icon--custom {
  border-radius: 999px !important;
  overflow: hidden !important;
}
.wp360dc-toggle-custom-icon,
.wp360dc-toggle-icon--custom img {
  border-radius: 999px !important;
  object-fit: contain !important;
}
