/* cnathia-public.css - Super Professional & Glassmorphism Edition */

:root {
  /* Paleta Premium */
  --cnathia-primary: #0073aa;
  /* Se sobrescribe con JS */
  --cnathia-primary-gradient: linear-gradient(135deg, var(--cnathia-primary), #005a87);
  --cnathia-secondary: #ffffff;
  --cnathia-bg-glass: rgba(255, 255, 255, 0.85);
  --cnathia-header-glass: rgba(255, 255, 255, 0.95);
  /* Header más sólido */
  --cnathia-border-glass: rgba(255, 255, 255, 0.5);
  --cnathia-text-dark: #1f2937;
  --cnathia-text-medium: #4b5563;
  --cnathia-text-light: #9ca3af;
  --cnathia-bot-bg: #f3f4f6;
  --cnathia-user-text: #ffffff;

  /* Sombras y Efectos */
  --cnathia-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --cnathia-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --cnathia-glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --cnathia-blur: blur(12px);

  /* Dimensiones */
  --cnathia-radius-xl: 24px;
  --cnathia-radius-lg: 16px;
  --cnathia-radius-md: 12px;
  --cnathia-spacing: 16px;
}

/* Reset & Base */
.cnathia-chat-window *,
.cnathia-chat-window *:before,
.cnathia-chat-window *:after {
  box-sizing: border-box;
}

/* ===== ICONO FLOTANTE (Floating Action Button) ===== */
.cnathia-chat-icon {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: var(--cnathia-primary-gradient);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 118, 255, 0.39);
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.cnathia-chat-icon:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 118, 255, 0.45);
}

.cnathia-chat-icon svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.1));
}

/* Badge de Notificación */
.cnathia-unread-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 0 4px;
}

/* ===== VENTANA DEL CHAT (Glassmorphism) ===== */
.cnathia-chat-window {
  position: fixed;
  bottom: 100px;
  /* Start position for animation */
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--cnathia-bg-glass);
  backdrop-filter: var(--cnathia-blur);
  -webkit-backdrop-filter: var(--cnathia-blur);
  border-radius: var(--cnathia-radius-xl);
  border: 1px solid var(--cnathia-border-glass);
  box-shadow: var(--cnathia-glass-shadow);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.cnathia-chat-window.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  bottom: 90px;
  /* Final position */
}

/* ===== HEADER ===== */
.cnathia-chat-header {
  background: var(--cnathia-primary-gradient);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 10;
}

.cnathia-avatar-header {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  margin-right: 12px;
  object-fit: cover;
  background: white;
}

.cnathia-header-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 2px;
}

.cnathia-chat-name {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  line-height: 1.2;
}

.cnathia-online-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.95;
  font-weight: 400;
}

.cnathia-status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {

  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
  }
}

.cnathia-close-chat {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.cnathia-close-chat:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== ANIMACIONES DE NOTIFICACIÓN ===== */
.cnathia-pulse-animation {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 4px 14px rgba(0, 118, 255, 0.39);
  }

  50% {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 118, 255, 0.6);
  }
}

.cnathia-shake-animation {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }

  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

/* ===== BODY ===== */
.cnathia-chat-body {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.4);
  /* Subtle tint */
  scroll-behavior: smooth;
}

/* Scrollbar Styling */
.cnathia-chat-body::-webkit-scrollbar {
  width: 6px;
}

.cnathia-chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.cnathia-chat-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

/* Mensajes */
.cnathia-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  animation: messageSlideIn 0.3s ease-out forwards;
}

/* Enlaces dentro de mensajes */
.cnathia-message a,
.cnathia-message .cnathia-link {
  color: #0073aa;
  text-decoration: underline;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.cnathia-message a:hover,
.cnathia-message .cnathia-link:hover {
  color: #005a87;
  text-decoration: none;
}

.cnathia-message.user a,
.cnathia-message.user .cnathia-link {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: underline;
}

.cnathia-message.user a:hover,
.cnathia-message.user .cnathia-link:hover {
  color: white;
  text-decoration: none;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bot Message */
.bot-message-container {
  display: flex;
  align-items: flex-end;
  margin-bottom: 4px;
}

.cnathia-message.bot {
  background: white;
  color: var(--cnathia-text-dark);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.cnathia-message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-right: 8px;
  margin-bottom: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* User Message */
.user-message-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.cnathia-message.user {
  background: var(--cnathia-primary-gradient);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 118, 255, 0.2);
}

/* Metadata */
.cnathia-message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.7;
}

.cnathia-message.user .cnathia-message-meta {
  color: rgba(255, 255, 255, 0.9);
}

/* Typing Indicator */
.cnathia-typing-indicator .cnathia-message {
  padding: 12px;
  min-width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cnathia-typing-indicator span {
  width: 6px;
  height: 6px;
  background: #9ca3af;
  border-radius: 50%;
  display: inline-block;
  margin: 0 2px;
  animation: bounce 1.4s infinite ease-in-out both;
}

.cnathia-typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.cnathia-typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

/* ===== SUGERENCIAS ===== */
.cnathia-suggested-questions {
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(255, 255, 255, 0.6);
}

.cnathia-suggestion {
  background: white;
  border: 1px solid var(--cnathia-primary);
  color: var(--cnathia-primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.cnathia-suggestion:hover {
  background: var(--cnathia-primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* ===== FOOTER & INPUT ===== */
.cnathia-chat-footer {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
}

.cnathia-chat-input {
  flex-grow: 1;
  background: #f3f4f6;
  border: 1px solid transparent;
  border-radius: 24px;
  padding: 12px 16px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
  resize: none;
  max-height: 100px;
}

.cnathia-chat-input:focus {
  background: white;
  border-color: var(--cnathia-primary);
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.cnathia-send-button {
  background: var(--cnathia-primary);
  color: white;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.cnathia-send-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.cnathia-send-button:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  transform: none;
}

/* ===== WHATSAPP BUTTON ===== */
#cnathia-whatsapp-placeholder {
  padding: 0 20px 16px;
  text-align: center;
  display: none;
}

.cnathia-whatsapp-button {
  background: #25D366;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
}

.cnathia-whatsapp-button:hover {
  background: #128C7E;
  transform: translateY(-2px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .cnathia-chat-window {
    width: 100%;
    height: 100%;
    max-height: 100%;
    max-width: 100%;
    bottom: 0 !important;
    right: 0;
    border-radius: 0;
  }

  .cnathia-chat-window.show {
    transform: none;
  }

  .cnathia-chat-icon {
    bottom: 20px;
    right: 20px;
  }
}