/* ═══════════════════════════════════════════════════════════════
 * EIR DR. · assistant_layer.css
 * Asistente meta global (Brújula EIR).
 *
 * Patrón inspirado en el "Agent" panel de Antigravity / Copilot:
 *  - FAB flotante abajo-derecha siempre visible.
 *  - Al click: panel lateral derecho que se despliega.
 *  - Conversación corta + sugerencias rápidas + CTA para navegar.
 *  - Persistente entre páginas (sessionStorage).
 *
 * Disponible en TODA la app (chat, academy, atelier público).
 * Cero modificación al HTML legacy de cada página.
 * ═══════════════════════════════════════════════════════════════ */

/* ─── 1. FAB flotante ──────────────────────────────────────── */
.brujula-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 60;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #0a0f1c;
    border: 0;
    cursor: pointer;
    box-shadow:
        0 14px 36px -8px rgba(16, 185, 129, 0.45),
        0 0 0 1px rgba(16, 185, 129, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: all .22s ease;
    font-family: 'Inter', sans-serif;
}
.brujula-fab:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 20px 50px -12px rgba(16, 185, 129, 0.6),
        0 0 0 1px rgba(52, 211, 153, 0.4);
}
.brujula-fab.open { opacity: 0; pointer-events: none; }

.brujula-fab .badge-new {
    position: absolute;
    top: -3px; right: -3px;
    background: #f87171;
    color: white;
    width: 16px; height: 16px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #020617;
    animation: brujula-pulse 2.2s ease-in-out infinite;
}
@keyframes brujula-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}

/* ─── 2. Panel lateral ─────────────────────────────────────── */
.brujula-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 400px;
    max-width: 92vw;
    z-index: 65;
    background: rgba(8, 12, 24, 0.97);
    border-left: 1px solid rgba(16, 185, 129, 0.18);
    backdrop-filter: blur(24px);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
}
.brujula-panel.open { transform: translateX(0); }

.brujula-header {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.brujula-header .left {
    display: flex; align-items: center; gap: 10px;
}
.brujula-header .avatar {
    width: 36px; height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, #10b981 30%, #34d399 100%);
    color: #0a0f1c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}
.brujula-header .title-row {
    display: flex; flex-direction: column;
}
.brujula-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
}
.brujula-header .sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #34d399;
}
.brujula-header button {
    background: transparent;
    border: 0;
    color: #94a3b8;
    width: 30px; height: 30px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    transition: all .2s;
}
.brujula-header button:hover { background: rgba(255,255,255,0.06); color: #f1f5f9; }

/* ─── 3. Lista de mensajes ─────────────────────────────────── */
.brujula-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 13.5px;
    line-height: 1.55;
}

.brujula-msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    max-width: 100%;
}
.brujula-msg .avatar-sm {
    width: 26px; height: 26px;
    border-radius: 999px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-top: 2px;
}
.brujula-msg.assistant .avatar-sm {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.brujula-msg.user {
    flex-direction: row-reverse;
}
.brujula-msg.user .avatar-sm {
    background: rgba(255,255,255,0.06);
    color: #cbd5e1;
}
.brujula-msg .bubble {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 14px;
    padding: 10px 13px;
    color: #cbd5e1;
    max-width: calc(100% - 36px);
    word-wrap: break-word;
}
.brujula-msg.user .bubble {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: #e2e8f0;
}
.brujula-msg .bubble .source-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 8.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-top: 8px;
}

.brujula-msg .cta {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.brujula-msg .cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all .2s ease;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
}
.brujula-msg .cta-btn:hover {
    background: rgba(16, 185, 129, 0.22);
    transform: translateX(2px);
}
.brujula-msg .cta-btn .arrow { color: rgba(52, 211, 153, 0.6); }

/* ─── 4. Sugerencias rápidas (chips) ──────────────────────── */
.brujula-suggestions {
    padding: 4px 16px 12px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}
.brujula-suggestions::-webkit-scrollbar { display: none; }
.brujula-chip {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255,255,255,0.06);
    color: #94a3b8;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 11px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all .2s ease;
    font-family: 'Inter', sans-serif;
}
.brujula-chip:hover {
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
    background: rgba(16, 185, 129, 0.08);
}

/* ─── 5. Input bar inferior ───────────────────────────────── */
.brujula-input-wrap {
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    gap: 8px;
    align-items: center;
}
.brujula-input-wrap input {
    flex: 1;
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 999px;
    padding: 10px 16px;
    color: #f1f5f9;
    font-size: 13.5px;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: border-color .2s, box-shadow .2s;
}
.brujula-input-wrap input:focus {
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.18);
}
.brujula-input-wrap input::placeholder { color: #475569; }
.brujula-input-wrap button {
    width: 38px; height: 38px;
    border-radius: 999px;
    background: #10b981;
    color: #0a0f1c;
    border: 0;
    font-size: 14px;
    cursor: pointer;
    transition: all .15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.brujula-input-wrap button:hover { background: #34d399; transform: scale(1.05); }
.brujula-input-wrap button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── 6. Estado loading (asistente "pensando") ────────────── */
.brujula-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 2px 0;
}
.brujula-typing span {
    width: 6px; height: 6px;
    border-radius: 999px;
    background: #34d399;
    animation: brujula-dot 1.2s ease-in-out infinite;
}
.brujula-typing span:nth-child(2) { animation-delay: 0.2s; }
.brujula-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes brujula-dot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50%      { opacity: 1; transform: scale(1.1); }
}

/* ─── 7. Backdrop suave ──────────────────────────────────── */
.brujula-backdrop {
    position: fixed; inset: 0;
    background: rgba(2, 6, 23, 0.4);
    backdrop-filter: blur(2px);
    z-index: 62;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}
.brujula-backdrop.show {
    opacity: 1;
    pointer-events: all;
}

/* ─── 8. Responsive ──────────────────────────────────────── */
@media (max-width: 720px) {
    .brujula-fab { bottom: 16px; right: 16px; width: 50px; height: 50px; font-size: 20px; }
    .brujula-panel { width: 100vw; max-width: 100vw; border-left: 0; }
}
