/* ================================================
   CHATBOT — chatbot.css
   Variables heredadas de estilos.css del sitio:
   --aubergine, --gold, --gold-2, --ivory,
   --lavender-2, --muted, --line, --serif, --sans
   ================================================ */

/* Burbuja flotante */
#cb-bubble {
    position: fixed;
    bottom: 88px;
    right: 24px;
    z-index: 9000;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--aubergine);
    color: var(--gold-2, #d4b896);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0,0,0,.22);
    transition: transform .2s, box-shadow .2s, opacity .2s;
    border: none;
}
#cb-bubble svg { width: 26px; height: 26px; }
#cb-bubble:hover { transform: scale(1.08); box-shadow: 0 10px 30px rgba(0,0,0,.28); }
#cb-bubble.cb-hidden { opacity: 0; pointer-events: none; transform: scale(.8); }

/* Ventana */
#cb-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9001;
    width: 370px;
    max-width: calc(100vw - 32px);
    background: var(--ivory, #faf8f4);
    border: 1px solid var(--line, #e5dfd4);
    border-radius: 4px;
    box-shadow: 0 16px 48px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(.97);
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    max-height: 80vh;
}
#cb-window.cb-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Cabecera */
#cb-header {
    background: var(--aubergine);
    color: var(--gold-2, #d4b896);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#cb-header-info { display: flex; align-items: center; gap: 10px; }
#cb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
#cb-name   { font-family: var(--serif, serif); font-size: .92rem; font-weight: 600; letter-spacing: .03em; }
#cb-status { font-size: .68rem; opacity: .75; letter-spacing: .06em; margin-top: 1px; }
#cb-close  {
    background: none;
    border: none;
    color: var(--gold-2, #d4b896);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    opacity: .8;
    transition: opacity .15s;
}
#cb-close:hover { opacity: 1; }

/* Área mensajes */
#cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
#cb-messages::-webkit-scrollbar { width: 4px; }
#cb-messages::-webkit-scrollbar-thumb { background: var(--line, #e5dfd4); border-radius: 2px; }

/* Burbujas */
.cb-msg {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: .82rem;
    line-height: 1.6;
    word-break: break-word;
}
.cb-msg strong { font-weight: 600; }
.cb-bot {
    background: #fff;
    border: 1px solid var(--line, #e5dfd4);
    color: var(--muted, #6b6058);
    align-self: flex-start;
    border-radius: 4px 16px 16px 4px;
}
.cb-user {
    background: var(--aubergine);
    color: var(--gold-2, #d4b896);
    align-self: flex-end;
    border-radius: 16px 4px 4px 16px;
}

/* Typing indicator */
.cb-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--line, #e5dfd4);
    width: fit-content;
    border-radius: 4px 16px 16px 4px;
}
.cb-typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--aubergine);
    opacity: .4;
    animation: cb-bounce .8s infinite ease-in-out;
}
.cb-typing span:nth-child(2) { animation-delay: .15s; }
.cb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cb-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: .4; }
    40% { transform: translateY(-5px); opacity: 1; }
}

/* Tarjetas */
.cb-msg.cb-cards-wrap {
    max-width: 100%;
    background: none;
    border: none;
    padding: 0;
}
.cb-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.cb-card {
    background: #fff;
    border: 1px solid var(--line, #e5dfd4);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 0;
}
.cb-card-img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    flex-shrink: 0;
}
.cb-card-body {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.cb-card-sub {
    font-size: .6rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--aubergine);
}
.cb-card-title {
    font-size: .8rem;
    color: #2a2028;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.cb-card-meta {
    font-size: .72rem;
    color: var(--muted, #6b6058);
}
.cb-card-link {
    font-size: .7rem;
    color: var(--aubergine);
    text-decoration: none;
    margin-top: 2px;
}
.cb-card-link:hover { text-decoration: underline; }

/* Chips sugerencias */
#cb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px 4px;
    flex-shrink: 0;
    border-top: 1px solid var(--line, #e5dfd4);
    background: var(--ivory, #faf8f4);
}
.cb-chip {
    background: none;
    border: 1px solid var(--aubergine);
    color: var(--aubergine);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: .67rem;
    letter-spacing: .06em;
    cursor: pointer;
    transition: background .15s, color .15s;
    font-family: var(--sans, sans-serif);
}
.cb-chip:hover {
    background: var(--aubergine);
    color: var(--gold-2, #d4b896);
}

/* Opciones seleccionables (cita) */
.cb-select-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 4px;
}
.cb-option-btn {
    background: none;
    border: 1px solid var(--line, #e5dfd4);
    color: var(--muted, #6b6058);
    text-align: left;
    padding: 6px 10px;
    font-size: .78rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    font-family: var(--sans, sans-serif);
}
.cb-option-btn:hover:not(:disabled) {
    background: var(--lavender-2, #f0ecf4);
    border-color: var(--aubergine);
    color: var(--aubergine);
}
.cb-option-btn.selected {
    background: var(--aubergine);
    color: var(--gold-2, #d4b896);
    border-color: var(--aubergine);
}
.cb-option-btn:disabled { opacity: .55; cursor: default; }

/* CTA agendar cita */
.cb-cta-btn {
    background: var(--aubergine);
    color: var(--gold-2, #d4b896);
    border: none;
    padding: 9px 18px;
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-family: var(--sans, sans-serif);
    cursor: pointer;
    border-radius: 4px;
    transition: opacity .15s;
    margin-top: 4px;
}
.cb-cta-btn:hover:not(:disabled) { opacity: .85; }
.cb-cta-btn:disabled { opacity: .5; cursor: default; }

/* Input row */
#cb-input-row {
    display: flex;
    gap: 0;
    border-top: 1px solid var(--line, #e5dfd4);
    flex-shrink: 0;
}
#cb-input {
    flex: 1;
    border: none;
    outline: none;
    background: var(--ivory, #faf8f4);
    padding: 12px 14px;
    font-size: .82rem;
    font-family: var(--sans, sans-serif);
    color: #2a2028;
}
#cb-input::placeholder { color: var(--muted, #6b6058); opacity: .7; }
#cb-send {
    background: var(--aubergine);
    border: none;
    color: var(--gold-2, #d4b896);
    padding: 0 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .15s;
    flex-shrink: 0;
}
#cb-send svg { width: 20px; height: 20px; }
#cb-send:hover { opacity: .85; }

/* Responsive */
@media (max-width: 480px) {
    #cb-window {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 88px;
    }
    #cb-bubble {
        bottom: 20px;
        right: 16px;
    }
}
