/* ========================================================================= */
/* --- ESTILOS ESPECÍFICOS DEL CHATBOT --- */
/* ========================================================================= */
:root {
    --chat-primary: #5a5df0;
    --chat-secondary: #141726;
    --chat-accent: #f7b733;
    --chat-surface: rgba(13, 16, 32, 0.92);
    --chat-border: rgba(255, 255, 255, 0.08);
}

#chatbot-container {
    position: fixed;
    bottom: clamp(1rem, 2vw, 2.5rem);
    right: clamp(1rem, 2vw, 2.5rem);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    pointer-events: none;
    /* Let clicks pass through the container area */
}

#chatbot-container>* {
    pointer-events: auto;
    /* Re-enable clicks on children */
}



#chat-window {
    width: min(400px, 90vw);
    height: min(560px, 80vh);
    border-radius: 24px;
    overflow: hidden;
    display: none;
    background: #fff;
    border: 1px solid var(--chat-border);
    box-shadow: 0 30px 60px rgba(15, 18, 36, 0.45);
    /*! backdrop-filter: blur(16px); */
    color: #214a6f;
    pointer-events: auto;
}

#scrollToTop {
    bottom: calc(clamp(1rem, 2vw, 2.5rem) + 6rem);
    right: clamp(1rem, 2vw, 2.5rem);
    z-index: 2000;
}

.chat-header {
    padding: 1.25rem 1.5rem;
    background: #214a6f;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-identity {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 1px;
}

.chat-title {
    font-weight: 700;
    letter-spacing: 0.2px;
}

.chat-status {
    font-size: 0.8rem;
    color: rgba(248, 250, 252, 0.8);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.75);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chat-subheader {
    padding: 1.25rem 1.5rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-subtitle {
    font-size: 0.95rem;
    color: rgba(248, 250, 252, 0.8);
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chat-suggestion {
    border: none;
    background: rgba(90, 93, 240, 0.15);
    color: #f8fafc;
    padding: 0.4rem 0.9rem;
    font-size: 0.75rem;
    border-radius: 999px;
    transition: all 0.2s ease;
}

.chat-suggestion:hover {
    background: rgba(90, 93, 240, 0.3);
}

.chat-main {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: radial-gradient(circle at top, rgba(90, 93, 240, 0.12), transparent 50%);
}

.chat-main::-webkit-scrollbar {
    width: 6px;
}

.chat-main::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
}

.bot-message-wrapper,
.user-message-wrapper {
    margin-bottom: 1.2rem;
    display: flex;
}

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

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

.bot-message,
.user-message {
    border-radius: 18px;
    padding: 0.95rem 1.15rem;
    font-size: 0.92rem;
    line-height: 1.45;
    max-width: 85%;
    box-shadow: 0 5px 5px rgba(12, 12, 15, 0.35);
}

.bot-message {
    /*! background: rgb(121, 131, 250); */
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-message {
    /*! background: linear-gradient(135deg, #5a5df0, #9b7bff); */
    /*! border: none; */
}

.source-link {
    font-size: 0.75rem;
    color: #b1c5ff;
    display: inline-block;
    margin-top: 0.35rem;
}

.loading-bubble {
    background: rgba(15, 23, 42, 0.4);
}

.chat-footer {
    padding: 1.1rem 1.5rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: #214a6f;
}

.chat-form {
    width: 100%;
}

.chat-form .form-control {
    background: rgba(15, 18, 36, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    color: #f8fafc;
    padding: 0.85rem 1rem;
}

.chat-form .form-control::placeholder {
    color: rgba(248, 250, 252, 0.4);
}

.chat-form .btn {
    border-radius: 16px;
    background: #fff;
    border: none;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /*! box-shadow: #000000; */
}

#toggle-chat-button {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    border: none;
    /*! background: linear-gradient(135deg, #5a5df0, #8f74ff); */
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 25px 40px rgba(20, 18, 51, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: auto;
}

#toggle-chat-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 25px 45px rgba(20, 18, 51, 0.5);
}

#toggle-chat-button::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.35);
    pointer-events: none;
    animation: chatbotPulse 2s infinite ease-in-out;
}

@keyframes chatbotPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.15);
        opacity: 0;
    }
}

.chat-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
}

.chat-icon::before {
    content: "";
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.chat-icon-open::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23ffffff' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 1 0 7.25 11.162.5.5 0 0 0-.694-.598A5.5 5.5 0 0 1 8 13.5c-.856 0-1.667-.178-2.387-.496l-.21-.093-.193.121-1.882 1.178.376-2.103.056-.314-.234-.21A5.5 5.5 0 0 1 2.5 8 5.5 5.5 0 0 1 8 2.5 5.5 5.5 0 0 1 13.5 8a.5.5 0 0 0 1 0A6.5 6.5 0 0 0 8 1.5 6.5 6.5 0 0 0 1.5 8c0 1.247.332 2.415.905 3.43l-.417 2.333a1 1 0 0 0 1.496 1.054l2.087-1.305A6.5 6.5 0 0 0 8 14.5a6.5 6.5 0 0 0 5.687-3.242A8 8 0 0 0 8 0Z'/%3E%3Ccircle cx='5.5' cy='7.5' r='1'/%3E%3Ccircle cx='8' cy='7.5' r='1'/%3E%3Ccircle cx='10.5' cy='7.5' r='1'/%3E%3C/svg%3E");
}

.chat-icon-close::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23ffffff' viewBox='0 0 16 16'%3E%3Cpath d='M2.146.854a.5.5 0 1 1 .708-.708L8 5.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 6l5.147 5.146a.5.5 0 0 1-.708.708L8 6.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 6 2.146.854Z'/%3E%3C/svg%3E");
}

.dot-flashing {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    animation: dot-flashing 1s infinite linear alternate;
}

.dot-flashing::before,
.dot-flashing::after {
    content: "";
    position: absolute;
    top: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    animation: dot-flashing 1s infinite linear alternate;
}

.dot-flashing::before {
    left: -12px;
    animation-delay: 0.2s;
}

.dot-flashing::after {
    left: 12px;
    animation-delay: 0.4s;
}

@keyframes dot-flashing {
    0% {
        opacity: 0.2;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.2;
    }
}