/* Widget de chat flutuante — estilo WhatsApp (EDUVE) */
.eduve-chat-widget {
  --eduve-chat-header: #075e54;
  --eduve-chat-header-dark: #128c7e;
  --eduve-chat-bg: #e5ddd5;
  --eduve-chat-in: #ffffff;
  --eduve-chat-out: #d9fdd3;
  --eduve-chat-fab: #25d366;
  --eduve-chat-fab-hover: #20bd5a;
  position: fixed;
  z-index: 1000;
  bottom: 1.25rem;
  right: 1.25rem;
  font-family: var(--font-family-primary, system-ui, sans-serif);
}

.eduve-chat-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.75rem;
  height: 3.75rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--eduve-chat-fab);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.eduve-chat-fab:hover {
  background: var(--eduve-chat-fab-hover);
  transform: scale(1.05);
}

.eduve-chat-fab.is-open {
  transform: scale(0.95);
}

.eduve-chat-fab img {
  width: 1.75rem;
  height: 1.75rem;
  filter: brightness(0) invert(1);
}

.eduve-chat-fab .eduve-chat-fab-close {
  display: none;
  font-size: 1.5rem;
  line-height: 1;
}

.eduve-chat-fab.is-open .eduve-chat-fab-icon {
  display: none;
}

.eduve-chat-fab.is-open .eduve-chat-fab-close {
  display: block;
}

.eduve-chat-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  color: #fff;
  background: #dc3545;
  border: 2px solid #fff;
  border-radius: 999px;
}

.eduve-chat-fab.is-open .eduve-chat-fab-badge {
  display: none;
}

.eduve-chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  display: flex;
  flex-direction: column;
  width: min(100vw - 2rem, 380px);
  max-height: min(70vh, 520px);
  overflow: hidden;
  background: var(--eduve-chat-bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  pointer-events: none;
}

.eduve-chat-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.eduve-chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, var(--eduve-chat-header-dark), var(--eduve-chat-header));
  color: #fff;
}

.eduve-chat-avatar-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
}

.eduve-chat-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.eduve-chat-header-text {
  flex: 1;
  min-width: 0;
}

.eduve-chat-header-text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.eduve-chat-header-text span {
  font-size: 0.75rem;
  opacity: 0.9;
}

.eduve-chat-header-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

.eduve-chat-header-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}

.eduve-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  scroll-behavior: smooth;
}

.eduve-chat-msg {
  max-width: 85%;
  padding: 0.45rem 0.65rem 0.35rem;
  font-size: 0.875rem;
  line-height: 1.4;
  border-radius: 8px;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.08);
  word-wrap: break-word;
}

.eduve-chat-msg--in {
  align-self: flex-start;
  background: var(--eduve-chat-in);
  border-top-left-radius: 0;
}

.eduve-chat-msg--out {
  align-self: flex-end;
  background: var(--eduve-chat-out);
  border-top-right-radius: 0;
}

.eduve-chat-msg time {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  text-align: right;
  opacity: 0.55;
}

.eduve-chat-msg--in time {
  text-align: left;
}

.eduve-chat-msg--action {
  max-width: 92%;
  padding: 0.35rem;
  background: transparent;
  box-shadow: none;
}

.eduve-chat-wa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  text-decoration: none;
  background: var(--eduve-chat-fab);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
  transition: background 0.15s ease, transform 0.15s ease;
}

.eduve-chat-wa-btn:hover {
  color: #fff;
  background: var(--eduve-chat-fab-hover);
  transform: translateY(-1px);
}

.eduve-chat-wa-btn img {
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.eduve-chat-typing {
  align-self: flex-start;
  padding: 0.5rem 0.75rem;
  background: var(--eduve-chat-in);
  border-radius: 8px;
  border-top-left-radius: 0;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.08);
}

.eduve-chat-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 2px;
  background: #8696a0;
  border-radius: 50%;
  animation: eduve-chat-bounce 1.2s infinite ease-in-out;
}

.eduve-chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.eduve-chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes eduve-chat-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.eduve-chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: #f0f2f5;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.eduve-chat-composer input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  line-height: 1.35;
  border: none;
  border-radius: 1.5rem;
  background: #fff;
  outline: none;
}

.eduve-chat-composer input:focus {
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.35);
}

.eduve-chat-composer input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.eduve-chat-send {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--eduve-chat-fab);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.eduve-chat-send:hover:not(:disabled) {
  background: var(--eduve-chat-fab-hover);
}

.eduve-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.eduve-chat-send svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

@media (min-width: 992px) {
  .eduve-chat-widget {
    bottom: 1.5rem;
    right: 1.5rem;
  }
}

.uc-dark .eduve-chat-composer {
  background: #1f2c34;
  border-top-color: rgba(255, 255, 255, 0.06);
}

.uc-dark .eduve-chat-composer input {
  background: #2a3942;
  color: #e9edef;
}

.uc-dark .eduve-chat-panel {
  --eduve-chat-bg: #0b141a;
}

.uc-dark .eduve-chat-msg--in {
  background: #202c33;
  color: #e9edef;
}

.uc-dark .eduve-chat-msg--out {
  background: #005c4b;
  color: #e9edef;
}

.uc-dark .eduve-chat-typing {
  background: #202c33;
}
