/* =========================================================
   CHATBOT WIDGET — Publigo México
   Usa las mismas variables de color definidas en style.css
   ========================================================= */

.pg-chat-toggle {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background-color: var(--primary-color, #ffb703);
  color: var(--bg-dark, #06122c);
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 999;
  transition: transform 0.25s ease, background-color 0.25s ease;
  animation: pgPulse 2.5s ease-in-out infinite;
}

.pg-chat-toggle:hover {
  background-color: var(--primary-color-dark, #e6a300);
  transform: scale(1.06);
}

.pg-chat-toggle i {
  pointer-events: none;
}

@keyframes pgPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 rgba(255, 183, 3, 0.5); }
  50%      { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 18px rgba(255, 183, 3, 0.65); }
}

.pg-chat-window {
  position: fixed;
  bottom: 6rem;
  right: 1.75rem;
  width: min(340px, calc(100vw - 2rem));
  max-height: min(520px, calc(100vh - 8rem));
  background-color: var(--bg-dark-alt, #0a1a3f);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.pg-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.pg-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background-color: var(--bg-light, #10275c);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pg-chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pg-chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--primary-color, #ffb703);
  color: var(--bg-dark, #06122c);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.pg-chat-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white, #fff);
  margin: 0;
}

.pg-chat-header span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-light, #c3d0f0);
}

.pg-chat-close {
  background: none;
  border: none;
  color: var(--text-light, #c3d0f0);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.pg-chat-close:hover {
  color: var(--primary-color, #ffb703);
}

.pg-chat-messages {
  flex: 1;
  padding: 1rem 1rem 0.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  scrollbar-width: thin;
}

.pg-chat-messages::-webkit-scrollbar {
  width: 6px;
}
.pg-chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.pg-msg {
  max-width: 82%;
  padding: 0.6rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  line-height: 1.4;
  animation: pgFadeIn 0.25s ease both;
}

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

.pg-msg.bot {
  align-self: flex-start;
  background-color: var(--extra-light, #12245a);
  color: var(--white, #fff);
  border-bottom-left-radius: 0.25rem;
}

.pg-msg.user {
  align-self: flex-end;
  background-color: var(--primary-color, #ffb703);
  color: var(--bg-dark, #06122c);
  font-weight: 600;
  border-bottom-right-radius: 0.25rem;
}

.pg-chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 0.6rem 0.85rem;
  background-color: var(--extra-light, #12245a);
  border-radius: 1rem;
  border-bottom-left-radius: 0.25rem;
}

.pg-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-light, #c3d0f0);
  animation: pgTyping 1s infinite ease-in-out;
}

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

@keyframes pgTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.pg-chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1rem 0.75rem;
}

.pg-chat-quick-replies button {
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary-color, #ffb703);
  background-color: transparent;
  border: 1px solid var(--primary-color, #ffb703);
  border-radius: 5rem;
  cursor: pointer;
  transition: 0.2s;
}

.pg-chat-quick-replies button:hover {
  background-color: var(--primary-color, #ffb703);
  color: var(--bg-dark, #06122c);
}

.pg-chat-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background-color: var(--bg-dark-alt, #0a1a3f);
}

.pg-chat-input-row input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-dark, #fff);
  background-color: var(--bg-dark, #06122c);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5rem;
  outline: none;
}

.pg-chat-input-row input:focus {
  border-color: var(--primary-color, #ffb703);
}

.pg-chat-input-row input::placeholder {
  color: var(--text-light, #c3d0f0);
}

.pg-chat-send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background-color: var(--primary-color, #ffb703);
  color: var(--bg-dark, #06122c);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
}

.pg-chat-send:hover {
  background-color: var(--primary-color-dark, #e6a300);
}

.pg-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 420px) {
  .pg-chat-window {
    right: 1rem;
    left: 1rem;
    width: auto;
    bottom: 5.5rem;
  }
  .pg-chat-toggle {
    right: 1.25rem;
    bottom: 1.25rem;
  }
}
