﻿/* =========================================================
 CSS PARA EL CHATBOT DE LA PAGINA DE MEDISOAL
   ========================================================= */

:root {
    --ms-chat-blue: #1239e6;
    --ms-chat-blue-dark: #0b28b8;
    --ms-chat-cyan: #00b8ff;
    --ms-chat-text: #11152f;
    --ms-chat-muted: #6f7485;
    --ms-chat-border: #1a48ff;
    --ms-chat-bg: #ffffff;
    --ms-chat-soft: #f5f6fb;
    --ms-chat-shadow: 0 24px 60px rgba(15, 25, 65, 0.22);
}

/* Contenedor  */
.ms-chatbot {
    position: fixed;
    right: 30px;
    bottom: 24px;
    z-index: 9999;
    font-family: "Poppins", "Open Sans", Arial, sans-serif;
}

/* Botón flotante */
.ms-chatbot-toggle {
    width: 66px;
    height: 66px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: linear-gradient(135deg, var(--ms-chat-blue), var(--ms-chat-cyan));
    box-shadow: 0 18px 40px rgba(0, 100, 255, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

    .ms-chatbot-toggle:hover {
        transform: translateY(-4px) scale(1.03);
        box-shadow: 0 24px 50px rgba(0, 100, 255, 0.42);
    }

    .ms-chatbot-toggle.is-hidden {
        opacity: 0;
        pointer-events: none;
        transform: scale(0.85);
    }

/* Ventana principal */
.ms-chatbot-window {
    position: absolute;
    right: 0;
    bottom: 82px;
    width: 420px;
    max-width: calc(100vw - 36px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--ms-chat-bg);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--ms-chat-shadow);
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px) scale(0.97);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

    .ms-chatbot-window.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
    }

/* Header */
.ms-chatbot-header {
    min-height: 90px;
    padding: 16px 20px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--ms-chat-blue-dark) 0%, var(--ms-chat-blue) 48%, var(--ms-chat-cyan) 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ms-chatbot-brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.ms-chatbot-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}

.ms-chatbot-title h3 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.ms-chatbot-title p {
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.88);
}

.ms-chatbot-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .ms-chatbot-actions button {
        width: 34px;
        height: 34px;
        border: none;
        border-radius: 50%;
        background: transparent;
        color: #ffffff;
        font-size: 28px;
        line-height: 1;
        cursor: pointer;
        display: grid;
        place-items: center;
        transition: background 0.2s ease, transform 0.2s ease;
    }

        .ms-chatbot-actions button:hover {
            background: rgba(255, 255, 255, 0.16);
            transform: scale(1.06);
        }

/* Area de mensajes */
.ms-chatbot-messages {
    flex: 1;
    padding: 18px 20px 10px;
    overflow-y: auto;
    background: radial-gradient(circle at top left, rgba(0, 184, 255, 0.08), transparent 28%), #ffffff;
    scroll-behavior: smooth;
}

    .ms-chatbot-messages::-webkit-scrollbar {
        width: 8px;
    }

    .ms-chatbot-messages::-webkit-scrollbar-track {
        background: transparent;
    }

    .ms-chatbot-messages::-webkit-scrollbar-thumb {
        background: rgba(18, 57, 230, 0.24);
        border-radius: 20px;
    }

/* Filas para los mensajes */
.ms-message-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

    .ms-message-row.user {
        justify-content: flex-end;
    }

    .ms-message-row.bot {
        justify-content: flex-start;
    }

/* Avatar pequeño dentro del chat */
.ms-message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(18, 57, 230, 0.18);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 18px rgba(15, 25, 65, 0.08);
}

/* Burbuja general */
.ms-message-bubble {
    max-width: 82%;
    padding: 12px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
}

.ms-message-row.bot .ms-message-bubble {
    color: var(--ms-chat-text);
    background: #f1f2f7;
    border-top-left-radius: 6px;
}

.ms-message-row.user .ms-message-bubble {
    color: #ffffff;
    background: linear-gradient(135deg, var(--ms-chat-blue), var(--ms-chat-cyan));
    border-top-right-radius: 6px;
}

/* Opciones rápidas */
.ms-chatbot-options {
    display: grid;
    gap: 8px;
    margin: 12px 0 4px 48px;
}

.ms-chatbot-option {
    width: 100%;
    min-height: 44px;
    border: 1.5px solid var(--ms-chat-border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--ms-chat-blue);
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    padding: 9px 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

    .ms-chatbot-option i {
        width: 24px;
        font-size: 19px;
        text-align: center;
    }

    .ms-chatbot-option:hover {
        background: rgba(18, 57, 230, 0.055);
        transform: translateY(-1px);
        box-shadow: 0 10px 24px rgba(18, 57, 230, 0.12);
    }

/* Botones dentro de respuestas */
.ms-chatbot-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.ms-chatbot-inline-btn {
    border: 1px solid var(--ms-chat-blue);
    border-radius: 999px;
    background: #ffffff;
    color: var(--ms-chat-blue);
    padding: 8px 13px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

    .ms-chatbot-inline-btn:hover {
        background: var(--ms-chat-blue);
        color: #ffffff;
    }

/* Footer */
.ms-chatbot-footer {
    padding: 0 16px 12px;
    background: #ffffff;
}

.ms-chatbot-input-area {
    display: flex;
    align-items: stretch;
    border: 1px solid #d8dce8;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 25, 65, 0.06);
}

    .ms-chatbot-input-area input {
        flex: 1;
        min-width: 0;
        border: none;
        outline: none;
        padding: 13px 15px;
        font-size: 14px;
        color: var(--ms-chat-text);
        background: transparent;
    }

        .ms-chatbot-input-area input::placeholder {
            color: #8b90a2;
        }

    .ms-chatbot-input-area button {
        width: 58px;
        border: none;
        background: linear-gradient(135deg, var(--ms-chat-blue), var(--ms-chat-blue-dark));
        color: #ffffff;
        font-size: 21px;
        cursor: pointer;
        transition: filter 0.2s ease, transform 0.2s ease;
    }

        .ms-chatbot-input-area button:hover {
            filter: brightness(1.08);
        }

        .ms-chatbot-input-area button:active {
            transform: scale(0.97);
        }

/* Texto inferior */
.ms-chatbot-security {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--ms-chat-muted);
    font-size: 12px;
}

    .ms-chatbot-security i {
        color: #1686c7;
    }

/* Cápsula robot */

.ms-robot-button {
    position: relative;
    width: 44px;
    height: 58px;
    border-radius: 28px 28px 24px 24px;
    background: radial-gradient(circle at 50% 68%, #ffffff 0 7px, #0f6fe8 8px 10px, transparent 11px), linear-gradient(to bottom, #ffffff 0%, #ffffff 53%, #0f7df2 54%, #0065d8 100%);
    display: inline-flex;
    align-items: flex-start;
    justify-content: center;
    box-shadow: inset 0 5px 10px rgba(255, 255, 255, 0.95), inset 0 -8px 16px rgba(0, 67, 180, 0.24), 0 10px 18px rgba(0, 77, 200, 0.22);
    border: 1px solid rgba(18, 57, 230, 0.14);
    overflow: visible;
}

    /* Brillo de la capsula */
    .ms-robot-button::before {
        content: "";
        position: absolute;
        left: 10px;
        top: 7px;
        width: 16px;
        height: 22px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.45);
        filter: blur(1px);
        pointer-events: none;
    }

    /* Brazos */
    .ms-robot-button::after {
        content: "";
        position: absolute;
        left: -8px;
        right: -8px;
        top: 30px;
        height: 16px;
        background: radial-gradient(circle at left center, #ffffff 0 4px, #0f7df2 5px 7px, transparent 8px), radial-gradient(circle at right center, #ffffff 0 4px, #0f7df2 5px 7px, transparent 8px);
        pointer-events: none;
    }

.ms-robot-button-small {
    width: 31px;
    height: 40px;
    border-radius: 20px 20px 18px 18px;
    background: radial-gradient(circle at 50% 69%, #ffffff 0 5px, #0f6fe8 6px 8px, transparent 9px), linear-gradient(to bottom, #ffffff 0%, #ffffff 53%, #0f7df2 54%, #0065d8 100%);
    box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.9), inset 0 -6px 12px rgba(0, 67, 180, 0.22), 0 6px 12px rgba(0, 77, 200, 0.16);
}

    .ms-robot-button-small::before {
        left: 7px;
        top: 5px;
        width: 11px;
        height: 15px;
    }

    .ms-robot-button-small::after {
        left: -5px;
        right: -5px;
        top: 21px;
        height: 12px;
        background: radial-gradient(circle at left center, #ffffff 0 3px, #0f7df2 4px 5px, transparent 6px), radial-gradient(circle at right center, #ffffff 0 3px, #0f7df2 4px 5px, transparent 6px);
    }

/* Antena */
.ms-robot-antenna {
    position: absolute;
    top: -14px;
    left: 50%;
    width: 3px;
    height: 14px;
    background: #0f7df2;
    transform: translateX(-50%);
    border-radius: 999px;
    box-shadow: 0 0 8px rgba(0, 184, 255, 0.5);
}

    .ms-robot-antenna::before {
        content: "";
        position: absolute;
        top: -8px;
        left: 50%;
        width: 11px;
        height: 11px;
        border-radius: 50%;
        transform: translateX(-50%);
        background: linear-gradient(135deg, #0f7df2, #00b8ff);
        box-shadow: 0 0 10px rgba(0, 184, 255, 0.75);
    }

.ms-robot-button-small .ms-robot-antenna {
    display: none;
}

.ms-robot-face {
    position: absolute;
    top: 14px;
    left: 50%;
    width: 32px;
    height: 17px;
    border-radius: 999px;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #071a60, #062a8f);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-shadow: inset 0 0 8px rgba(0, 184, 255, 0.45), 0 3px 8px rgba(0, 48, 150, 0.18);
}

/* Ojos */
.ms-robot-eye {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #63f4ff;
    box-shadow: 0 0 8px rgba(99, 244, 255, 0.95);
}

.ms-robot-button-small .ms-robot-face {
    top: 10px;
    width: 24px;
    height: 13px;
    gap: 5px;
}

.ms-robot-button-small .ms-robot-eye {
    width: 4.5px;
    height: 4.5px;
}

/* Cápsula en el botón flotante */
.ms-chatbot-toggle .ms-robot-button {
    transform: scale(0.95);
}

/* Cápsula en el header */
.ms-chatbot-avatar .ms-robot-button {
    transform: scale(0.92);
}

/* Cápsula dentro de burbujas */
.ms-message-avatar .ms-robot-button {
    transform: scale(0.82);
}

/* Aparece cuando alguien esta escribiendo */
.ms-typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

    .ms-typing span {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #8d93a8;
        animation: msTyping 1s infinite ease-in-out;
    }

        .ms-typing span:nth-child(2) {
            animation-delay: 0.12s;
        }

        .ms-typing span:nth-child(3) {
            animation-delay: 0.24s;
        }

@keyframes msTyping {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Formulario d pase a asesor */
.ms-handoff-form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

    .ms-handoff-form input,
    .ms-handoff-form textarea,
    .ms-handoff-form select {
        width: 100%;
        border: 1px solid #d8dce8;
        border-radius: 10px;
        padding: 11px 12px;
        font-size: 14px;
        color: var(--ms-chat-text);
        outline: none;
        background: #ffffff;
    }

    .ms-handoff-form textarea {
        min-height: 78px;
        resize: vertical;
    }

        .ms-handoff-form input:focus,
        .ms-handoff-form textarea:focus,
        .ms-handoff-form select:focus {
            border-color: var(--ms-chat-blue);
            box-shadow: 0 0 0 3px rgba(18, 57, 230, 0.1);
        }

    .ms-handoff-form button {
        border: none;
        border-radius: 10px;
        padding: 12px 14px;
        background: linear-gradient(135deg, var(--ms-chat-blue), var(--ms-chat-cyan));
        color: #ffffff;
        font-weight: 600;
        cursor: pointer;
    }

/* Enlaces dentro del chat */
.ms-message-bubble a {
    color: var(--ms-chat-blue);
    font-weight: 600;
    text-decoration: none;
}

    .ms-message-bubble a:hover {
        text-decoration: underline;
    }

/* Responsive tablet */
@media (max-width: 768px) {
    .ms-chatbot {
        right: 18px;
        bottom: 18px;
    }

    .ms-chatbot-window {
        width: 410px;
        height: 560px;
        bottom: 82px;
    }

    .ms-chatbot-header {
        padding: 22px;
    }

    .ms-chatbot-title h3 {
        font-size: 18px;
    }

    .ms-chatbot-title p {
        font-size: 14px;
    }
}

/* Responsive celular */
@media (max-width: 575.98px) {
    .ms-chatbot {
        right: 14px;
        bottom: 14px;
        left: 14px;
    }

    .ms-chatbot-toggle {
        margin-left: auto;
        width: 62px;
        height: 62px;
    }

    .ms-chatbot-window {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 82px;
        width: auto;
        height: min(560px, calc(100vh - 104px));
        max-width: none;
        max-height: none;
        border-radius: 20px;
    }

    .ms-chatbot-header {
        min-height: 88px;
        padding: 14px 16px;
    }

    .ms-chatbot-avatar {
        width: 50px;
        height: 50px;
    }

    .ms-chatbot-brand {
        gap: 12px;
    }

    .ms-chatbot-title h3 {
        font-size: 17px;
    }

    .ms-chatbot-title p {
        font-size: 13px;
    }

    .ms-chatbot-actions button {
        width: 30px;
        height: 30px;
        font-size: 24px;
    }

    .ms-chatbot-messages {
        padding: 22px 16px 14px;
    }

    .ms-message-bubble {
        max-width: 82%;
        font-size: 14px;
        padding: 13px 15px;
    }

    .ms-chatbot-options {
        margin-left: 0;
    }

    .ms-chatbot-option {
        min-height: 54px;
        font-size: 14px;
        padding: 12px 14px;
    }

    .ms-chatbot-footer {
        padding: 0 14px 14px;
    }

    .ms-chatbot-input-area input {
        padding: 15px 14px;
        font-size: 14px;
    }

    .ms-chatbot-input-area button {
        width: 58px;
    }

    .ms-chatbot-security {
        font-size: 11.5px;
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}

/* Celulares muy pequeños */
@media (max-width: 380px) {
    .ms-chatbot-title h3 {
        font-size: 15px;
    }

    .ms-chatbot-title p {
        font-size: 12px;
    }

    .ms-chatbot-avatar {
        width: 54px;
        height: 54px;
    }

    .ms-message-bubble {
        max-width: 86%;
    }
}

/* Pequeña correcion para el header de la ventana del robot */
.ms-chatbot-window {
    padding-top: 0 !important;
}

    .ms-chatbot-window > .ms-chatbot-header {
        margin-top: 0 !important;
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        flex-shrink: 0;
    }

/* CSS con SweetAlert para el recuadro de solicitud */
.ms-swal-popup {
    border-radius: 22px !important;
    padding: 28px 26px !important;
    font-family: "Poppins", "Open Sans", Arial, sans-serif !important;
    box-shadow: 0 24px 60px rgba(15, 25, 65, 0.24) !important;
}

.ms-swal-confirm {
    background: linear-gradient(135deg, #1239e6, #00b8ff) !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 10px 28px !important;
    font-weight: 700 !important;
    box-shadow: 0 10px 24px rgba(18, 57, 230, 0.22) !important;
}

.swal2-container {
    z-index: 20000 !important;
}

    .swal2-container.swal2-center {
        align-items: center !important;
        justify-content: center !important;
    }

/* =========================================================
   Ajuste de la capsula dentro del chat para los clientes.
   ========================================================= */

.ms-message-avatar {
    width: 48px;
    height: 58px;
    min-width: 48px;
    border-radius: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    overflow: visible;
    margin-top: 2px;
}

    /* Cápsula cuerpo completo */
    .ms-message-avatar .ms-robot-button-small {
        width: 34px;
        height: 48px;
        border-radius: 22px 22px 18px 18px;
        transform: none;
        background: radial-gradient(circle at 50% 69%, #ffffff 0 5px, #0f6fe8 6px 8px, transparent 9px), linear-gradient(to bottom, #ffffff 0%, #ffffff 53%, #0f7df2 54%, #0065d8 100%);
        box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.95), inset 0 -7px 13px rgba(0, 67, 180, 0.25), 0 8px 16px rgba(0, 77, 200, 0.16);
    }

        .ms-message-avatar .ms-robot-button-small .ms-robot-face {
            top: 11px;
            width: 26px;
            height: 14px;
            gap: 5px;
        }

        .ms-message-avatar .ms-robot-button-small .ms-robot-eye {
            width: 4.8px;
            height: 4.8px;
        }

        .ms-message-avatar .ms-robot-button-small::after {
            left: -8px;
            right: -8px;
            top: 24px;
            height: 13px;
            background: radial-gradient(circle at left center, #ffffff 0 3px, #0f7df2 4px 5px, transparent 6px), radial-gradient(circle at right center, #ffffff 0 3px, #0f7df2 4px 5px, transparent 6px);
        }

    .ms-message-avatar::before {
        content: "";
        position: absolute;
        top: -7px;
        left: 50%;
        width: 3px;
        height: 10px;
        background: #0f7df2;
        border-radius: 999px;
        transform: translateX(-50%);
        box-shadow: 0 0 8px rgba(0, 184, 255, 0.55);
    }

    .ms-message-avatar::after {
        content: "";
        position: absolute;
        top: -14px;
        left: 50%;
        width: 9px;
        height: 9px;
        border-radius: 50%;
        transform: translateX(-50%);
        background: linear-gradient(135deg, #0f7df2, #00b8ff);
        box-shadow: 0 0 10px rgba(0, 184, 255, 0.75);
    }

    .ms-message-avatar .ms-robot-button-small {
        position: relative;
    }

        .ms-message-avatar .ms-robot-button-small > .ms-robot-face::before,
        .ms-message-avatar .ms-robot-button-small > .ms-robot-face::after {
            content: "";
            position: absolute;
            bottom: -28px;
            width: 8px;
            height: 5px;
            border-radius: 8px;
            background: #ffffff;
            border: 1px solid rgba(15, 111, 232, 0.45);
            box-shadow: 0 2px 5px rgba(0, 77, 200, 0.16);
        }

        .ms-message-avatar .ms-robot-button-small > .ms-robot-face::before {
            left: 4px;
        }

        .ms-message-avatar .ms-robot-button-small > .ms-robot-face::after {
            right: 4px;
        }
