/**
 * WP FAQ Chatbot - Estilos
 * Widget flotante de chat con estilos encapsulados
 */

.wp-faq-chatbot-widget {
    --chatbot-primary: #2563eb;
    --chatbot-primary-hover: #1d4ed8;
    --chatbot-bg: #ffffff;
    --chatbot-text: #1f2937;
    --chatbot-text-light: #6b7280;
    --chatbot-border: #e5e7eb;
    --chatbot-user-bg: #2563eb;
    --chatbot-user-text: #ffffff;
    --chatbot-bot-bg: #f3f4f6;
    --chatbot-bot-text: #1f2937;
    --chatbot-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    --chatbot-radius: 12px;

    position: fixed;
    bottom: 90px;
    right: 10px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Toggle Button */
.wp-faq-chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: var(--chatbot-shadow);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.wp-faq-chatbot-toggle:hover {
    background: var(--chatbot-primary-hover);
    transform: scale(1.05);
}

.wp-faq-chatbot-toggle:focus {
    outline: 2px solid var(--chatbot-primary);
    outline-offset: 2px;
}

.wp-faq-chatbot-widget.open .wp-faq-chatbot-toggle {
    display: none;
}

/* Chat Container */
.wp-faq-chatbot-container {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 100px);
    background: var(--chatbot-bg);
    border-radius: var(--chatbot-radius);
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.wp-faq-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--chatbot-primary);
    color: #ffffff;
}

.wp-faq-chatbot-title {
    font-weight: 600;
    font-size: 16px;
}

.wp-faq-chatbot-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

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

/* Messages Container */
.wp-faq-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Bubbles */
.wp-faq-chatbot-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wp-faq-chatbot-message.user {
    align-self: flex-end;
    background: var(--chatbot-user-bg);
    color: var(--chatbot-user-text);
    border-bottom-right-radius: 4px;
}

.wp-faq-chatbot-message.bot {
    align-self: flex-start;
    background: var(--chatbot-bot-bg);
    color: var(--chatbot-bot-text);
    border-bottom-left-radius: 4px;
}

/* Links inside bot messages */
.wp-faq-chatbot-message.bot .wp-faq-chatbot-link {
    color: var(--chatbot-primary);
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.wp-faq-chatbot-message.bot .wp-faq-chatbot-link:hover {
    color: var(--chatbot-primary-hover);
    text-decoration: none;
}

/* Typing Indicator */
.wp-faq-chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--chatbot-bot-bg);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 60px;
}

.wp-faq-chatbot-typing span {
    width: 8px;
    height: 8px;
    background: var(--chatbot-text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.wp-faq-chatbot-typing span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* WhatsApp Button */
.wp-faq-chatbot-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 12px 20px;
    background: #25d366;
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600 !important;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.wp-faq-chatbot-whatsapp-btn:hover {
    background: #128c7e;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
}

.wp-faq-chatbot-whatsapp-btn svg {
    width: 20px;
    height: 20px;
}

/* Input Container */
.wp-faq-chatbot-input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--chatbot-border);
    background: var(--chatbot-bg);
}

.wp-faq-chatbot-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--chatbot-border);
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.4;
    overflow: hidden;
}

.wp-faq-chatbot-input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.wp-faq-chatbot-send {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--chatbot-primary);
    color: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

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

.wp-faq-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Welcome Message */
.wp-faq-chatbot-welcome {
    text-align: center;
    color: var(--chatbot-text-light);
    padding: 20px;
}

.wp-faq-chatbot-welcome h4 {
    color: var(--chatbot-text);
    margin: 0 0 8px 0;
    font-size: 16px;
}

.wp-faq-chatbot-welcome p {
    margin: 0;
    font-size: 13px;
}

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

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

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

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

/* Mobile Responsive */
@media (max-width: 480px) {
    .wp-faq-chatbot-widget {
        bottom: 90px;
        right: 10px;
    }

    .wp-faq-chatbot-container {
        width: calc(100vw - 20px);
        height: calc(80vh);
        max-height: none;
        border-radius: 16px;
    }

    .wp-faq-chatbot-toggle {
        width: 50px;
        height: 50px;
    }
}