/**
 * PaperEase Student Chatbot Styles
 * Estilos para el chatbot asistente virtual de navegación
 */

/* Variables del chatbot */
:root {
  --chatbot-primary: #4D869C;
  --chatbot-secondary: #7AB2B2;
  --chatbot-bg: #ffffff;
  --chatbot-user-bg: #EEF7FF;
  --chatbot-bot-bg: #f3f4f6;
  --chatbot-border: #e5e7eb;
  --chatbot-text: #1f2937;
  --chatbot-text-light: #6b7280;
  --chatbot-shadow: rgba(0, 0, 0, 0.1);
  --chatbot-shadow-lg: rgba(0, 0, 0, 0.15);
}

/* Contenedor principal del chatbot */
.chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Botón flotante para abrir el chatbot */
.chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  border: none;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--chatbot-shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  animation: pulse 2s ease-in-out infinite;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px var(--chatbot-shadow-lg);
}

.chatbot-toggle.hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
}

/* Animación de pulso */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 12px var(--chatbot-shadow-lg);
  }
  50% {
    box-shadow: 0 4px 20px rgba(77, 134, 156, 0.4);
  }
}

/* Ventana del chatbot */
.chatbot-window {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 100px);
  background: var(--chatbot-bg);
  border-radius: 16px;
  box-shadow: 0 8px 32px var(--chatbot-shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateX(100%);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.chatbot-window.open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: all;
}

/* Header del chatbot */
.chatbot-header {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

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

.chatbot-avatar svg {
  width: 20px;
  height: 20px;
}

.chatbot-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.chatbot-status {
  font-size: 12px;
  margin: 4px 0 0 0;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatbot-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chatbot-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

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

/* Área de mensajes */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #fafafa;
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--chatbot-border);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: var(--chatbot-text-light);
}

/* Mensajes individuales */
.chatbot-message {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 85%;
  animation: slideIn 0.3s ease;
}

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

.user-message {
  align-self: flex-end;
  align-items: flex-end;
}

.bot-message {
  align-self: flex-start;
  align-items: flex-start;
}

.message-content {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--chatbot-text);
  word-wrap: break-word;
}

.user-message .message-content {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.bot-message .message-content {
  background: white;
  border: 1px solid var(--chatbot-border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.bot-message .message-content strong {
  color: var(--chatbot-primary);
  font-weight: 600;
}

/* Botones de respuesta rápida */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.quick-reply-btn {
  padding: 8px 14px;
  border: 2px solid var(--chatbot-primary);
  background: white;
  color: var(--chatbot-primary);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.quick-reply-btn:hover {
  background: var(--chatbot-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(77, 134, 156, 0.2);
}

.quick-reply-btn:active {
  transform: translateY(0);
}

/* Área de input */
.chatbot-input-container {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid var(--chatbot-border);
  display: flex;
  gap: 12px;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--chatbot-border);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.chatbot-input:focus {
  border-color: var(--chatbot-primary);
  box-shadow: 0 0 0 3px rgba(77, 134, 156, 0.1);
}

.chatbot-input::placeholder {
  color: var(--chatbot-text-light);
}

.chatbot-send-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(77, 134, 156, 0.3);
}

.chatbot-send-btn:active {
  transform: scale(0.95);
}

/* Responsive Design */
@media (max-width: 480px) {
  .chatbot-container {
    bottom: 10px;
    right: 10px;
  }

  .chatbot-toggle {
    width: 56px;
    height: 56px;
  }

  .chatbot-window {
    bottom: 10px;
    right: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
    border-radius: 12px;
  }

  .chatbot-messages {
    padding: 16px;
  }

  .chatbot-message {
    max-width: 90%;
  }

  .message-content {
    font-size: 13px;
    padding: 10px 14px;
  }

  .quick-reply-btn {
    font-size: 12px;
    padding: 6px 12px;
  }

  .chatbot-input-container {
    padding: 12px 16px;
  }
}

@media (max-width: 360px) {
  .chatbot-title {
    font-size: 15px;
  }

  .chatbot-status {
    font-size: 11px;
  }

  .chatbot-header {
    padding: 14px 16px;
  }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle,
  .chatbot-window,
  .chatbot-message,
  .quick-reply-btn,
  .chatbot-send-btn {
    animation: none;
    transition: none;
  }
}

/* Dark mode support (opcional) */
@media (prefers-color-scheme: dark) {
  :root {
    --chatbot-bg: #1f2937;
    --chatbot-bot-bg: #374151;
    --chatbot-border: #4b5563;
    --chatbot-text: #f9fafb;
    --chatbot-text-light: #9ca3af;
  }

  .chatbot-messages {
    background: #111827;
  }

  .bot-message .message-content {
    background: #374151;
    border-color: #4b5563;
  }

  .quick-reply-btn {
    background: #374151;
    border-color: var(--chatbot-secondary);
    color: white;
  }

  .quick-reply-btn:hover {
    background: var(--chatbot-secondary);
  }

  .chatbot-input {
    background: #374151;
    border-color: #4b5563;
    color: white;
  }

  .chatbot-input::placeholder {
    color: #9ca3af;
  }
}
