/* =============================================================================
   ASISTENTE DE LA WEB (claudeagent)
   -----------------------------------------------------------------------------
   Burbuja flotante y panel de chat. Usa los tokens de bog-tokens.css (colores,
   fuentes, radios) para verse igual que la home. Todo cuelga de .bca para no
   chocar con el tema de la usuaria ni con Bootstrap.
   ============================================================================= */

.bca {
    --bca-grad: linear-gradient(135deg, var(--bog-pink, #C4296B) 0%, var(--bog-violet, #6A4BB8) 100%);
    --bca-stripe: linear-gradient(90deg, var(--bog-green, #0B7B5B), var(--bog-pink, #C4296B) 50%, var(--bog-blue, #2468B8));
    --bca-ink: var(--bog-ink, #1B2340);
    --bca-muted: var(--bog-muted, #565D74);
    --bca-line: var(--bog-line, #E4DFEC);
    --bca-tint: var(--bog-tint, #F6F3F9);
    --bca-paper: var(--bog-paper, #FFFFFF);
    --bca-shadow: 0 24px 60px -18px rgba(27, 35, 64, 0.38), 0 8px 20px -10px rgba(106, 75, 184, 0.25);
    font-family: var(--bog-font-body, "Figtree", system-ui, sans-serif);
    color: var(--bca-ink);
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1040; /* por debajo de los modales de Bootstrap (1050) */
    line-height: 1.45;
    font-size: 15px;
}

.bca *, .bca *::before, .bca *::after { box-sizing: border-box; }
.bca [hidden] { display: none !important; }
.bca svg { width: 22px; height: 22px; display: block; }

.bca-sr {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- botón flotante ---------- */
.bca-launcher {
    position: relative;
    width: 62px; height: 62px;
    border: 0; border-radius: 50%;
    background: var(--bca-grad);
    color: #fff;
    display: grid; place-items: center;
    cursor: pointer;
    box-shadow: var(--bca-shadow);
    transition: transform .25s cubic-bezier(.2, .9, .3, 1.3), box-shadow .25s;
    margin-left: auto;
}
.bca-launcher:hover { transform: translateY(-2px) scale(1.05); }
.bca-launcher:focus-visible { outline: 3px solid var(--bog-focus, #2468B8); outline-offset: 3px; }
.bca-launcher svg { width: 28px; height: 28px; transition: transform .3s, opacity .2s; }
.bca-ico-chat path { fill: #fff; }
.bca-ico-chat .bca-dot { fill: var(--bog-pink, #C4296B); }
.bca-ico-close { position: absolute; opacity: 0; transform: rotate(-90deg); }
.bca-ico-close path, .bca-icon-btn path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.bca.is-open .bca-ico-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.bca.is-open .bca-ico-close { opacity: 1; transform: none; }

.bca-pulse {
    position: absolute; inset: 0; border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(196, 41, 107, .45);
    animation: bca-pulse 2.6s ease-out 3;
    pointer-events: none;
}
.bca.is-open .bca-pulse { display: none; }
@keyframes bca-pulse {
    0% { box-shadow: 0 0 0 0 rgba(196, 41, 107, .45); }
    100% { box-shadow: 0 0 0 18px rgba(196, 41, 107, 0); }
}

/* ---------- globo de bienvenida ---------- */
.bca-teaser {
    position: absolute; right: 0; bottom: 76px;
    width: 240px;
    background: var(--bca-paper);
    border: 1px solid var(--bca-line);
    border-radius: 18px 18px 6px 18px;
    padding: 14px 34px 14px 16px;
    box-shadow: var(--bca-shadow);
    animation: bca-rise .35s ease-out;
}
.bca-teaser p { margin: 0; font-size: 14px; font-weight: 600; }
.bca-teaser-close {
    position: absolute; top: 6px; right: 8px;
    border: 0; background: none; color: var(--bca-muted);
    font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 4px;
}

/* ---------- panel ---------- */
.bca-panel {
    position: absolute; right: 0; bottom: 78px;
    width: 380px;
    height: min(620px, calc(100vh - 120px));
    background: var(--bca-paper);
    border-radius: var(--bog-radius-lg, 28px);
    box-shadow: var(--bca-shadow);
    display: flex; flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: bca-open .28s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes bca-open {
    from { opacity: 0; transform: translateY(12px) scale(.94); }
    to { opacity: 1; transform: none; }
}
@keyframes bca-rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.bca-head {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 18px 14px 18px 18px;
    background: var(--bca-grad);
    color: #fff;
}
.bca-head::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
    background: var(--bca-stripe);
}
.bca-avatar {
    flex: none;
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    border: 2px solid rgba(255, 255, 255, .45);
    display: grid; place-items: center;
}
.bca-avatar path { fill: #fff; }
.bca-head-text { flex: 1; min-width: 0; }
.bca-head h2 {
    margin: 0; color: #fff;
    font-family: var(--bog-font-display, "Baloo 2", sans-serif);
    font-size: 22px; font-weight: 700; line-height: 1.1;
}
.bca-head p { margin: 2px 0 0; font-size: 12.5px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.bca-online { width: 8px; height: 8px; border-radius: 50%; background: #7CF0C1; box-shadow: 0 0 0 3px rgba(124, 240, 193, .25); }
.bca-icon-btn {
    flex: none;
    width: 36px; height: 36px; border-radius: 50%;
    border: 0; background: rgba(255, 255, 255, .14); color: #fff;
    display: grid; place-items: center; cursor: pointer;
    transition: background .2s;
}
.bca-icon-btn svg { width: 18px; height: 18px; }
.bca-icon-btn:hover { background: rgba(255, 255, 255, .26); }
.bca-icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.bca-disclaimer {
    margin: 0;
    padding: 9px 16px;
    font-size: 12px; color: var(--bca-muted);
    background: var(--bca-tint);
    border-bottom: 1px solid var(--bca-line);
}
.bca-disclaimer a { color: var(--bog-pink-d, #A61F59); font-weight: 600; text-decoration: underline; }

/* ---------- mensajes ---------- */
.bca-log {
    flex: 1; overflow-y: auto;
    padding: 18px 16px 8px;
    display: flex; flex-direction: column; gap: 12px;
    background:
        radial-gradient(circle at 100% 0, rgba(196, 41, 107, .05), transparent 45%),
        radial-gradient(circle at 0 100%, rgba(106, 75, 184, .05), transparent 45%),
        var(--bca-paper);
    scroll-behavior: smooth;
}
.bca-msg { display: flex; flex-direction: column; max-width: 86%; animation: bca-rise .25s ease-out; }
.bca-bot { align-self: flex-start; }
.bca-user { align-self: flex-end; align-items: flex-end; }
.bca-bubble {
    padding: 11px 14px;
    border-radius: 18px;
    white-space: pre-wrap; word-wrap: break-word;
}
.bca-bot .bca-bubble {
    background: var(--bca-tint);
    border: 1px solid var(--bca-line);
    border-bottom-left-radius: 6px;
}
.bca-user .bca-bubble {
    background: var(--bca-grad);
    color: #fff;
    border-bottom-right-radius: 6px;
}
.bca-notice {
    margin-top: 6px;
    font-size: 12px; font-weight: 600;
    color: var(--bog-blue, #2468B8);
    background: var(--bog-blue-soft, #E6EFFA);
    border-radius: 10px; padding: 6px 10px;
}
.bca-urgent .bca-bubble {
    background: var(--bog-danger-soft, #FEF0EF);
    border-color: var(--bog-danger, #B42318);
    color: var(--bog-danger, #B42318);
    font-weight: 600;
}
.bca-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bca-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1.5px solid var(--bog-pink, #C4296B);
    background: var(--bca-paper);
    color: var(--bog-pink-d, #A61F59) !important;
    font-size: 13px; font-weight: 700;
    text-decoration: none !important;
    transition: background .2s, color .2s, transform .15s;
}
.bca-link::after { content: "→"; font-weight: 700; }
.bca-link:hover { background: var(--bog-pink, #C4296B); color: #fff !important; transform: translateY(-1px); }
.bca-link.is-premium {
    background: var(--bca-grad); color: #fff !important; border-color: transparent;
    box-shadow: 0 6px 16px -8px rgba(196, 41, 107, .7);
}
.bca-link.is-premium::before { content: "★"; }

.bca-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bca-chip {
    border: 1px solid var(--bca-line);
    background: var(--bca-paper);
    color: var(--bca-ink);
    padding: 8px 12px; border-radius: 999px;
    font: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.bca-chip:hover { border-color: var(--bog-pink, #C4296B); background: var(--bog-pink-soft, #FBE8F0); }

.bca-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.bca-typing i {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--bog-violet, #6A4BB8); opacity: .4;
    animation: bca-blink 1.2s infinite;
}
.bca-typing i:nth-child(2) { animation-delay: .15s; }
.bca-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bca-blink { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- caja de texto ---------- */
.bca-form {
    display: flex; align-items: flex-end; gap: 8px;
    margin: 0; padding: 10px 12px 6px;
    border-top: 1px solid var(--bca-line);
}
.bca-form textarea {
    flex: 1;
    resize: none;
    max-height: 110px;
    border: 1.5px solid var(--bca-line);
    border-radius: 18px;
    padding: 10px 14px;
    font: inherit; font-size: 16px; /* 16px evita el zoom de iOS */
    color: var(--bca-ink);
    background: var(--bca-tint);
    outline: none;
    transition: border-color .2s, background .2s;
}
.bca-form textarea:focus { border-color: var(--bog-violet, #6A4BB8); background: var(--bca-paper); }
.bca-send {
    flex: none;
    width: 44px; height: 44px; border-radius: 50%;
    border: 0; background: var(--bca-grad); color: #fff;
    display: grid; place-items: center; cursor: pointer;
    transition: transform .15s, opacity .2s;
}
.bca-send path { fill: #fff; }
.bca-send:hover { transform: scale(1.06); }
.bca-send:disabled { opacity: .45; cursor: default; transform: none; }
.bca-send:focus-visible { outline: 3px solid var(--bog-focus, #2468B8); outline-offset: 2px; }
.bca-foot { margin: 0; padding: 0 16px 10px; font-size: 11px; color: var(--bca-muted); text-align: center; }

/* ---------- móvil: el panel ocupa la pantalla ---------- */
@media (max-width: 520px) {
    .bca { right: 14px; bottom: 14px; }
    .bca-launcher { width: 56px; height: 56px; }
    .bca.is-open .bca-launcher { display: none; }
    .bca-panel {
        position: fixed; inset: 0;
        width: 100%; height: 100%;
        height: 100dvh;
        border-radius: 0;
    }
    .bca-msg { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
    .bca *, .bca *::before, .bca *::after { animation: none !important; transition: none !important; }
}

@media print { .bca { display: none !important; } }
