.chatbot-wrapper {
    font-family: 'Roboto', sans-serif;
    color: #203449;
}

.chatbot-wrapper .chatbot-contenedor-burbuja {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    z-index: 9999;
}

.chatbot-wrapper .chatbot-globo-texto {
    background: linear-gradient(135deg, #ffffff, #f2f7ff);
    color: #324a64;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(47, 100, 209, 0.16);
    border: 1px solid #e1ebff;
    white-space: nowrap;
    position: relative;
    animation: chatbot-float 2.2s infinite ease-in-out;
}

.chatbot-wrapper .chatbot-globo-texto::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #ffffff, #f2f7ff);
    border-right: 1px solid #e1ebff;
    border-top: 1px solid #e1ebff;
}

.chatbot-wrapper .chatbot-avatar-img {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border: 3px solid white;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.25);
    object-fit: cover;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.chatbot-wrapper .chatbot-contenedor-burbuja:hover .chatbot-avatar-img {
    transform: scale(1.06);
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.3);
}

.chatbot-wrapper .chatbot-ventana {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 360px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    animation: chatbot-appear 0.3s ease;
    border: 1px solid #e8eef8;
}

.chatbot-wrapper .chatbot-ventana.activo {
    display: flex;
}

.chatbot-wrapper .chatbot-header {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: white;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
}

.chatbot-wrapper .chatbot-cerrar {
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.chatbot-wrapper .chatbot-cuerpo {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: linear-gradient(180deg, #f9fbff 0%, #f4f8ff 100%);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-wrapper .mensaje-bot {
    background: #eef4ff;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 8px;
    max-width: 88%;
    font-size: 14px;
    line-height: 1.5;
    color: #35506f;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.chatbot-wrapper .mensaje-bot b,
.chatbot-wrapper .mensaje-bot strong {
    font-weight: 700;
    color: #1f3b5b;
}

.chatbot-wrapper .mensaje-bot i,
.chatbot-wrapper .mensaje-bot em {
    font-style: italic;
}

.chatbot-wrapper .mensaje-bot ul,
.chatbot-wrapper .mensaje-bot ol {
    margin: 8px 0 0;
    padding-left: 20px;
}

.chatbot-wrapper .mensaje-bot li {
    margin-bottom: 4px;
}

.chatbot-wrapper .mensaje-bot li:last-child {
    margin-bottom: 0;
}

.chatbot-wrapper .opciones-contenedor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatbot-wrapper .btn-opcion {
    background-color: white;
    color: #2563eb;
    border: 1px solid #dce7ff;
    padding: 11px 12px;
    border-radius: 12px;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.06);
}

.chatbot-wrapper .btn-opcion:hover {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: white;
    transform: translateY(-1px);
}

.chatbot-wrapper .btn-accion-final {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    font-weight: 700;
    text-align: center;
}

.chatbot-wrapper .btn-accion-final:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.chatbot-wrapper .chatbot-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

.chatbot-wrapper .chatbot-input {
    width: 100%;
    max-width: 100%;
    padding: 12px 14px;
    border: 1px solid #dce7ff;
    border-radius: 999px;
    font-size: 14px;
    color: #35506f;
    background: white;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.06);
    min-height: 44px;
}

.chatbot-wrapper .chatbot-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.chatbot-wrapper .chatbot-reinicio {
    padding: 8px 0;
    font-size: 14px;
    color: #6c757d;
    text-align: center;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.2s ease;
}

.chatbot-wrapper .chatbot-reinicio:hover {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: white;
    transform: translateY(-1px);
}

@keyframes chatbot-appear {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes chatbot-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@media (max-width: 768px) {
    .chatbot-wrapper {
        --chatbot-zona-altura: 90vh;
        --chatbot-zona-altura: 90dvh;
        --chatbot-espacio-inferior: calc(84px + env(safe-area-inset-bottom, 0px));
        --chatbot-margen-lateral: 12px;
    }

    .chatbot-wrapper .chatbot-contenedor-burbuja {
        right: var(--chatbot-margen-lateral);
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        max-width: calc(100vw - (var(--chatbot-margen-lateral) * 2));
    }

    .chatbot-wrapper .chatbot-globo-texto {
        font-size: 15px;
        white-space: normal;
        max-width: calc(100vw - 120px);
    }

    .chatbot-wrapper .chatbot-ventana {
        left: var(--chatbot-margen-lateral);
        right: var(--chatbot-margen-lateral);
        bottom: var(--chatbot-espacio-inferior);
        width: auto;
        max-width: calc(100vw - (var(--chatbot-margen-lateral) * 2));
        height: calc(var(--chatbot-zona-altura) - var(--chatbot-espacio-inferior));
        max-height: calc(var(--chatbot-zona-altura) - var(--chatbot-espacio-inferior));
        box-sizing: border-box;
    }

    .chatbot-wrapper .chatbot-header {
        font-size: 17px;
        padding: 14px 16px;
        flex-shrink: 0;
    }

    .chatbot-wrapper .chatbot-cuerpo {
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chatbot-wrapper .mensaje-bot {
        font-size: 16px;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .chatbot-wrapper .btn-opcion {
        font-size: 16px;
    }

    .chatbot-wrapper .chatbot-input {
        font-size: 16px;
    }

    .chatbot-wrapper .chatbot-reinicio {
        font-size: 16px;
        flex-shrink: 0;
    }
}
