/* ==============================================================================
   CHATS SOFCOM - Estilos para WhatsApp y Chatbot
   ============================================================================== */

/* Ocultar chats durante el preloader */
.chatbot-container,
.whatsapp-chat-container {
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s, opacity 0.3s ease;
}

/* Mostrar chats cuando el contenido principal esté listo */
#main-content.loaded ~ .chatbot-container,
#main-content.loaded ~ .whatsapp-chat-container,
body.loaded .chatbot-container,
body.loaded .whatsapp-chat-container {
  visibility: visible;
  opacity: 1;
}

/* ==============================================================================
   WHATSAPP FLOTANTE Y CHAT
   ============================================================================== */
.whatsapp-chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
}

.whatsapp-float {
  position: relative;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #25d366 0%, #20ba5e 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 30px;
  text-decoration: none;
  box-shadow: 0 10px 35px rgba(37, 211, 102, 0.4);
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  animation: floatUp 0.6s ease-out;
}

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

.whatsapp-float:hover {
  transform: scale(1.15) translateY(-5px);
  box-shadow: 0 15px 45px rgba(37, 211, 102, 0.6);
}

.whatsapp-float:active {
  transform: scale(1.05) translateY(-3px);
}

.whatsapp-tooltip {
  position: absolute;
  right: 75px;
  background: rgba(37, 211, 102, 0.95);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.whatsapp-float:hover .whatsapp-tooltip {
  opacity: 1;
}

/* Chat Popup */
.whatsapp-chat {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  max-width: calc(100vw - 20px);
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
}

.whatsapp-chat.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* WhatsApp Header */
.whatsapp-chat .chat-header {
  background: linear-gradient(135deg, #25d366 0%, #20ba5e 100%);
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.whatsapp-chat .chat-header-info img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  padding: 2px;
}

.whatsapp-chat .chat-header-info div {
  display: flex;
  flex-direction: column;
}

.whatsapp-chat .chat-header-info strong {
  color: white;
  font-size: 14px;
}

.whatsapp-chat .chat-header-info span {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
}

.whatsapp-chat .chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.3s;
}

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

/* WhatsApp Body */
.whatsapp-chat .chat-body {
  padding: 15px;
  background: #f5f7f6;
  max-height: 300px;
  overflow-y: auto;
}

.whatsapp-chat .chat-message.bot {
  background: white;
  padding: 12px 15px;
  border-radius: 15px 15px 15px 0;
  margin-bottom: 15px;
  font-size: 14px;
  color: #333;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.whatsapp-chat .chat-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.whatsapp-chat .chat-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border-radius: 10px;
  text-decoration: none;
  color: #333;
  font-size: 13px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.whatsapp-chat .chat-option:hover {
  background: #25d366;
  color: white;
  transform: translateX(5px);
}

.whatsapp-chat .chat-option i {
  font-size: 16px;
  color: #25d366;
}

.whatsapp-chat .chat-option:hover i {
  color: white;
}

.whatsapp-chat .chat-footer {
  padding: 10px 15px;
  background: #fff;
  border-top: 1px solid #eee;
}

.whatsapp-chat .chat-footer span {
  font-size: 11px;
  color: #888;
}

/* ==============================================================================
   CHATBOT HÍBRIDO SOFCOM
   ============================================================================== */
.chatbot-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
}

/* Botón Flotante del Chatbot */
.chatbot-float {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #162290 0%, #2d4a9e 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  box-shadow: 0 10px 35px rgba(22, 34, 144, 0.4);
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  position: relative;
  animation: floatUp 0.6s ease-out;
}

.chatbot-float:hover {
  transform: scale(1.1);
  box-shadow: 0 15px 45px rgba(22, 34, 144, 0.6);
}

.chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e74c3c;
  color: white;
  font-size: 11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Ventana del Chatbot */
.chatbot-window {
  position: absolute;
  bottom: 80px;
  left: 0;
  width: 380px;
  max-width: calc(100vw - 20px);
  height: 500px;
  max-height: calc(100vh - 100px);
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
}

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

/* Header del Chatbot */
.chatbot-header {
  background: linear-gradient(135deg, #162290 0%, #2d4a9e 100%);
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.chatbot-header-info div {
  display: flex;
  flex-direction: column;
}

.chatbot-header-info strong {
  font-size: 14px;
}

.chatbot-header-info span {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: #2ecc71;
  animation: pulse 2s infinite;
}

.status-dot.away {
  background: #f39c12;
}

.status-dot.offline {
  background: #95a5a6;
}

.chatbot-header-actions {
  display: flex;
  gap: 8px;
}

.chatbot-btn-minimize,
.chatbot-btn-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-btn-minimize:hover,
.chatbot-btn-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Body del Chat */
.chatbot-body {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chatbot-message {
  max-width: 85%;
  padding: 12px 15px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.5;
  animation: messageIn 0.3s ease;
}

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

.chatbot-message.bot {
  background: white;
  color: #333;
  border-bottom-left-radius: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  align-self: flex-start;
}

.chatbot-message.user {
  background: #162290;
  color: white;
  border-bottom-right-radius: 3px;
  align-self: flex-end;
}

.chatbot-message .message-time {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 5px;
  text-align: right;
}

/* Opciones del Chatbot */
.chatbot-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.chatbot-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 13px;
  color: #333;
  text-align: left;
}

.chatbot-option:hover {
  background: #f0f4ff;
  border-color: #162290;
  transform: translateX(5px);
}

.chatbot-option .option-number {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: #162290 !important;
  color: white !important;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}

.chatbot-option .option-label {
  font-weight: bold;
  color: #162290;
  margin-right: 2px;
}

.chatbot-option:hover .option-number {
  background: white;
  color: #162290;
}

.chatbot-option i {
  color: #162290;
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* Input Area */
.chatbot-input-area {
  padding: 12px;
  background: white;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  align-items: center;
}

.chatbot-input-area input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 25px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s;
}

.chatbot-input-area input:focus {
  border-color: #162290;
}

.chatbot-send {
  width: 40px;
  height: 40px;
  background: #162290;
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-send:hover {
  background: #2d4a9e;
  transform: scale(1.1);
}

/* Formulario de Transferencia */
.chatbot-transfer-form {
  padding: 15px;
  background: white;
  border-top: 1px solid #eee;
}

.transfer-form-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #162290;
  font-weight: bold;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.transfer-form-header i {
  font-size: 20px;
}

.transfer-form-body p {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
}

.transfer-form-body input,
.transfer-form-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 10px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s;
}

.transfer-form-body input:focus,
.transfer-form-body textarea:focus {
  border-color: #162290;
}

.chatbot-btn-transfer {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #162290 0%, #2d4a9e 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 5px;
}

.chatbot-btn-transfer:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(22, 34, 144, 0.3);
}

.chatbot-btn-cancel {
  width: 100%;
  padding: 10px;
  background: #f5f5f5;
  color: #666;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 8px;
}

.chatbot-btn-cancel:hover {
  background: #eee;
}

/* Typing indicator */
.chatbot-typing {
  display: flex;
  gap: 5px;
  padding: 12px 15px;
  background: white;
  border-radius: 15px 15px 15px 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  width: fit-content;
}

.chatbot-typing span {
  width: 8px;
  height: 8px;
  background: #aaa;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.chatbot-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.chatbot-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

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

/* Quick Replies */
.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chatbot-quick-reply {
  padding: 8px 14px;
  background: #f0f4ff;
  color: #162290;
  border: 1px solid #162290;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.chatbot-quick-reply .qr-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #162290;
  color: white;
  border-radius: 50%;
  font-size: 10px;
  font-weight: bold;
  margin-right: 6px;
}

.chatbot-quick-reply:hover {
  background: #162290;
  color: white;
}

.chatbot-quick-reply:hover .qr-num {
  background: white;
  color: #162290;
}

/* ==============================================================================
   RESPONSIVE
   ============================================================================== */
@media (max-width: 480px) {
  /* WhatsApp */
  .whatsapp-chat-container {
    bottom: 15px;
    right: 15px;
  }
  
  .whatsapp-float {
    width: 55px;
    height: 55px;
    font-size: 26px;
  }
  
  .whatsapp-chat {
    width: calc(100vw - 30px);
    right: -5px;
  }

  /* Chatbot */
  .chatbot-container {
    bottom: 80px;
    left: 15px;
  }
  
  .chatbot-float {
    width: 55px;
    height: 55px;
    font-size: 22px;
  }
  
  .chatbot-window {
    width: calc(100vw - 30px);
    height: 450px;
    max-height: calc(100vh - 120px);
    left: -10px;
  }
}
