/* copilot.css — chat flotante del asistente, copiado del Co-pilot ANÍBAL de proveedor.html (A TEAM) */
/* ═══════════════════════════════════════════
   A-TEAM AI Copilot — Dark Glassmorphism Theme
   Replicating business.html / Aurent Co-pilot
   ═══════════════════════════════════════════ */
:root {
    --biz-cb-primary: #7B4FFF;
    --biz-cb-primary-hover: #693be6;
    --biz-cb-primary-glow: rgba(123, 79, 255, 0.35);
    --biz-cb-bg: rgba(9, 11, 17, 0.96);
    --biz-cb-border: rgba(255, 255, 255, 0.08);
    --biz-cb-text: #F3F4F6;
    --biz-cb-text-muted: #9CA3AF;
    --biz-cb-bubble-user: #7B4FFF;
    --biz-cb-bubble-bot: rgba(255, 255, 255, 0.05);
    --biz-cb-card-bg: rgba(255, 255, 255, 0.03);
    --biz-cb-card-border: rgba(255, 255, 255, 0.06);
}

/* ── Toggle Floating Button ── */
.biz-chatbot-toggle-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.biz-chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--biz-cb-primary), #5227cc);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 24px var(--biz-cb-primary-glow), inset 0 2px 4px rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.biz-chatbot-toggle:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 32px var(--biz-cb-primary-glow), inset 0 2px 4px rgba(255,255,255,0.3);
}

.biz-chatbot-toggle:active {
    transform: scale(0.95);
}

.biz-chatbot-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.biz-chatbot-toggle .icon-close {
    display: none;
}

.biz-chatbot-toggle.active .icon-chat {
    display: none;
}

.biz-chatbot-toggle.active .icon-close {
    display: block;
    transform: rotate(90deg);
}

/* Badge (Alert/Indicator) */
.biz-chatbot-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #090B11;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: biz-bounce 2s infinite;
}

@keyframes biz-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* ── Chat Window Panel ── */
.biz-chatbot-window {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 120px);
    border-radius: 16px;
    background: var(--biz-cb-bg);
    border: 1px solid var(--biz-cb-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255,255,255,0.1);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.biz-chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.biz-chatbot-header {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--biz-cb-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.biz-chatbot-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.biz-chatbot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(123, 79, 255, 0.15);
    border: 1px solid rgba(123, 79, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--biz-cb-primary);
    flex-shrink: 0;
}

.biz-chatbot-avatar i {
    font-size: 14px;
}

.biz-chatbot-header-info h4 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--biz-cb-text);
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.biz-chatbot-header-info span {
    font-size: 11px;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 4px;
}

.biz-chatbot-header-info span::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.biz-chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.biz-chatbot-action-btn {
    background: none;
    border: none;
    color: var(--biz-cb-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.biz-chatbot-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--biz-cb-text);
}

.biz-chatbot-action-btn i {
    font-size: 13px;
}

.biz-chatbot-close {
    background: none;
    border: none;
    color: var(--biz-cb-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.biz-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--biz-cb-text);
}

.biz-chatbot-close svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Messages Area */
.biz-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.biz-chatbot-messages::-webkit-scrollbar {
    width: 5px;
}
.biz-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.biz-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.biz-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Message Bubbles */
.biz-chatbot-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 88%;
    animation: biz-msg-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.biz-chatbot-msg.bot {
    align-self: flex-start;
}

.biz-chatbot-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.biz-chatbot-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.biz-chatbot-msg-avatar i {
    font-size: 12px;
    color: var(--biz-cb-primary);
}

.biz-chatbot-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    font-family: 'Inter', -apple-system, sans-serif;
    word-break: break-word;
}

.biz-chatbot-msg.bot .biz-chatbot-msg-bubble {
    background: var(--biz-cb-bubble-bot);
    border: 1px solid var(--biz-cb-border);
    color: var(--biz-cb-text);
    border-bottom-left-radius: 4px;
}

.biz-chatbot-msg.user .biz-chatbot-msg-bubble {
    background: var(--biz-cb-bubble-user);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(123, 79, 255, 0.25);
}

.biz-chatbot-msg-bubble a {
    color: #a78bfa;
    text-decoration: underline;
}

.biz-chatbot-msg-bubble strong {
    font-weight: 600;
    color: #fff;
}

.biz-chatbot-msg-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 100%;
}

.biz-chatbot-msg.user .biz-chatbot-msg-container {
    align-items: flex-end;
}

.biz-chatbot-msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: var(--biz-cb-text-muted);
    margin-top: 2px;
    padding: 0 4px;
}

.biz-chatbot-msg.user .biz-chatbot-msg-meta {
    justify-content: flex-end;
}

.biz-chatbot-msg-time {
    opacity: 0.75;
}

.biz-chatbot-msg-copy {
    background: none;
    border: none;
    color: var(--biz-cb-text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    font-size: 10px;
    font-family: inherit;
    outline: none;
}

.biz-chatbot-msg-copy:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.biz-chatbot-msg-copy.copied {
    color: #10b981;
}

/* Typing Indicator */
.biz-chatbot-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    animation: biz-msg-in 0.2s ease;
}

.biz-chatbot-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--biz-cb-bubble-bot);
    border: 1px solid var(--biz-cb-border);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.biz-chatbot-typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--biz-cb-text-muted);
    border-radius: 50%;
    animation: biz-typing 1.4s infinite ease-in-out both;
}

.biz-chatbot-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.biz-chatbot-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.biz-chatbot-typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes biz-typing {
    0%, 80%, 100% { transform: scale(0.3); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes biz-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Quick Replies / Chips */
.biz-chatbot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    align-self: flex-start;
}

.biz-chatbot-chip {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--biz-cb-text-muted);
    font-size: 11.5px;
    padding: 5px 11px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', -apple-system, sans-serif;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.biz-chatbot-chip:hover {
    background: rgba(123, 79, 255, 0.15);
    border-color: rgba(123, 79, 255, 0.35);
    color: #fff;
}

/* ── Input Area ── */
.biz-chatbot-input-area {
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--biz-cb-border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Con el contenedor delante gana a los estilos generales de input[type="text"] del panel */
.biz-chatbot-input-area .biz-chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--biz-cb-border);
    border-radius: 18px;
    padding: 8px 14px;
    color: #fff;
    font-size: 12.5px;
    line-height: 1.4;
    font-family: 'Inter', -apple-system, sans-serif;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.biz-chatbot-input-area .biz-chatbot-input:focus {
    border-color: var(--biz-cb-primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 2px rgba(123, 79, 255, 0.2);
}

.biz-chatbot-input::placeholder {
    color: #555c6e;
}

.biz-chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--biz-cb-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(123, 79, 255, 0.25);
}

.biz-chatbot-send:hover {
    background: var(--biz-cb-primary-hover);
    transform: scale(1.05);
}

.biz-chatbot-send:active {
    transform: scale(0.95);
}

.biz-chatbot-send svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    margin-left: 2px;
}

/* Footer / Branding */
.biz-chatbot-footer {
    padding: 5px;
    text-align: center;
    font-size: 9.5px;
    color: #555c6e;
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Sessions History List */
.biz-chatbot-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    height: 100%;
    padding: 14px;
    overflow-y: auto;
}

.biz-chatbot-sessions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--biz-cb-border);
}

.biz-chatbot-sessions-title-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--biz-cb-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.biz-chatbot-sessions-back {
    background: none;
    border: none;
    color: var(--biz-cb-text-muted);
    font-size: 11.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 6px;
}

.biz-chatbot-sessions-back:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

.biz-chatbot-sessions-new-btn {
    background: rgba(123, 79, 255, 0.15);
    border: 1px solid rgba(123, 79, 255, 0.3);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.biz-chatbot-sessions-new-btn:hover {
    background: var(--biz-cb-primary);
}

.biz-chatbot-session-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--biz-cb-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.biz-chatbot-session-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(123, 79, 255, 0.3);
}

.biz-chatbot-session-item.active {
    border-color: var(--biz-cb-primary);
    background: rgba(123, 79, 255, 0.1);
}

.biz-chatbot-session-item .session-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.biz-chatbot-session-item .session-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--biz-cb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.biz-chatbot-session-item .session-date {
    font-size: 10px;
    color: var(--biz-cb-text-muted);
}

.biz-chatbot-delete-session-btn {
    background: none;
    border: none;
    color: var(--biz-cb-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.biz-chatbot-delete-session-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.copilot-grounding-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    font-size: 10px;
    background: rgba(123,79,255,0.12);
    color: #c4b5fd;
    border: 1px solid rgba(123,79,255,0.25);
    border-radius: 6px;
    padding: 3px 8px;
    font-weight: 700;
}

@media (max-width: 640px) {
    .biz-chatbot-window {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 86px;
        height: calc(100vh - 110px);
    }
    .biz-chatbot-toggle-wrapper {
        bottom: 16px;
        right: 16px;
    }
}
