body {
  font-family: sans-serif;
  margin: 0;
  padding: 0;
}

/* Botón flotante */
.chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, #4ECDC4, #A8E6CF);
  color: #fff;
  padding: 16px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
  z-index: 10000;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: pulse 2s infinite;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.7);
    transform: scale(1);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(78, 205, 196, 0);
    transform: scale(1.05);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(78, 205, 196, 0);
    transform: scale(1);
  }
}

.chat-toggle:hover {
  transform: scale(1.15) rotate(5deg);
  background: linear-gradient(135deg, #3DB9B1, #4ECDC4);
  box-shadow: 0 8px 25px rgba(78, 205, 196, 0.6);
}

.chat-toggle:active {
  transform: scale(0.95);
}

/* Contenedor de chat - REMOVIDO: ahora se define en la sección de visibilidad */

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header */
.chat-header {
  background: #4ECDC4;
  padding: 20px 15px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  min-height: 20px;
}

.chat-header span#close-btn {
  cursor: pointer;
  font-size: 18px;
  padding: 5px;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
}

.chat-header span#close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Mensajes */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #1e1e1e;
  scroll-behavior: smooth;
}

/* Estilo de scrollbar personalizado */
#messages::-webkit-scrollbar {
  width: 6px;
}

#messages::-webkit-scrollbar-track {
  background: #2a2a2a;
  border-radius: 3px;
}

#messages::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #4ECDC4, #A8E6CF);
  border-radius: 3px;
  transition: background 0.3s ease;
}

#messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #3DB9B1, #4ECDC4);
}

.user-msg, .bot-msg {
  margin: 4px 0;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 85%;
  animation: messageSlideIn 0.6s ease-out;
  position: relative;
  overflow: hidden;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Styling for lists in bot messages */
.bot-msg ul, .bot-msg ol {
  margin: 4px 0;
  padding-left: 20px;
}

.bot-msg li {
  margin: 2px 0;
  line-height: 1.3;
}

.bot-msg p {
  margin: 4px 0;
}

.bot-msg strong {
  font-weight: 600;
  color: #ffffff;
}

.bot-msg em {
  font-style: italic;
  color: #e8e8e8;
}

.user-msg {
  background: linear-gradient(135deg, #4ECDC4, #A8E6CF);
  color: #fff;
  align-self: flex-end;
  margin-left: auto;
  border-radius: 18px 18px 5px 18px;
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
  animation: messageSlideInRight 0.6s ease-out;
}

.bot-msg {
  background: linear-gradient(135deg, #2a2a2a, #3a3a3a);
  color: #e0e0e0;
  align-self: flex-start;
  border-radius: 18px 18px 18px 5px;
  box-shadow: 0 4px 12px rgba(42, 42, 42, 0.5);
  animation: messageSlideInLeft 0.6s ease-out;
  border-left: 3px solid #4ECDC4;
}

@keyframes messageSlideInLeft {
  from {
    transform: translateX(-100%) scale(0.8);
    opacity: 0;
  }
  60% {
    transform: translateX(5px) scale(1.02);
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

@keyframes messageSlideInRight {
  from {
    transform: translateX(100%) scale(0.8);
    opacity: 0;
  }
  60% {
    transform: translateX(-5px) scale(1.02);
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

@keyframes messageSlideIn {
  from {
    transform: translateY(20px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Mensajes del sistema */
.sistema-msg {
  background: #333;
  color: #eee;
  align-self: center;
  margin: 0.8rem auto;
  text-align: center;
  font-weight: 500;
  font-style: normal;
  border: none;
  max-width: 85%;
  border-radius: 20px;
  padding: 1rem 1.5rem;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.sistema-msg::before {
  content: '💬';
  position: absolute;
  top: -5px;
  right: 10px;
  font-size: 1.2rem;
  opacity: 0.6;
}

.sistema-msg.desconexion {
  background: #333;
  color: #eee;
  box-shadow: 0 4px 15px rgba(51, 51, 51, 0.3);
}

.sistema-msg.satisfaccion {
  background: #333;
  color: #eee;
  box-shadow: 0 4px 15px rgba(51, 51, 51, 0.3);
}

/* Área de input */
.input-area {
  display: flex;
  border-top: 1px solid #333;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.input-area input[type="text"] {
  flex: 1;
  padding: 12px 15px;
  border: none;
  background: #1e1e1e;
  color: #fff;
  font-size: 14px;
  transition: all 0.3s ease;
  border-radius: 0;
}

.input-area input[type="text"]:focus {
  outline: none;
  background: #2a2a2a;
  box-shadow: inset 0 0 0 2px rgba(44, 62, 80, 0.3);
}

.input-area input[type="text"]::placeholder {
  color: #888;
  transition: color 0.3s ease;
}

.input-area input[type="text"]:focus::placeholder {
  color: #aaa;
}

.input-area button {
  padding: 12px 18px;
  background: linear-gradient(135deg, #4ECDC4, #A8E6CF);
  border: none;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.input-area button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.input-area button:hover::before {
  width: 100px;
  height: 100px;
}

.input-area button:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #3DB9B1, #4ECDC4);
  box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

.input-area button:active {
  transform: translateY(0);
}

/* Escribiendo */
.typing-indicator {
  font-style: italic;
  color: #bbb;
  padding: 8px 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.typing-indicator::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ECDC4;
  margin-right: 8px;
  animation: typingBounce 1.4s infinite;
}

.typing-indicator::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ECDC4;
  margin: 0 4px;
  animation: typingBounce 1.4s infinite 0.2s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.3;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Header con animación */
.chat-header {
  background: linear-gradient(135deg, #4ECDC4, #A8E6CF);
  padding: 12px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.chat-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: rotate(45deg);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) rotate(45deg);
  }
}

/* Botones con animaciones */
button {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

button:active {
  transform: translateY(0);
}

/* Animación fade mejorada */
@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translateY(15px) scale(0.95);
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1);
  }
}

/* Wrapper especifico para boton de descarga PDF - Más delgado y compacto */
.pdf-download-wrapper {
  margin: 4px 0 !important;
  text-align: center;
  padding: 2px 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  animation: none !important;
  align-self: center !important;
  max-width: none !important;
  width: auto !important;
  display: inline-block !important;
}

.pdf-download-button {
  display: inline-block;
  padding: 8px 16px;
  background: #2C3E50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  min-width: 120px;
  line-height: 1.3;
}

.pdf-download-button:hover {
  background: #1B2631;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.pdf-download-button:active {
  transform: translateY(0);
}

.pdf-download-text {
  font-size: 10px;
  color: #888;
  margin-bottom: 3px;
  line-height: 1.1;
}

/* Nueva clase para wrapper de botón de soporte técnico */
.support-button-wrapper {
  margin: 8px 0 !important;
  text-align: center;
  padding: 8px !important;
  background: rgba(40, 167, 69, 0.1) !important;
  border-radius: 8px !important;
  border: 1px solid rgba(40, 167, 69, 0.2) !important;
  box-shadow: none !important;
  animation: none !important;
  align-self: center !important;
  max-width: 300px !important;
  width: auto !important;
}

/* Nueva clase para el botón de soporte técnico */
.support-button {
  display: inline-block;
  padding: 8px 16px;
  background: linear-gradient(135deg, #28a745, #20963d);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
  min-width: 140px;
  line-height: 1.3;
}

.support-button:hover {
  background: linear-gradient(135deg, #218838, #1d7e33);
  box-shadow: 0 3px 6px rgba(40, 167, 69, 0.4);
  transform: translateY(-1px);
}

.support-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

/* Texto descriptivo para el botón de soporte */
.support-description {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.4;
}

/* Nueva clase para wrapper de botón de soporte técnico */
.support-button-wrapper {
  margin: 8px 0 !important;
  text-align: center;
  padding: 8px !important;
  background: rgba(40, 167, 69, 0.1) !important;
  border-radius: 8px !important;
  border: 1px solid rgba(40, 167, 69, 0.2) !important;
  box-shadow: none !important;
  animation: none !important;
  align-self: center !important;
  max-width: 300px !important;
  width: auto !important;
}

/* Nueva clase para el botón de soporte técnico */
.support-button {
  display: inline-block;
  padding: 8px 16px;
  background: linear-gradient(135deg, #28a745, #20963d);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
  min-width: 140px;
  line-height: 1.3;
}

.support-button:hover {
  background: linear-gradient(135deg, #218838, #1d7e33);
  box-shadow: 0 3px 6px rgba(40, 167, 69, 0.4);
  transform: translateY(-1px);
}

.support-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

/* Texto descriptivo para el botón de soporte */
.support-description {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.4;
}

/* Estados de visibilidad con animaciones suaves */
.chat-container {
  position: fixed;
  bottom: 95px;
  right: 20px;
  width: 380px;
  background: #121212;
  color: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  max-height: 600px;
  z-index: 9999;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-origin: bottom right;
}

.chat-container.hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  visibility: hidden;
}

.chat-container.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.chat-container.closing {
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  pointer-events: none;
}
