/* Chatbot de Metodologías - Estilos */

/* Botón flotante */
.chatbot-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(35, 115, 186, 0.4);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(35, 115, 186, 0.5);
}

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

/* Notificación de ayuda */
.chatbot-notification {
    position: fixed;
    bottom: 90px;
    right: 2rem;
    width: 280px;
    max-width: calc(100vw - 4rem);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 9997;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 2px solid var(--color-primary);
    overflow: hidden;
}

.chatbot-notification.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
    animation: notificationPulse 2s ease-in-out infinite;
}

@keyframes notificationPulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(35, 115, 186, 0.4);
    }
    50% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 8px rgba(35, 115, 186, 0);
    }
}

.chatbot-notification-content {
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.chatbot-notification-content:hover {
    background: rgba(35, 115, 186, 0.03);
}

.chatbot-notification-text {
    flex: 1;
}

.chatbot-notification-content i.bi-question-circle {
    font-size: 1.5rem;
    color: var(--color-primary);
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.chatbot-notification-content > div {
    flex: 1;
}

.chatbot-notification-content strong {
    display: block;
    color: var(--color-primary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.chatbot-notification-content p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text);
    line-height: 1.4;
}

.chatbot-notification-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.chatbot-notification-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-text);
}

/* Ajustar posición cuando la notificación está visible */
.chatbot-notification.show ~ .chatbot-toggle {
    animation: buttonBounce 0.5s ease;
}

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

/* Ventana del chatbot */
.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 2rem;
    width: 400px;
    max-width: calc(100vw - 2rem);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

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

/* Header del chatbot */
.chatbot-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chatbot-header-content i {
    font-size: 2rem;
}

.chatbot-header-content h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.chatbot-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

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

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

/* Mensajes */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f8f9fa;
}

.chatbot-message {
    display: flex;
    animation: messageSlide 0.3s ease;
}

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

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 0.875rem 1rem;
    border-radius: 16px;
    line-height: 1.5;
}

.user-message .message-content {
    background: var(--color-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: white;
    color: var(--color-text);
    border: 1px solid rgba(35, 115, 186, 0.1);
    border-bottom-left-radius: 4px;
}

.message-content p {
    margin: 0 0 0.5rem 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.message-content li {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Resultados */
.chatbot-results {
    margin-top: 0.5rem;
}

.chatbot-result-item {
    background: #f8f9fa;
    border: 1px solid rgba(35, 115, 186, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.chatbot-result-item h4 {
    margin: 0 0 0.5rem 0;
    color: var(--color-primary);
    font-size: 1rem;
    font-weight: 600;
}

.chatbot-result-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.chatbot-result-details span {
    display: block;
}

.badge-acreditada {
    display: inline-block;
    background: var(--color-success);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.chatbot-more {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--color-primary);
}

.chatbot-more a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
}

/* Resultados en formato de texto legible */
.chatbot-results-text {
    margin-top: 0.5rem;
}

.chatbot-results-text p {
    margin: 0.5rem 0;
    line-height: 1.6;
    color: var(--color-text);
}

.chatbot-results-text p:first-child {
    margin-top: 0;
}

.chatbot-results-text p:last-child {
    margin-bottom: 0;
}

.chatbot-results-text strong {
    color: var(--color-primary);
    font-weight: 600;
}

.chatbot-examples {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0;
}

.chatbot-examples li {
    padding: 0.5rem;
    background: rgba(35, 115, 186, 0.05);
    border-radius: 8px;
    margin: 0.25rem 0;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.chatbot-examples li:hover {
    background: rgba(35, 115, 186, 0.1);
}

/* Input */
.chatbot-input-container {
    border-top: 1px solid rgba(35, 115, 186, 0.1);
    background: white;
    padding: 1rem;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    border: 1px solid rgba(35, 115, 186, 0.2);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: var(--color-primary);
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-send:hover {
    background: var(--color-primary-dark);
    transform: scale(1.05);
}

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

/* Sugerencias */
.chatbot-suggestions {
    display: none;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.chatbot-suggestion {
    background: rgba(35, 115, 186, 0.1);
    border: 1px solid rgba(35, 115, 186, 0.2);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chatbot-suggestion:hover {
    background: rgba(35, 115, 186, 0.2);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    /* Ocultar chatbot cuando el menú móvil está abierto */
    body.no-scroll .chatbot-toggle,
    body.no-scroll .chatbot-window,
    body.no-scroll .chatbot-notification {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    .chatbot-window {
        width: calc(100vw - 1rem);
        right: 0.5rem;
        bottom: 80px;
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
    }

    .chatbot-toggle {
        width: 56px;
        height: 56px;
        bottom: 1rem;
        right: 1rem;
    }

    .chatbot-notification {
        width: calc(100vw - 2rem);
        right: 1rem;
        bottom: 70px;
        max-width: 300px;
    }
}

/* Scrollbar personalizado */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(35, 115, 186, 0.3);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(35, 115, 186, 0.5);
}

