/* ============================================================
   gd_copiloto_chat.css - Widget Chat Copiloto (Pure Category Palette)
   Frosted Glass + Acento de Categoria / Lima Vibrante
   ============================================================ */

:root {
  --chat-primary:      var(--gd-rubro, var(--gd-primary, #B5C80F));
  --chat-text:         #0f172a;
  --chat-text-muted:   #64748b;
  --chat-bg:           rgba(255, 255, 255, 0.96);
  --chat-surface:      #f8fafc;
  --chat-border:       rgba(226, 232, 240, 0.8);
  --chat-radius:       20px;
  --chat-width:        335px;
  --chat-height:       475px;
  --chat-z:            9999;
  --chat-btn-size:     52px;
}

/* --- Boton flotante Frosted Glass con Glow Lima --- */
#gd-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--chat-z);
  width: var(--chat-btn-size);
  height: var(--chat-btn-size);
  border-radius: 50%;
  background: var(--chat-blue, #121663);
  border: 2px solid var(--chat-primary);
  box-shadow: 0 8px 25px rgba(18, 22, 99, 0.35), 0 0 12px rgba(181, 200, 15, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(.34,1.56,.64,1);
  color: var(--chat-primary);
  font-size: 20px;
}
#gd-chat-bubble:hover {
  transform: scale(1.1) translateY(-2px);
  background: var(--chat-primary);
  color: var(--chat-blue, #121663);
  box-shadow: 0 12px 30px rgba(181, 200, 15, 0.55);
}

#gd-chat-bubble:hover {
  transform: scale(1.1) translateY(-2px);
  background: var(--chat-primary);
  color: #0f172a;
  box-shadow: 0 12px 30px rgba(181, 200, 15, 0.55);
}

#gd-chat-bubble.open {
  transform: scale(0.92) rotate(90deg);
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

/* Pulso animado sutil */
#gd-chat-bubble::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--chat-primary);
  opacity: 0;
  animation: gd-chat-pulse 2.5s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  pointer-events: none;
}

@keyframes gd-chat-pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  60% { transform: scale(1.28); opacity: 0; }
  100% { transform: scale(1.28); opacity: 0; }
}

#gd-chat-bubble .gd-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  font-size: 10px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

/* --- Ventana del Chat Frosted Glass --- */
#gd-chat-window {
  position: fixed;
  bottom: 86px;
  right: 24px;
  z-index: var(--chat-z);
  width: var(--chat-width);
  height: var(--chat-height);
  background: var(--chat-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--chat-radius);
  box-shadow: 0 20px 45px -10px rgba(18, 22, 99, 0.18), 0 0 0 1px rgba(18, 22, 99, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1.5px solid var(--chat-blue, #121663);
  transform-origin: bottom right;
  transform: scale(0.92) translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1), opacity 0.2s ease;
  font-family: 'Outfit', system-ui, sans-serif;
}

#gd-chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* --- Header Blanco Puro + Acento Lima --- */
#gd-chat-header {
  background: var(--chat-blue, #121663);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 2px solid var(--chat-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gd-chat-avatar {
  width: 38px;
  height: 38px;
  background: var(--chat-primary);
  border: 1.5px solid var(--chat-blue, #121663);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--chat-blue, #121663);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(181, 200, 15, 0.3);
}

.gd-chat-header-info {
  flex: 1;
  min-width: 0;
}

.gd-chat-business-name {
  font-weight: 800;
  font-size: 14px;
  color: var(--chat-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.gd-chat-status {
  font-size: 11px;
  color: #16a34a;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.gd-status-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 6px #22c55e;
  display: inline-block;
}

#gd-chat-close {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  width: 28px;
  height: 28px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#gd-chat-close:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: rotate(90deg);
}

/* --- Area de Mensajes --- */
#gd-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  scroll-behavior: smooth;
  background: #f8fafc;
}

#gd-chat-messages::-webkit-scrollbar { width: 3px; }
#gd-chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Burbujas de Mensaje */
.gd-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: gd-msg-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gd-msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gd-msg.bot { align-self: flex-start; }
.gd-msg.user { align-self: flex-end; }

.gd-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.gd-msg.bot .gd-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.gd-msg.user .gd-msg-bubble {
  background: linear-gradient(135deg, var(--chat-primary) 0%, color-mix(in srgb, var(--chat-primary) 78%, #000) 100%);
  color: #0f172a;
  font-weight: 600;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(181, 200, 15, 0.25);
}

.gd-msg-time {
  font-size: 9.5px;
  color: #94a3b8;
  margin-top: 3px;
  padding: 0 2px;
}
.gd-msg.user .gd-msg-time { text-align: right; }

/* Chips de Accion Rapida */
.gd-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.gd-chat-chip {
  background: #ffffff;
  border: 1.5px solid var(--chat-blue, #121663);
  color: var(--chat-blue, #121663);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.gd-chat-chip:hover {
  background: var(--chat-primary);
  color: #0f172a;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 10px rgba(181, 200, 15, 0.4);
}

/* Typing Indicator */
.gd-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.gd-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--chat-primary);
  border-radius: 50%;
  animation: gd-typing-anim 1.2s ease-in-out infinite;
}

.gd-typing-dot:nth-child(1) { animation-delay: 0s; }
.gd-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.gd-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes gd-typing-anim {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* --- Input Area --- */
#gd-chat-input-area {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

#gd-chat-input {
  flex: 1;
  border: 1.5px solid var(--chat-blue, #121663);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12.5px;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 70px;
  line-height: 1.4;
  transition: all 0.2s ease;
  background: #f8fafc;
  color: #1e293b;
}

#gd-chat-input:focus {
  border-color: var(--chat-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(181, 200, 15, 0.3);
}

#gd-chat-send {
  width: 34px;
  height: 34px;
  background: var(--chat-primary);
  border: 1.5px solid var(--chat-blue, #121663);
  border-radius: 50%;
  color: var(--chat-blue, #121663);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(181, 200, 15, 0.35);
}

#gd-chat-send:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(181, 200, 15, 0.5);
}

#gd-chat-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* --- Footer minimalista --- */
#gd-chat-footer {
  text-align: center;
  font-size: 9.5px;
  color: #94a3b8;
  padding: 4px 0 6px;
  background: #ffffff;
  border-top: 1px solid #f8fafc;
  flex-shrink: 0;
}

#gd-chat-footer a {
  color: #0f172a;
  font-weight: 700;
  text-decoration: none;
}
