/* Chatbot Variables - Colores de Candela IA */
:root {
  --chat-primary: #FF4D00; /* Naranja Candela */
  --chat-secondary: #062B3A; /* Azul petróleo oscuro */
  --chat-accent: #D9A441; /* Dorado central */
  --chat-dark: #041C29; /* Azul profundo */
  --chat-light: #F5F5F5; /* Blanco texto secundario */
  --chat-text: #F5F5F5;
  --chat-glass: rgba(6, 43, 58, 0.95);
  --chat-shadow: 0 15px 35px rgba(255, 77, 0, 0.4);
}

/* Floating Widget */
#chatbot-widget {
  position: fixed !important;
  bottom: 30px !important;
  right: 30px !important;
  top: auto !important;
  left: auto !important;
  width: 70px !important;
  height: 70px !important;
  background: #28D7E5 !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 2147483647 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 8px 25px rgba(40, 215, 229, 0.4) !important;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  border: 3px solid #F5F5F5 !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateZ(0) !important;
}

#chatbot-widget svg {
  width: 50%;
  height: 50%;
  fill: #FF4D00;
  filter: drop-shadow(0 2px 4px rgba(255, 77, 0, 0.3));
}

#chatbot-widget .notification-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: #FF4D00;
  border: 2px solid #F5F5F5;
  border-radius: 50%;
  z-index: 10;
}

#chatbot-widget .pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #28D7E5;
  opacity: 0.6;
  animation: chatPulse 2s infinite;
  z-index: -1;
}

#chatbot-widget:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 15px 35px rgba(40, 215, 229, 0.5);
}

@keyframes chatPulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Chat Window */
#chatbot-window {
  position: fixed;
  bottom: 115px;
  right: 30px;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 140px);
  background: var(--chat-glass);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(40, 215, 229, 0.15);
  border-radius: 20px;
  z-index: 999998;
  display: flex;
  flex-direction: column;
  box-shadow: var(--chat-shadow);
  transform: translateY(30px) scale(0.9);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, sans-serif;
  overflow: hidden;
}

#chatbot-window.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

/* Header */
.chat-header {
  padding: 20px;
  background: linear-gradient(135deg, var(--chat-dark), var(--chat-secondary));
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.chat-header::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 0;
  width: 100%;
  height: 15px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.05), transparent);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.chat-header-info .icon-container {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--chat-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.chat-header-info .icon-container svg {
  width: 24px;
  height: 24px;
  fill: var(--chat-primary);
}

.chat-header-info div h4 {
  color: var(--chat-light);
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
}

.chat-header-info div span {
  font-size: 12px;
  color: rgba(245, 245, 245, 0.9);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.chat-header-info div span::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--chat-accent);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 5px rgba(217, 164, 65, 0.8);
}

.chat-actions {
  display: flex;
  gap: 10px;
}

.chat-action-btn {
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  color: #F5F5F5;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: bold;
  font-size: 16px;
}
.chat-action-btn:hover {
  background: rgba(255,255,255,0.3);
  border-color: #FF4D00;
  color: #FF4D00;
  transform: rotate(90deg);
}

.chat-action-btn:hover {
  background: rgba(255,255,255,0.4);
  transform: rotate(90deg);
}

/* Messages Area */
#chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: var(--chat-dark);
  scrollbar-width: thin;
  scrollbar-color: var(--chat-primary) transparent;
}

#chat-messages::-webkit-scrollbar { width: 5px; }
#chat-messages::-webkit-scrollbar-thumb { background: var(--chat-primary); border-radius: 10px; }

.message {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  animation: messageIn 0.3s ease-out forwards;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

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

.message.assistant {
  align-self: flex-start;
  background: var(--chat-secondary);
  color: var(--chat-light);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(40, 215, 229, 0.1);
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-dark));
  color: var(--chat-light);
  border-bottom-right-radius: 4px;
}

/* Input Area */
.chat-input-container {
  padding: 15px 20px;
  background: var(--chat-secondary);
  border-top: 1px solid rgba(40, 215, 229, 0.1);
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--chat-dark);
  border-radius: 24px;
  padding: 6px 15px;
  gap: 10px;
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.chat-input-wrapper:focus-within {
  border-color: var(--chat-primary);
  background: var(--chat-dark);
  box-shadow: 0 0 0 3px rgba(40, 215, 229, 0.1);
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--chat-light);
  font-size: 14px;
  outline: none;
  padding: 10px 0;
}

#chat-input::placeholder {
  color: rgba(245, 245, 245, 0.5);
}

.chat-btn {
  background: transparent;
  border: none;
  color: rgba(245, 245, 245, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 50%;
}

.chat-btn:hover, .chat-btn.active {
  color: var(--chat-primary);
}

.chat-btn.active {
  background: rgba(40, 215, 229, 0.1);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 12px 18px;
  background: var(--chat-secondary);
  border-radius: 18px;
  align-self: flex-start;
  margin-bottom: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

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

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

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}

/* Responsive Chatbot */
@media (max-width: 480px) {
  #chatbot-window {
    width: calc(100vw - 40px);
    height: calc(100vh - 120px);
    right: 20px;
    bottom: 100px;
    left: 20px;
    max-height: none;
  }
  #chatbot-widget {
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
  }
  #chatbot-widget svg {
    width: 40%;
    height: 40%;
  }
}
