/* ========================================
   EXTRAGEN CHATBOT - Modern Glassmorphism UI
   Works with both tenant portal and superadmin
   ======================================== */

/* Chatbot FAB Button - Modern Gradient Orb with Sparkle */
.chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    /* Brighter stops + inset highlight so FAB pops on dark page bgs
     * (old #0F2B5B 0% blended with dark navy page → faded top-left). */
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 50%),
        linear-gradient(135deg, #1a65d6 0%, #00B4D8 60%, #67e8f9 100%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 20px rgba(0, 180, 216, 0.55),
        0 0 40px rgba(0, 180, 216, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

/* Animated pulse ring */
.chatbot-fab::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.4) 0%, rgba(6, 182, 212, 0.4) 100%);
    z-index: -1;
    animation: fabPulse 2s ease-in-out infinite;
}

@keyframes fabPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.2;
    }
}

/* Sparkle icon in FAB */
.chatbot-fab .fab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-fab .fab-icon svg {
    width: 28px;
    height: 28px;
    fill: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.chatbot-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 180, 216, 0.6), 0 0 60px rgba(0, 180, 216, 0.3);
}

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

/* v3.5.77: chatbot FAB / avatar bg is always blue regardless of theme;
 * invert the dark-blue PentestOps icon to white so it stays visible. */
.chatbot-fab .fab-icon img,
.chatbot-avatar .avatar-icon img,
.chatbot-avatar img,
.bot-avatar-icon img,
.welcome-sparkle img {
    object-fit: contain;
    filter: brightness(0) invert(1);
}
/* v3.5.81: fixed sizes -- the brand mark filled the whole circle at 100% and
   read as a cramped blob ("not clear"). These match the old glyph sizing and
   give the mark breathing room inside the FAB / avatars. */
.chatbot-fab .fab-icon img { width: 26px; height: 26px; }
.chatbot-avatar .avatar-icon img,
.chatbot-avatar img { width: 24px; height: 24px; }
.bot-avatar-icon img { width: 18px; height: 18px; }
.welcome-sparkle img { width: 30px; height: 30px; }

.chatbot-fab i {
    font-size: 1.5rem;
    color: white;
    transition: transform 0.3s ease;
}

.chatbot-fab.open i {
    transform: rotate(180deg);
}

/* Notification badge on FAB */
.chatbot-fab .fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-dark);
}

/* Chat Window Container */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 392px;
    max-width: calc(100vw - 40px);
    height: 560px;
    max-height: calc(100vh - 130px);
    background: var(--glass-bg-strong, rgba(15, 23, 42, 0.97));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), 0 0 80px rgba(0, 180, 216, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chatbot-header {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.12) 0%, rgba(0, 180, 216, 0.08) 100%);
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* v3.5.75: force light text on header. Header is always colored regardless
 * of theme; default text colors wash out on the gradient. */
.chatbot-header .chatbot-name,
.chatbot-header .chatbot-name * { color: #ffffff !important; }
.chatbot-header .chatbot-status { color: rgba(255, 255, 255, 0.78) !important; }
.chatbot-header .chatbot-status.online { color: #86efac !important; }
.chatbot-header .chatbot-name .ai-badge { background: rgba(255, 255, 255, 0.22) !important; color: #ffffff !important; }

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, #1a65d6 50%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.35);
    position: relative;
    flex-shrink: 0;
}

.chatbot-avatar i {
    font-size: 1.4rem;
    color: white;
}

/* Avatar SVG icon support */
.chatbot-avatar .avatar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-avatar .avatar-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.chatbot-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--bg-dark, #0A1628);
}

.chatbot-info {
    flex: 1;
    min-width: 0;
}

.chatbot-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
    margin-bottom: 0.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-name .ai-badge {
    font-size: 0.55rem;
    padding: 0.125rem 0.375rem;
    background: rgba(0, 180, 216, 0.2);
    color: var(--primary-light, #3d83f6);
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.chatbot-status {
    font-size: 0.8125rem;
    color: var(--text-secondary, #cbd5e1);
}

.chatbot-status.online {
    color: var(--success);
}

.chatbot-maximize,
.chatbot-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    color: var(--text-muted, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-maximize:hover {
    background: rgba(0, 180, 216, 0.1);
    border-color: rgba(0, 180, 216, 0.3);
    color: var(--primary-light, #3d83f6);
}

.chatbot-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger, #ef4444);
}

/* Maximized State - Right Panel */
.chatbot-window.maximized {
    position: fixed;
    right: 0;
    left: auto;
    bottom: 0;
    top: 0;
    width: 380px;
    max-width: 380px;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border-right: none;
    border-top: none;
    border-bottom: none;
    z-index: 998;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Main content compression when chatbot is maximized */
body.chatbot-maximized .main-content {
    margin-right: 380px;
    transition: margin-right 0.3s ease;
}

body.chatbot-maximized .chatbot-fab {
    display: none;
}

/* When chatbot is maximized, hide top-right page UI that would otherwise
 * float above the chatbot panel (theme pill z=1100, user menu z=1200,
 * chatbot z=998). Visibility (not display:none) so layout doesn't reflow
 * when the chatbot toggles. */
body.chatbot-maximized .theme-pill,
body.chatbot-maximized .header-actions .user-avatar,
body.chatbot-maximized .user-menu {
    visibility: hidden;
    pointer-events: none;
}

/* Also raise the chatbot above any stray dropdowns when maximized */
.chatbot-window.maximized {
    z-index: 1300 !important;
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    flex-direction: row-reverse;
    margin-left: auto;
}

.chat-message.bot {
    margin-right: auto;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-message.bot .message-avatar {
    background: linear-gradient(135deg, var(--primary) 0%, #1a65d6 100%);
    color: white;
    font-size: 0.9rem;
}

.chat-message.user .message-avatar {
    background: linear-gradient(135deg, var(--secondary) 0%, #0891b2 100%);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

/* Clean, minimal bot surface (neutral instead of cyan tint) + uniform radius */
.chat-message.bot .message-bubble {
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-primary, #f8fafc);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 180, 216, 0.2);
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-muted, #64748b);
    padding: 0 0.25rem;
}

.chat-message.user .message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

.typing-indicator .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, #1a65d6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem 1.25rem;
    background: rgba(0, 180, 216, 0.1);
    border: 1px solid rgba(0, 180, 216, 0.2);
    border-radius: 16px;
    border-top-left-radius: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary-light, #3d83f6);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.welcome-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.25rem;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #1a65d6 50%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 180, 216, 0.4);
}

.welcome-icon i {
    font-size: 1.5rem;
    color: white;
}

/* Welcome icon SVG support */
.welcome-icon .welcome-sparkle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-icon .welcome-sparkle svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Bot avatar SVG icon in messages */
.bot-avatar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.bot-avatar-icon svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.welcome-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary, #f8fafc);
    margin-bottom: 0.5rem;
}

.welcome-text {
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    max-width: 280px;
}

/* Quick Actions / Suggestions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    width: 100%;
    max-width: 300px;
}

.quick-action {
    padding: 0.75rem 1.125rem;
    background: rgba(0, 180, 216, 0.08);
    border: 1px solid rgba(0, 180, 216, 0.15);
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-primary, #f8fafc);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.quick-action::before {
    content: '→';
    color: var(--primary-light, #3d83f6);
    font-weight: 600;
}

.quick-action:hover {
    background: rgba(0, 180, 216, 0.15);
    border-color: rgba(0, 180, 216, 0.3);
    transform: translateX(4px);
}

/* Input Area */
.chatbot-input-area {
    padding: 0.875rem 1rem;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
}

.chatbot-input-wrapper {
    display: flex;
    gap: 0.625rem;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 100px;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.chatbot-input::placeholder {
    color: var(--text-muted, #64748b);
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--secondary);
    background: rgba(0, 180, 216, 0.05);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.1);
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.35);
    flex-shrink: 0;
}

.chatbot-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.5);
}

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

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer: AI disclaimer + powered-by */
.chatbot-footer {
    padding: 0.45rem 1.25rem 0.55rem;
    text-align: center;
    border-top: 1px solid var(--glass-border, rgba(255, 255, 255, 0.05));
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.chatbot-disclaimer {
    font-size: 0.66rem;
    line-height: 1.3;
    color: var(--text-muted, #94a3b8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.chatbot-disclaimer i { font-size: 0.62rem; opacity: 0.85; }

.chatbot-poweredby {
    font-size: 0.66rem;
    color: var(--text-muted, #64748b);
    opacity: 0.85;
}

.chatbot-footer a {
    color: var(--primary-light, #3d83f6);
    text-decoration: none;
}

.chatbot-footer a:hover {
    text-decoration: underline;
}

/* Code blocks in messages */
.message-bubble pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.85rem;
}

.message-bubble code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.85rem;
}

/* Error state */
.chat-message.error .message-bubble {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

/* Scrollbar for messages */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 180, 216, 0.3);
}

/* Header button group */
.chatbot-header-buttons {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

/* Tablet - maximized stays on right */
@media (max-width: 1024px) {
    .chatbot-window.maximized {
        right: 0;
        width: 340px;
    }

    body.chatbot-maximized .main-content {
        margin-right: 340px;
    }

    body.chatbot-maximized .sidebar {
        /* Keep sidebar visible on tablet */
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-fab {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chatbot-window.open {
        transform: translateY(0);
    }

    /* Maximized on mobile = full screen */
    .chatbot-window.maximized {
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
    }

    body.chatbot-maximized .main-content {
        display: none;
        margin-right: 0;
    }

    body.chatbot-maximized .sidebar {
        display: none;
    }

    .chatbot-header {
        padding: 1rem 1.25rem;
    }

    .chatbot-messages {
        padding: 1rem;
    }

    .chat-message {
        max-width: 90%;
    }

    .chatbot-maximize {
        display: flex;
    }
}

/* Dark theme only - light theme removed */

/* Light mode chatbot overrides */
html:not(.dark) .chatbot-container { background: rgba(255, 255, 255, 0.95); border: 1px solid rgba(0, 0, 0, 0.1); }
html:not(.dark) .chatbot-window { background: rgba(255, 255, 255, 0.97); border: 1px solid rgba(0, 0, 0, 0.1); }
html:not(.dark) .chatbot-header { background: linear-gradient(135deg, #0F2B5B 0%, #1a65d6 50%, #00B4D8 100%); }
html:not(.dark) .chatbot-header .chatbot-name { color: white; }
html:not(.dark) .chatbot-header .chatbot-status { color: rgba(255, 255, 255, 0.7); }
html:not(.dark) .chatbot-header .chatbot-maximize,
html:not(.dark) .chatbot-header .chatbot-close { color: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); }
html:not(.dark) .chatbot-messages { background: #F0F4F8; }
html:not(.dark) .chat-message.bot .message-bubble { background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(0, 0, 0, 0.06); color: #1e293b; }
html:not(.dark) .chatbot-input-area { background: rgba(255, 255, 255, 0.9); border-top: 1px solid rgba(0, 0, 0, 0.08); }
html:not(.dark) .chatbot-input { background: #ffffff; border: 1px solid rgba(0, 0, 0, 0.12); color: #1e293b; }
html:not(.dark) .chatbot-input::placeholder { color: #94a3b8; }
html:not(.dark) .chat-code-block { background: #1e293b; color: #e2e8f0; }
html:not(.dark) .welcome-title { color: #1e293b; }
html:not(.dark) .welcome-text { color: #64748b; }
html:not(.dark) .quick-action { color: #1e293b; background: rgba(0, 180, 216, 0.05); border-color: rgba(0, 180, 216, 0.15); }
html:not(.dark) .quick-action:hover { color: #1e293b; background: rgba(0, 180, 216, 0.1); border-color: rgba(0, 180, 216, 0.3); }
html:not(.dark) .quick-action::before { color: #0F2B5B; }
html:not(.dark) .chatbot-footer { color: #64748b; border-top-color: rgba(0, 0, 0, 0.06); }
html:not(.dark) .message-time { color: #94a3b8; }

/* ── Brand consistency (logo) ──────────────────────────────────────────
   The FAB previously forced the PentestOps mark to solid white over a blue
   button, so it read as a different colour from the navy-blue app logo. Show
   the NATURAL blue mark on a light button instead -- consistent with the
   sidebar/header logo, and visible on both light and dark pages. Appended as
   overrides so the change is identical across every app's chatbot.css. */
.chatbot-fab {
    background: #ffffff !important;
    border: 1px solid rgba(26, 101, 214, 0.25) !important;
    box-shadow: 0 4px 16px rgba(26, 101, 214, 0.30), 0 0 24px rgba(0, 180, 216, 0.18) !important;
}
.chatbot-fab .fab-icon img { filter: none !important; }
.chatbot-fab .fab-icon svg { fill: #1a65d6 !important; }
.chatbot-fab i { color: #1a65d6 !important; }

/* ══════════════════════════════════════════════════════════════════════
   Modern enrichments: New-chat button, copy action, follow-up suggestion
   chips, scroll-to-latest, message entrance animation.
   ══════════════════════════════════════════════════════════════════════ */

/* Header "New chat" button - matches the maximize/close icon buttons */
.chatbot-newchat {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    color: var(--text-muted, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.chatbot-header .chatbot-newchat { color: rgba(255, 255, 255, 0.85); }
.chatbot-newchat:hover {
    background: rgba(0, 180, 216, 0.15);
    border-color: rgba(0, 180, 216, 0.4);
    color: #fff;
}

/* Message entrance animation */
@keyframes chatMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-message { animation: chatMsgIn 0.22s ease-out both; }
@media (prefers-reduced-motion: reduce) { .chat-message, .chat-followups { animation: none; } }

/* Meta row under a bubble (timestamp + copy) */
.message-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 2px;
}
.chat-message.user .message-meta { justify-content: flex-end; }

/* Copy button on assistant answers - hover-reveal */
.msg-copy {
    border: 0;
    background: transparent;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    font-size: 0.72rem;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.chat-message:hover .msg-copy,
.msg-copy:focus-visible { opacity: 1; }
.msg-copy:hover { background: rgba(0, 180, 216, 0.12); color: var(--secondary, #00B4D8); }
.msg-copy.copied { color: var(--success, #10b981); opacity: 1; }

/* Follow-up suggestion chips shown under the latest answer */
.chat-followups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.1rem 0.85rem 0.5rem 3rem;
    animation: chatMsgIn 0.22s ease-out both;
}
.followup-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    background: rgba(0, 180, 216, 0.06);
    color: var(--text-secondary, #cbd5e1);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.followup-chip i { color: var(--secondary, #00B4D8); font-size: 0.7rem; }
.followup-chip:hover {
    background: rgba(0, 180, 216, 0.16);
    border-color: rgba(0, 180, 216, 0.4);
    color: #fff;
    transform: translateY(-1px);
}

/* Scroll-to-latest button (appears only when scrolled up) */
.chatbot-scrolldown {
    position: absolute;
    right: 16px;
    bottom: 92px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.14));
    background: var(--glass-bg-strong, rgba(15, 23, 42, 0.97));
    color: var(--secondary, #00B4D8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(6px) scale(0.9);
    pointer-events: none;
    transition: all 0.18s ease;
    z-index: 3;
}
.chatbot-scrolldown.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.chatbot-scrolldown:hover {
    background: rgba(0, 180, 216, 0.18);
    border-color: rgba(0, 180, 216, 0.5);
}
