/* ================================================================
   CHATBOT SDK — Estilos del widget
   ================================================================ */

/* ── Botón flotante ── */
.cb-float-btn {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a4a1e, #2d7a35);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 990;
    box-shadow: 0 6px 24px rgba(45,122,53,0.5);
    transition: transform 0.3s cubic-bezier(0.34,1.4,0.64,1), box-shadow 0.3s;
    color: white;
}

.cb-float-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: inherit;
    animation: cb-pulse 2.5s ease-out infinite;
}

@keyframes cb-pulse {
    0%   { transform: scale(1); opacity: 0.55; }
    100% { transform: scale(1.75); opacity: 0; }
}

.cb-float-btn:hover { transform: scale(1.1); box-shadow: 0 8px 32px rgba(45,122,53,0.65); }

/* Label IA + icono close */
.cb-ia-label {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: white;
    position: relative;
    z-index: 1;
    line-height: 1;
    transition: opacity 0.2s, transform 0.2s;
}

.cb-icon-close {
    display: none;
    transition: opacity 0.2s, transform 0.2s;
}

.cb-float-btn.cb-active .cb-ia-label  { display: none; }
.cb-float-btn.cb-active .cb-icon-close { display: block; }
.cb-float-btn.cb-active::before        { animation: none; }

.cb-float-btn svg { width: 22px; height: 22px; position: relative; z-index: 1; flex-shrink: 0; }

/* Badge de notificación */
.cb-badge {
    position: absolute;
    top: 0; right: 0;
    width: 18px; height: 18px;
    background: #e07a1f;
    border-radius: 50%;
    border: 2px solid white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    font-family: 'Montserrat', sans-serif;
    z-index: 2;
}

/* ── Ventana del chat ── */
.cb-window {
    position: fixed;
    bottom: 168px;
    right: 28px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 500px;
    max-height: calc(100vh - 200px);
    background: #ffffff;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    z-index: 989;
    box-shadow: 0 16px 60px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34,1.2,0.64,1);
    transform-origin: bottom right;
}

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

/* ── Header ── */
.cb-header {
    background: linear-gradient(135deg, #0c2810, #1a4a1e);
    padding: 16px 18px;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cb-header-info { display: flex; align-items: center; gap: 12px; }

.cb-avatar {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.12);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.cb-bot-name {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700; font-size: 0.88rem;
    color: white; margin-bottom: 2px;
}

.cb-status {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.72rem; color: rgba(255,255,255,0.65);
}

.cb-dot {
    width: 7px; height: 7px;
    border-radius: 50%; background: #4cff4c;
    animation: cb-blink 1.5s ease-in-out infinite;
}

@keyframes cb-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.cb-close-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%; width: 30px; height: 30px;
    cursor: pointer; color: rgba(255,255,255,0.8);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.cb-close-btn:hover { background: rgba(255,255,255,0.2); }

/* ── Mensajes ── */
.cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7faf7;
    scroll-behavior: smooth;
}

.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 2px; }

.cb-msg { display: flex; flex-direction: column; max-width: 82%; }
.cb-msg-user { align-self: flex-end; align-items: flex-end; }
.cb-msg-bot  { align-self: flex-start; align-items: flex-start; }

.cb-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.86rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.cb-msg-user .cb-bubble {
    background: linear-gradient(135deg, #2d7a35, #3d9e45);
    color: white;
    border-bottom-right-radius: 4px;
}

.cb-msg-bot .cb-bubble {
    background: white;
    color: #1a2e1c;
    border: 1px solid #e8ede8;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.cb-ts {
    font-size: 0.68rem;
    color: #9aad9b;
    margin-top: 3px;
    padding: 0 4px;
}

/* Typing dots */
.cb-typing-dots {
    display: flex; align-items: center; gap: 4px;
    padding: 12px 16px;
}
.cb-typing-dots span {
    width: 7px; height: 7px; border-radius: 50%;
    background: #9aad9b;
    animation: cb-dot-bounce 1.2s ease-in-out infinite;
}
.cb-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cb-dot-bounce {
    0%,60%,100% { transform: translateY(0); }
    30%          { transform: translateY(-6px); }
}

/* Quick replies */
.cb-quick-replies {
    display: flex; flex-wrap: wrap; gap: 7px;
    padding: 2px 0 4px;
}

.cb-quick-btn {
    background: white;
    border: 1.5px solid #c5dcc6;
    border-radius: 50px;
    padding: 6px 14px;
    font-size: 0.78rem; font-weight: 600;
    color: #2d7a35; cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}
.cb-quick-btn:hover { background: #edf6ed; border-color: #2d7a35; }

/* WhatsApp button en chat */
.cb-wa-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: #25d366; color: white;
    padding: 9px 16px; border-radius: 50px;
    font-size: 0.82rem; font-weight: 700;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    transition: background 0.2s;
    margin-top: 4px;
    box-shadow: 0 3px 12px rgba(37,211,102,0.35);
}
.cb-wa-btn:hover { background: #1db954; }

/* ── Footer / Input ── */
.cb-footer {
    padding: 12px 14px 10px;
    border-top: 1px solid #e8ede8;
    background: white;
    border-radius: 0 0 20px 20px;
    flex-shrink: 0;
}

.cb-input-row {
    display: flex; align-items: flex-end; gap: 8px;
}

.cb-input {
    flex: 1;
    padding: 9px 13px;
    border: 1.5px solid #dde8de;
    border-radius: 12px;
    font-size: 0.86rem;
    font-family: 'Inter', sans-serif;
    color: #1a2e1c;
    resize: none;
    outline: none;
    line-height: 1.4;
    max-height: 96px;
    overflow-y: auto;
    transition: border-color 0.2s;
    background: #f7faf7;
}
.cb-input:focus { border-color: #2d7a35; background: white; }
.cb-input::placeholder { color: #9aad9b; }

.cb-send-btn {
    width: 38px; height: 38px; flex-shrink: 0;
    background: #e07a1f; border: none; border-radius: 10px;
    color: white; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, transform 0.15s;
}
.cb-send-btn:hover  { background: #c46a10; }
.cb-send-btn:active { transform: scale(0.94); }
.cb-send-btn:disabled { background: #c5dcc6; cursor: not-allowed; }

.cb-footer-note {
    font-size: 0.7rem; color: #9aad9b;
    text-align: center; margin-top: 8px;
}
.cb-wa-link { color: #25d366; text-decoration: none; font-weight: 600; }
.cb-wa-link:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .cb-float-btn { bottom: 88px; right: 16px; width: 50px; height: 50px; }
    .cb-window    { bottom: 155px; right: 16px; width: calc(100vw - 32px); height: 420px; }
}
