/* =========================================================
   ALANA 2.0
   FASE 1 — INTERFAZ RESPONSIVE
   ========================================================= */


/* =========================================================
   FUENTE — MONTSERRAT
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');


/* =========================================================
   RESET
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    font-family: 'Montserrat', Arial, Helvetica, sans-serif;
    background: transparent;
}

button,
input {
    font-family: inherit;
}


/* =========================================================
   BOTÓN FLOTANTE
   ========================================================= */

/* =========================================================
   BARRA FLOTANTE ALANA
   PRESENTACIÓN MINIMIZADA
   ========================================================= */

/* =========================================================
   LANZADOR ALANA — BARRA DESKTOP + MÓVIL
   ========================================================= */

#alana-launcher {
    position: fixed;

    right: 24px;
    bottom: 24px;

    width: 400px;
    height: 72px;

    border: none;
    border-radius: 18px;

    cursor: pointer;

    background: linear-gradient(
        135deg,
        #071a2d 0%,
        #063b68 55%,
        #0879c9 100%
    );

    color: #ffffff;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.25);

    z-index: 999998;

    display: flex;
    align-items: center;

    padding: 10px 12px;

    text-align: left;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

#alana-launcher:hover {
    transform: translateY(-2px);

    box-shadow:
        0 14px 35px rgba(0, 0, 0, 0.30);
}


/* =========================================================
   AVATAR DEL LANZADOR
   ========================================================= */

.alana-launcher-avatar {
    flex: 0 0 50px;

    width: 50px;
    height: 50px;

    border-radius: 50%;

    background: #ffffff;

    color: #0879c9;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 21px;
    font-weight: 800;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.18);
}


/* =========================================================
   INFORMACIÓN
   ========================================================= */

.alana-launcher-info {
    min-width: 0;

    flex: 1;

    margin-left: 12px;

    display: flex;
    flex-direction: column;

    justify-content: center;
}

.alana-launcher-name {
    font-size: 16px;
    font-weight: 700;

    line-height: 1.2;

    color: #ffffff;
}

.alana-launcher-status {
    display: flex;
    align-items: center;

    gap: 6px;

    margin-top: 4px;

    font-size: 11px;
    font-weight: 500;

    color: rgba(255, 255, 255, 0.82);

    white-space: nowrap;
}


/* =========================================================
   INDICADOR ONLINE
   ========================================================= */

.alana-online-dot {
    width: 7px;
    height: 7px;

    flex: 0 0 7px;

    border-radius: 50%;

    background: #35d17b;

    box-shadow:
        0 0 0 3px rgba(53, 209, 123, 0.12);
}


/* =========================================================
   ACCIONES
   ========================================================= */

.alana-launcher-actions {
    flex: 0 0 auto;

    display: flex;
    align-items: center;

    gap: 5px;

    margin-left: 8px;
}

.alana-launcher-action {
    width: 30px;
    height: 30px;

    border-radius: 8px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, 0.10);

    color: #ffffff;

    font-size: 15px;
    font-weight: 500;

    line-height: 1;

    pointer-events: none;
}


/* =========================================================
   CLICK
   ========================================================= */

#alana-launcher:active {

    transform: translateY(0);

}


/* =========================================================
   TABLETS
   ========================================================= */

@media (max-width: 768px) {

    #alana-launcher {

        width: min(
            420px,
            calc(100vw - 32px)
        );

        right: 16px;

        bottom: 16px;

    }

}


/* =========================================================
   CELULARES
   ========================================================= */

@media (max-width: 520px) {
    #alana-launcher {
        right: 12px;
        bottom: 12px;

        width: calc(100vw - 24px);
        max-width: 400px;

        height: 68px;

        padding: 9px 11px;

        border-radius: 17px;
    }

    .alana-launcher-avatar {
        flex-basis: 46px;

        width: 46px;
        height: 46px;

        font-size: 19px;
    }

    .alana-launcher-info {
        margin-left: 10px;
    }

    .alana-launcher-name {
        font-size: 15px;
    }

    .alana-launcher-status {
        font-size: 10px;
    }

    .alana-launcher-actions {
        gap: 4px;
        margin-left: 5px;
    }

    .alana-launcher-action {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

}


/* =========================================================
   CELULARES MUY PEQUEÑOS
   ========================================================= */

@media (max-width: 380px) {
    #alana-launcher {
        right: 8px;
        bottom: 8px;

        width: calc(100vw - 16px);
        max-width: none;

        height: 64px;

        border-radius: 15px;
        padding: 8px 9px;
    }

    .alana-launcher-avatar {
        flex-basis: 43px;
        width: 43px;
        height: 43px;
        font-size: 18px;
    }

    .alana-launcher-info {
        margin-left: 9px;
    }

    .alana-launcher-name {
        font-size: 14px;
    }

    .alana-launcher-status {
        font-size: 9px;
    }

    .alana-launcher-actions {
        gap: 2px;
        margin-left: 4px;
    }

    .alana-launcher-action {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }

}


/* =========================================================
   CONTENEDOR PRINCIPAL
   ========================================================= */

#alana-widget {
    position: fixed;

    right: 24px;
    bottom: 24px;

    width: min(390px, calc(100vw - 30px));

    height: min(620px, calc(100dvh - 40px));

    min-height: 0;

    background: #ffffff;

    border-radius: 18px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.20),
        0 5px 20px rgba(0, 0, 0, 0.10);

    overflow: hidden;

    display: none;
    flex-direction: column;

    z-index: 999999;
}


/* =========================================================
   CABECERA
   ========================================================= */

.alana-header {
    flex: 0 0 auto;

    background: linear-gradient(
        135deg,
        #071a2d 0%,
        #063b68 50%,
        #0879c9 100%
    );

    color: #ffffff;

    padding: 17px 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 76px;
}

.alana-header-left {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 12px;
}

.alana-avatar {
    flex: 0 0 43px;

    width: 43px;
    height: 43px;

    border-radius: 50%;

    background: #ffffff;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #0879c9;

    font-weight: 700;
    font-size: 18px;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.18);
}

.alana-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;

    white-space: nowrap;
}

.alana-status {
    margin-top: 3px;

    font-size: 12px;

    opacity: 0.85;

    white-space: nowrap;
}


/* =========================================================
   ACCIONES DE CABECERA
   ========================================================= */

.alana-header-actions {
    flex: 0 0 auto;

    display: flex;
    align-items: center;

    gap: 5px;
}

.alana-header-btn {
    flex: 0 0 36px;

    width: 36px;
    height: 36px;

    border: none;

    background: rgba(255, 255, 255, 0.10);

    color: #ffffff;

    border-radius: 8px;

    cursor: pointer;

    font-size: 17px;

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.alana-header-btn:hover {
    background: rgba(255, 255, 255, 0.20);
}

.alana-header-btn:active {
    transform: scale(0.95);
}


/* =========================================================
   ÁREA DEL CHAT
   ========================================================= */

.alana-chat {
    flex: 1 1 auto;

    min-height: 0;

    width: 100%;

    padding: 18px;

    overflow-x: hidden;
    overflow-y: auto;

    background:
        linear-gradient(
            rgba(248, 250, 252, 0.96),
            rgba(248, 250, 252, 0.96)
        );

    -webkit-overflow-scrolling: touch;

    overscroll-behavior: contain;

    scrollbar-width: thin;
    scrollbar-color: #ccd6df transparent;
}


/* =========================================================
   SCROLL CHROME / EDGE / SAFARI
   ========================================================= */

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

.alana-chat::-webkit-scrollbar-track {
    background: transparent;
}

.alana-chat::-webkit-scrollbar-thumb {
    background: #ccd6df;
    border-radius: 10px;
}

.alana-chat::-webkit-scrollbar-thumb:hover {
    background: #b8c4ce;
}


/* =========================================================
   MENSAJES
   ========================================================= */

.alana-message {
    display: flex;

    width: 100%;

    margin-bottom: 14px;

    min-width: 0;
}

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

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


/* =========================================================
   BURBUJAS
   ========================================================= */

.alana-bubble {
    max-width: min(82%, 320px);

    padding: 12px 14px;

    border-radius: 14px;

    font-family: inherit;

    font-size: 14px;

    font-weight: 400;

    line-height: 1.45;

    overflow-wrap: anywhere;
    word-break: break-word;
}

.alana-bubble p,
.alana-bubble div,
.alana-bubble span {
    font-size: inherit;
    line-height: inherit;
}

.alana-bubble-transferencia {
    font-size: inherit;
    line-height: inherit;
}


/* BOT */

.alana-message.bot .alana-bubble {
    background: #ffffff;

    color: #25313d;

    border: 1px solid #e6ebef;

    border-top-left-radius: 5px;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.04);
}


/* USUARIO */

.alana-message.user .alana-bubble {
    background: #0879c9;

    color: #ffffff;

    border-top-right-radius: 5px;
}


/* =========================================================
   OPCIONES
   ========================================================= */

.alana-options {
    display: flex;

    flex-direction: column;

    gap: 9px;

    width: 100%;

    margin-top: 12px;
}

.alana-option {
    width: 100%;

    min-height: 44px;

    padding: 12px 14px;

    background: #ffffff;

    border: 1px solid #dce4eb;

    border-radius: 11px;

    color: #17324a;

    text-align: left;

    cursor: pointer;

    font-size: 14px;
    font-weight: 600;

    line-height: 1.35;

    overflow-wrap: anywhere;

    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.alana-option:hover {
    border-color: #0879c9;

    color: #0879c9;

    background: #f5fbff;

    transform: translateY(-1px);
}

.alana-option:active {
    transform: translateY(0);
}


/* =========================================================
   TARJETAS DE PLANES
   ========================================================= */

.alana-plans {
    display: flex;

    flex-direction: column;

    gap: 10px;

    width: 100%;

    margin-top: 12px;
}

.alana-plan {
    width: 100%;

    background: #ffffff;

    border: 1px solid #dce4eb;

    border-radius: 13px;

    padding: 15px;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.alana-plan:hover {
    border-color: #0879c9;

    box-shadow:
        0 5px 18px rgba(8, 121, 201, 0.12);

    transform: translateY(-1px);
}

.alana-plan-name {
    font-size: 15px;

    font-weight: 700;

    color: #17324a;

    overflow-wrap: anywhere;
}

.alana-plan-description {
    margin-top: 4px;

    font-size: 12px;

    font-weight: 400;

    color: #697785;

    line-height: 1.4;

    overflow-wrap: anywhere;
}

.alana-plan-price {
    margin-top: 10px;

    font-size: 18px;

    font-weight: 800;

    color: #0879c9;
}

.alana-plan-period {
    font-size: 11px;

    font-weight: 400;

    color: #71808d;
}

.alana-plan-features {
    margin: 10px 0 0;

    padding: 0;

    list-style: none;
}

.alana-plan-features li {
    font-size: 12px;

    font-weight: 400;

    color: #52616e;

    margin-bottom: 4px;

    line-height: 1.4;

    overflow-wrap: anywhere;
}

.alana-plan-features li::before {
    content: "✓";

    color: #0879c9;

    font-weight: 700;

    margin-right: 6px;
}


/* =========================================================
   INDICADOR DE ESCRITURA
   ========================================================= */

.alana-typing {
    flex: 0 0 auto;

    display: none;

    align-items: center;

    gap: 4px;

    padding: 10px 13px;

    width: fit-content;

    max-width: 90%;

    background: #ffffff;

    border: 1px solid #e6ebef;

    border-radius: 14px;

    border-top-left-radius: 5px;
}

.alana-typing span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #8c9aa6;

    animation: alanaTyping 1.2s infinite;
}

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

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

@keyframes alanaTyping {

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

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


/* =========================================================
   INPUT
   ========================================================= */

.alana-input-area {
    flex: 0 0 auto;

    width: 100%;

    padding: 12px 14px;

    border-top: 1px solid #e6ebef;

    background: #ffffff;

    display: none;
}

.alana-input-wrapper {
    display: flex;

    align-items: center;

    width: 100%;

    gap: 8px;
}

.alana-input {
    flex: 1 1 auto;

    min-width: 0;

    width: 100%;

    height: 42px;

    border: 1px solid #d8e0e7;

    border-radius: 10px;

    padding: 11px 12px;

    font-size: 14px;

    outline: none;

    color: #25313d;

    background: #ffffff;
}

.alana-input::placeholder {
    color: #7d8993;

    opacity: 1;
}

.alana-input:focus {
    border-color: #0879c9;
}

.alana-send {
    flex: 0 0 42px;

    width: 42px;
    height: 42px;

    border: none;

    border-radius: 10px;

    background: #0879c9;

    color: #ffffff;

    cursor: pointer;

    font-size: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.alana-send:hover {
    background: #0669ae;
}

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


/* =========================================================
   FOOTER
   ========================================================= */

.alana-footer {
    flex: 0 0 auto;

    width: 100%;

    text-align: center;

    padding: 7px 10px;

    background: #ffffff;

    color: #9aa6b1;

    font-size: 10px;

    line-height: 1.3;

    border-top: 1px solid #f0f2f4;
}


/* =========================================================
   TABLETS
   ========================================================= */

@media (max-width: 768px) {

    #alana-widget {
        right: 16px;
        bottom: 16px;

        width: min(420px, calc(100vw - 32px));

        height: min(680px, calc(100dvh - 32px));

        border-radius: 17px;
    }

    .alana-chat {
        padding: 16px;
    }

    .alana-bubble {
        max-width: 84%;
    }
}


/* =========================================================
   CELULARES
   ========================================================= */

@media (max-width: 520px) {

    #alana-widget {
        top: 10px;
        right: 10px;
        bottom: 10px;
        left: 10px;

        width: auto;

        height: calc(100dvh - 20px);

        max-height: none;

        border-radius: 15px;
    }

    .alana-header {
        padding: 14px 14px;

        min-height: 70px;
    }

    .alana-avatar {
        flex-basis: 40px;

        width: 40px;
        height: 40px;
    }

    .alana-title {
        font-size: 16px;
    }

    .alana-status {
        font-size: 11px;
    }

    .alana-header-actions {
        gap: 3px;
    }

    .alana-header-btn {
        width: 38px;
        height: 38px;

        flex-basis: 38px;
    }

    .alana-chat {
        padding: 14px;

        min-height: 0;
    }

    .alana-bubble {
        max-width: 88%;

        padding: 11px 13px;

        font-size: 14px;

        line-height: 1.45;
    }

    .alana-option {
        min-height: 46px;

        padding: 12px 13px;

        font-size: 14px;
    }

    .alana-plan {
        padding: 13px;
    }

    .alana-input-area {
        padding:
            10px 10px
            calc(10px + env(safe-area-inset-bottom));
    }

    .alana-input {
        height: 44px;

        font-size: 16px;
    }

    .alana-send {
        flex-basis: 44px;

        width: 44px;
        height: 44px;
    }

    .alana-footer {
        padding:
            7px 10px
            calc(7px + env(safe-area-inset-bottom));
    }}


/* =========================================================
   CELULARES MUY PEQUEÑOS
   ========================================================= */

@media (max-width: 380px) {

    #alana-widget {
        top: 5px;
        right: 5px;
        bottom: 5px;
        left: 5px;

        height: calc(100dvh - 10px);

        border-radius: 12px;
    }

    .alana-header {
        padding: 12px 11px;
    }

    .alana-header-left {
        gap: 9px;
    }

    .alana-avatar {
        flex-basis: 37px;

        width: 37px;
        height: 37px;
    }

    .alana-title {
        font-size: 15px;
    }

    .alana-status {
        font-size: 10px;
    }

    .alana-header-btn {
        width: 35px;
        height: 35px;

        flex-basis: 35px;

        font-size: 16px;
    }

    .alana-chat {
        padding: 11px;
    }

    .alana-bubble {
        max-width: 91%;

        font-size: 13px;
    }

    .alana-option {
        font-size: 13px;
    }
}


/* =========================================================
   PANTALLAS CON POCA ALTURA
   ========================================================= */

@media (max-height: 650px) and (min-width: 521px) {

    #alana-widget {
        height: calc(100dvh - 24px);

        bottom: 12px;
    }

    .alana-header {
        min-height: 64px;

        padding: 11px 14px;
    }

    .alana-chat {
        padding: 13px;
    }

    .alana-bubble {
        padding: 10px 12px;
    }

    .alana-option {
        padding: 10px 12px;
    }
}


/* =========================================================
   ACCESIBILIDAD — REDUCIR ANIMACIONES
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    #alana-launcher,
    .alana-header-btn,
    .alana-option,
    .alana-plan,
    .alana-send {
        transition: none;
    }

    .alana-typing span {
        animation: none;
    }
}


/* =========================================================
   ENLACE — HABLAR CON UN AGENTE
   FASE 2.1
   ========================================================= */

.alana-agent-link {
    flex: 0 0 auto;

    width: 100%;

    padding: 8px 10px 10px;

    background: #ffffff;

    border-top: 1px solid #f0f2f4;

    text-align: center;
}

.alana-agent-button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 7px;

    width: auto;
    max-width: 100%;

    padding: 5px 8px;

    border: none;

    background: transparent;

    color: #777777;

    font-family: inherit;
    font-size: 12px;

    line-height: 1.3;

    cursor: pointer;

    text-align: center;
}

.alana-agent-button:hover {
    color: #555555;
}

.alana-agent-button strong {
    font-weight: 700;
}

.alana-agent-icon {
    width: 16px;
    height: 16px;

    display: block;

    flex: 0 0 20px;
}


/* =========================================================
   MÓVIL
   ========================================================= */

@media (max-width: 520px) {

    .alana-agent-link {
        padding:
            7px 8px
            calc(8px + env(safe-area-inset-bottom));
    }

    .alana-agent-button {
        font-size: 13px;
    }
}