/* Livadesk — Widget de Chatbot Web Embebible (Paleta --ld-* + Liva) */
.wl-chat-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: var(--ld-font-body, 'Inter', system-ui, -apple-system, sans-serif);
}

.wl-chat-toggle {
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.48));
  transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.wl-chat-toggle:hover {
  transform: translateY(-2px) scale(1.04);
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.55));
}

.wl-widget-liva {
  display: block;
}

.wl-toggle-idle,
.wl-toggle-open {
  display: flex;
}

.wl-toggle-open,
.wl-chat-panel.is-open ~ .wl-chat-toggle .wl-toggle-idle {
  display: none;
}

.wl-chat-panel.is-open ~ .wl-chat-toggle .wl-toggle-open {
  display: flex;
}

.wl-widget-eye-blink {
  transform-box: fill-box;
  transform-origin: center;
  animation: wlWidgetBlink 5s ease-in-out infinite;
}

@keyframes wlWidgetBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}

.wl-chat-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 490px;
  max-height: calc(100vh - 120px);
  background: var(--ld-bg, #141210);
  border: 1px solid var(--ld-border-strong, #3A352F);
  border-radius: var(--ld-radius-card, 16px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  display: none;
  flex-direction: column;
  overflow: hidden;
  color: var(--ld-text, #F5EFE6);
}

.wl-chat-panel.is-open {
  display: flex;
}

.wl-chat-header {
  padding: 14px 16px;
  background: var(--ld-surface, #1A1816);
  border-bottom: 1px solid var(--ld-border, #2B2722);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wl-chat-title {
  font-weight: 600;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  color: var(--ld-text, #F5EFE6);
}

.wl-chat-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.wl-chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ld-amber, #F5A524);
  flex: none;
}

.wl-chat-close {
  background: transparent;
  border: none;
  color: var(--ld-muted, #B8AFA3);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.wl-chat-close:hover {
  color: var(--ld-text, #F5EFE6);
}

.wl-chat-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wl-chat-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.wl-chat-msg.user {
  align-self: flex-end;
  background: var(--ld-border, #2B2722);
  color: var(--ld-text, #F5EFE6);
  border-bottom-right-radius: 4px;
}

.wl-chat-msg.assistant {
  align-self: flex-start;
  background: var(--ld-amber-soft, #3A2A10);
  border: 1px solid var(--ld-amber-border, #5A4318);
  color: var(--ld-text, #F5EFE6);
  border-bottom-left-radius: 4px;
}

.wl-chat-msg.typing {
  background: var(--ld-surface-2, #1F1C18);
  border-color: var(--ld-border, #2B2722);
  color: var(--ld-muted, #B8AFA3);
  font-style: italic;
}

.wl-chat-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 8px;
  border-top: 1px solid var(--ld-border, #2B2722);
  background: var(--ld-surface, #1A1816);
}

.wl-chat-form-row {
  display: flex;
  gap: 8px;
}

.wl-chat-counter {
  text-align: right;
  font-size: 11px;
  color: var(--ld-muted, #B8AFA3);
  line-height: 1.2;
}

.wl-chat-counter.is-near-limit {
  color: var(--ld-amber-light, #FFD48A);
}

.wl-chat-counter.is-at-limit {
  color: #F87171;
  font-weight: 600;
}

.wl-chat-input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  background: var(--ld-bg, #141210);
  border: 1px solid var(--ld-border-strong, #3A352F);
  border-radius: var(--ld-radius-control, 12px);
  padding: 9px 12px;
  color: var(--ld-text, #F5EFE6);
  font-size: 13.5px;
  outline: none;
}

.wl-chat-input:focus,
.wl-chat-form .wl-chat-input:focus,
.wl-chat-form .wl-chat-input:focus-visible {
  outline: none;
  box-shadow: none;
  border-color: var(--ld-amber, #F5A524);
}

.wl-chat-send {
  background: var(--ld-amber, #F5A524);
  border: none;
  border-radius: var(--ld-radius-control, 12px);
  padding: 0 14px;
  min-height: 40px;
  color: var(--ld-on-amber, #1A1208);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}

.wl-chat-send:hover {
  background: var(--ld-amber-dark, #C97F0A);
}

.wl-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .wl-chat-root {
    right: 14px;
    bottom: 14px;
  }
  .wl-chat-panel {
    width: calc(100vw - 28px);
    height: min(490px, calc(100vh - 100px));
    bottom: 66px;
  }
}

.wl-chat-bubble {
  position: absolute;
  right: 68px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ld-surface, #1A1816);
  color: var(--ld-text, #F5EFE6);
  border: 1px solid var(--ld-amber-border, #5A4318);
  border-radius: 999px;
  padding: 8px 10px 8px 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  animation: wlBubbleIn 0.25s ease-out both;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.wl-chat-bubble[hidden] {
  display: none;
}

.wl-chat-bubble-action {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wl-chat-bubble-action:hover {
  color: var(--ld-amber-light, #FFD48A);
}

.wl-chat-bubble-action:focus-visible,
.wl-chat-bubble-close:focus-visible,
.wl-chat-toggle:focus-visible,
.wl-chat-close:focus-visible {
  outline: 2px solid var(--ld-amber, #F5A524);
  outline-offset: 2px;
}

.wl-chat-bubble-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--ld-border, #2B2722);
  color: var(--ld-text-2, #D6CEC3);
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.wl-chat-bubble-close:hover {
  background: var(--ld-border-strong, #3A352F);
  color: var(--ld-text, #F5EFE6);
}

@keyframes wlBubbleIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 768px) {
  .wl-chat-root.is-contact-overlap .wl-chat-bubble {
    display: none !important;
  }

  .wl-chat-root.is-hero-demo-overlap .wl-chat-toggle {
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
  }

  .wl-chat-root.is-hero-demo-overlap .wl-chat-bubble {
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    animation: none;
  }
}

@media (max-width: 480px) {
  .wl-chat-bubble {
    right: 66px;
    bottom: 8px;
    max-width: calc(100vw - 96px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wl-chat-toggle,
  .wl-widget-eye-blink,
  .wl-chat-bubble {
    animation: none !important;
    transition: none !important;
  }
}


/* Parte IV — Uniforme del negocio, luz del negocio, cabecera neutra, chip Anotado y modo Sobrio */
.wl-chat-root.is-client-brand .wl-chat-panel {
  background-color: #141210;
  background-image: radial-gradient(900px 600px at 50% -10%, var(--negocio-luz, rgba(255, 212, 138, 0.10)), transparent 70%);
  background-repeat: no-repeat;
  border-color: #2B2722;
}
.wl-chat-root.is-client-brand .wl-chat-header {
  background: #1A1816;
  border-bottom: 1px solid #2B2722;
}
.wl-chat-root.is-client-brand .wl-chat-status-dot {
  display: none;
}
.wl-chat-root.is-client-brand .wl-chat-logo svg {
  width: 46px;
  height: 46px;
}
.wl-chat-root.is-client-brand .wl-sober-avatar {
  width: 46px;
  height: 46px;
}
.wl-chat-root.is-client-brand .wl-chat-msg.user {
  background: var(--wl-user-bg, #F5A524);
  color: var(--wl-user-text, #141210);
  border-radius: 16px 16px 4px 16px;
}
.wl-chat-root.is-client-brand .wl-chat-msg.assistant {
  background: #1F1C18;
  border: 1px solid #2B2722;
  border-radius: 16px 16px 16px 4px;
}
.wl-chat-root.is-client-brand .wl-chat-send {
  background: var(--wl-user-bg, #F5A524);
  color: var(--wl-user-text, #141210);
}
.wl-chat-title-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.wl-chat-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: #B8AFA3;
}
.wl-sober-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}
.wl-sober-avatar--lg {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 18px;
}
.wl-noted-chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px dashed #5A4318;
  background: #1E170D;
  color: #FFD48A;
  font-size: 12px;
  font-weight: 500;
}
.wl-chat-footer {
  text-align: center;
  padding: 6px 12px 10px;
  font-size: 11px;
  color: #8C857C;
}
.wl-chat-footer a {
  color: #B8AFA3;
  text-decoration: underline;
}
