/* =========================================================
   Asistente Virtual (chatbot) - Seguro Obligatorio
   ========================================================= */

.cb-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary, #15ACE1), var(--primary, #1363C6));
    box-shadow: 0 6px 20px rgba(19, 99, 198, .45);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    z-index: 99998;
    transition: transform .2s ease, box-shadow .2s ease;
}

.cb-launcher:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 26px rgba(19, 99, 198, .55);
}

.cb-launcher .cb-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff4d4f;
    border: 2px solid #fff;
}

.cb-launcher i.cb-icon-close { display: none; }
.cb-launcher.cb-open i.cb-icon-chat { display: none; }
.cb-launcher.cb-open i.cb-icon-close { display: inline-block; }

.cb-window {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    opacity: 0;
    transform: translateY(16px) scale(.98);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
    font-family: 'Open Sans', sans-serif;
}

.cb-window.cb-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.cb-header {
    background: linear-gradient(135deg, var(--dark, #14183E), #0f2a3d);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cb-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary, #1363C6);
    font-size: 18px;
    flex-shrink: 0;
}

.cb-header-info {
    flex: 1;
    line-height: 1.25;
}

.cb-header-info .cb-title {
    font-weight: 700;
    font-size: 15px;
}

.cb-header-info .cb-status {
    font-size: 12px;
    color: #b7f7c8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cb-header-info .cb-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2ecc71;
    display: inline-block;
}

.cb-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    opacity: .85;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.cb-close:hover { opacity: 1; }

/* Body */
.cb-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f4f7fe;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cb-body::-webkit-scrollbar { width: 6px; }
.cb-body::-webkit-scrollbar-thumb { background: #cdd7ea; border-radius: 3px; }

.cb-msg {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-line;
    animation: cb-fade-in .18s ease;
}

@keyframes cb-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.cb-msg.cb-bot {
    align-self: flex-start;
    background: #eef1f8;
    color: #23283f;
    border-bottom-left-radius: 4px;
}

.cb-msg.cb-user {
    align-self: flex-end;
    background: var(--dark, #14183E);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.cb-msg strong { font-weight: 700; }

.cb-msg.cb-warning {
    background: #fff4e5;
    border: 1px solid #ffdca8;
    color: #8a5a00;
}

/* Typing indicator */
.cb-typing {
    align-self: flex-start;
    background: #eef1f8;
    padding: 10px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.cb-typing span {
    width: 6px;
    height: 6px;
    background: #9aa3bd;
    border-radius: 50%;
    display: inline-block;
    animation: cb-blink 1.2s infinite ease-in-out;
}

.cb-typing span:nth-child(2) { animation-delay: .15s; }
.cb-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes cb-blink {
    0%, 80%, 100% { opacity: .3; transform: scale(.85); }
    40% { opacity: 1; transform: scale(1); }
}

/* Quick reply buttons */
.cb-actions {
    align-self: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 92%;
}

.cb-btn {
    border: none;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease;
}

.cb-btn:hover { transform: translateY(-1px); }

.cb-btn-primary {
    background: #25D366;
    color: #fff;
}

.cb-btn-secondary {
    background: #fff;
    color: #55607a;
    border: 1px solid #d7dcea;
}

.cb-btn-whatsapp {
    background: #25D366;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 10px 18px;
}

/* Footer / input */
.cb-footer {
    border-top: 1px solid #eceff5;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
}

.cb-input {
    flex: 1;
    border: 1px solid #dde2ef;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 13.5px;
    outline: none;
}

.cb-input:focus {
    border-color: var(--secondary, #15ACE1);
}

.cb-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--primary, #1363C6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s ease;
}

.cb-send:hover { background: var(--dark, #14183E); }
.cb-send:disabled { opacity: .5; cursor: not-allowed; }

.cb-hint {
    font-size: 11px;
    color: #9aa3bd;
    text-align: center;
    padding: 4px 0 2px;
    background: #fff;
}

@media (max-width: 420px) {
    .cb-window {
        right: 16px;
        left: 16px;
        width: auto;
        bottom: 90px;
    }
    .cb-launcher { right: 16px; bottom: 16px; }
}
