/* ========================================
   EXTRAGEN CHATBOT - Modern Compact Design
   Website version
   ======================================== */

/* Chatbot FAB Button - Compact Gradient Orb */
.chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    /* Brighter stops + inset highlight so the FAB visually pops on
     * dark page backgrounds (was #0F2B5B 0% - dark navy that blended
     * into the page making the top-left corner look faded). */
    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, #1a65d6, #00B4D8, #67e8f9);
    z-index: -1;
    opacity: 0.5;
    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; }
}

.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.4);
}

.chatbot-fab:hover::before {
    animation: none;
    opacity: 0.8;
    transform: scale(1.1);
}

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

/* Sparkle icon container */
.chatbot-fab .fab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* v3.5.77: brand-mark on chatbot surfaces.
 * Both .chatbot-fab and .chatbot-avatar have a hard-coded dark-blue
 * gradient background regardless of light/dark theme. The PentestOps
 * icon's natural colours are also dark blue, so without an invert
 * filter the icon disappears into the gradient (operator pointed this
 * out -- "see the chatbot logo is also not visible in dark and light").
 * Forcing brightness(0)+invert(1) on the IMG flattens the brand mark
 * to solid white, which contrasts cleanly with the blue gradients in
 * BOTH themes. The html.dark rule in website.css only catches logo
 * placements on the PAGE background; chatbot internals need their own
 * rule because their bg is independent of theme. */
.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 .fab-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

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

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

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

/* Chat Window Container - Compact
 *
 * Sizing rule of thumb (v3.5.62 -- fixed clip issue where panel top
 * disappeared behind the page navbar on shorter viewports):
 *   * Bottom anchor (96px) clears the FAB and leaves visible spacing.
 *   * max-height ceiling = (100vh - 220px) so the panel always sits
 *     BELOW the website's fixed navbar (~80px) with a generous
 *     headroom. Earlier 140px ceiling meant on viewports under ~800px
 *     the panel header was clipped behind the navbar.
 *   * z-index 1100 -- above the page navbar so even if the calc is
 *     off by a few px the header isn't visually hidden behind it.
 */
.chatbot-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 48px);
    height: 500px;
    max-height: calc(100vh - 220px);
    background: var(--glass-bg-strong, rgba(15, 23, 42, 0.95));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    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 100px rgba(0, 180, 216, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1100;
    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 - Compact */
.chatbot-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.15) 0%, rgba(0, 180, 216, 0.1) 100%);
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 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: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0F2B5B 0%, #1a65d6 50%, #00B4D8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.4);
    position: relative;
    flex-shrink: 0;
}

.chatbot-avatar i,
.chatbot-avatar .avatar-icon {
    font-size: 1.1rem;
    color: white;
}

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

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

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

.chatbot-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary, #f8fafc);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

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

.chatbot-status.online {
    color: var(--success, #10b981);
}

.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: 70px;  /* Start below header */
    width: 380px;
    max-width: 380px;
    height: calc(100vh - 70px);  /* Full height minus header */
    max-height: calc(100vh - 70px);
    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,
body.chatbot-maximized main {
    margin-right: 380px;
    transition: margin-right 0.3s ease;
}

/* Make sure the maximized chatbot beats any page-level top-right UI */
.chatbot-window.maximized { z-index: 1300 !important; }

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

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

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

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 10px;
    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: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

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

.message-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}

.chat-message.bot .message-bubble {
    background: rgba(0, 180, 216, 0.1);
    color: var(--text-primary, #f8fafc);
    border: 1px solid rgba(0, 180, 216, 0.2);
    border-top-left-radius: 4px;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary, #0F2B5B) 0%, var(--primary-dark, #091a38) 100%);
    color: white;
    border-top-right-radius: 4px;
}

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

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

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

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

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

.typing-dots span {
    width: 6px;
    height: 6px;
    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(-6px);
        opacity: 1;
    }
}

/* Welcome Message - Centered Compact */
.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 16px;
    height: 100%;
}

.welcome-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0F2B5B 0%, #1a65d6 50%, #00B4D8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 180, 216, 0.4);
    animation: welcomePulse 2s ease-in-out infinite;
}

@keyframes welcomePulse {
    0%, 100% { box-shadow: 0 8px 25px rgba(0, 180, 216, 0.4); }
    50% { box-shadow: 0 8px 35px rgba(0, 180, 216, 0.6); }
}

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

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

/* Bot avatar in messages */
.bot-avatar-icon svg {
    width: 16px;
    height: 16px;
    fill: white;
}

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

.welcome-text {
    font-size: 0.9rem;
    color: var(--text-secondary, #cbd5e1);
    line-height: 1.5;
    margin-bottom: 16px;
    max-width: 280px;
}

/* Quick Actions - Stacked Cards with Arrows */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 280px;
}

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

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

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

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

.chatbot-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    padding: 10px 14px;
    /* Bumped from rgba(255,255,255,0.05) -- the previous 5% white tint
       was effectively invisible against the dark chatbot panel, so the
       textarea showed only as a faint placeholder. Now sits as a proper
       elevated card with a real border. */
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.875rem;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 100px;
    line-height: 1.4;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

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

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary, #0F2B5B) 0%, var(--primary-dark, #091a38) 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 15px rgba(0, 180, 216, 0.4);
    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;
}

/* Powered By Footer - Compact */
.chatbot-footer {
    padding: 8px 16px;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted, #64748b);
    border-top: 1px solid var(--glass-border, rgba(255, 255, 255, 0.05));
}

.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: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.8rem;
}

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

/* Lists in messages */
.message-bubble .chat-ul,
.message-bubble .chat-ol {
    margin: 8px 0;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-bubble .chat-ul li,
.message-bubble .chat-ol li {
    position: relative;
    padding-left: 18px;
    line-height: 1.45;
}

.message-bubble .chat-ul > li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.55em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--secondary, #00B4D8);
}

.message-bubble .chat-ol {
    counter-reset: chat-ol-item;
}

.message-bubble .chat-ol > li {
    counter-increment: chat-ol-item;
    padding-left: 24px;
}

.message-bubble .chat-ol > li::before {
    content: counter(chat-ol-item);
    position: absolute;
    left: 0;
    top: 0.05em;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: rgba(0, 180, 216, 0.16);
    color: var(--secondary, #00B4D8);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}

/* Nested lists */
.message-bubble .chat-ul .chat-ul,
.message-bubble .chat-ul .chat-ol,
.message-bubble .chat-ol .chat-ul,
.message-bubble .chat-ol .chat-ol {
    margin: 5px 0 2px;
    gap: 3px;
    padding-left: 2px;
    font-size: 0.95em;
    opacity: 0.85;
}

.message-bubble .chat-ul .chat-ul > li::before {
    background: transparent;
    border: 1px solid var(--secondary, #00B4D8);
    width: 4px;
    height: 4px;
    top: 0.6em;
}

.message-bubble .chat-h {
    margin: 12px 0 6px;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--secondary, #00B4D8);
}

.message-bubble .chat-h:first-child {
    margin-top: 0;
}

/* 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, #ef4444);
}

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

.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);
}

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

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

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

    .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,
    body.chatbot-maximized main {
        display: none;
        margin-right: 0;
    }

    .chatbot-header {
        padding: 12px 16px;
    }

    .chatbot-messages {
        padding: 12px;
    }

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

    .chatbot-maximize {
        display: flex;
    }
}

/* Light theme adjustments (default - applies when not dark) */
html:not(.dark) .chatbot-window,
body[data-theme="light"] .chatbot-window,
.chatbot-window.light-theme {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

html:not(.dark) .chatbot-header,
body[data-theme="light"] .chatbot-header,
.chatbot-window.light-theme .chatbot-header {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.1) 0%, rgba(0, 180, 216, 0.05) 100%);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

html:not(.dark) .chatbot-name,
body[data-theme="light"] .chatbot-name,
.chatbot-window.light-theme .chatbot-name {
    color: #1E293B;
}

html:not(.dark) .chatbot-close,
body[data-theme="light"] .chatbot-close,
.chatbot-window.light-theme .chatbot-close {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #64748b;
}

html:not(.dark) .chat-message.bot .message-bubble,
body[data-theme="light"] .chat-message.bot .message-bubble,
.chatbot-window.light-theme .chat-message.bot .message-bubble {
    background: rgba(0, 180, 216, 0.08);
    border-color: rgba(0, 180, 216, 0.15);
    color: #1E293B;
}

html:not(.dark) .message-bubble .chat-h,
body[data-theme="light"] .message-bubble .chat-h,
.chatbot-window.light-theme .message-bubble .chat-h,
html:not(.dark) .message-bubble .chat-ol > li::before,
body[data-theme="light"] .message-bubble .chat-ol > li::before,
.chatbot-window.light-theme .message-bubble .chat-ol > li::before {
    color: #0e7490;
}

html:not(.dark) .message-bubble .chat-ul > li::before,
body[data-theme="light"] .message-bubble .chat-ul > li::before,
.chatbot-window.light-theme .message-bubble .chat-ul > li::before {
    background: #0e7490;
}

html:not(.dark) .message-bubble .chat-ul .chat-ul > li::before,
body[data-theme="light"] .message-bubble .chat-ul .chat-ul > li::before,
.chatbot-window.light-theme .message-bubble .chat-ul .chat-ul > li::before {
    background: transparent;
    border-color: #0e7490;
}

html:not(.dark) .chatbot-input-area,
body[data-theme="light"] .chatbot-input-area,
.chatbot-window.light-theme .chatbot-input-area {
    background: rgba(0, 0, 0, 0.03);
    border-top-color: rgba(0, 0, 0, 0.08);
}

html:not(.dark) .chatbot-input,
body[data-theme="light"] .chatbot-input,
.chatbot-window.light-theme .chatbot-input {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1E293B;
}

html:not(.dark) .chatbot-footer,
body[data-theme="light"] .chatbot-footer,
.chatbot-window.light-theme .chatbot-footer {
    border-top-color: rgba(0, 0, 0, 0.05);
}

html:not(.dark) .welcome-title,
body[data-theme="light"] .welcome-title,
.chatbot-window.light-theme .welcome-title {
    color: #1E293B;
}

/* Welcome-text contrast fix (v3.5.63). Previously inherited
 * --text-secondary (#cbd5e1, very light grey) on the light-theme card
 * background -- AA contrast against the near-white card was below
 * threshold and unreadable on monitors with high brightness. Bumped
 * to a slate that meets WCAG AA on a #ffffff/#f0f4f8 background. */
html:not(.dark) .welcome-text,
body[data-theme="light"] .welcome-text,
.chatbot-window.light-theme .welcome-text {
    color: #475569;
}

/* Chatbot-name in header lacked its own light-theme override -- on
 * the gradient header it's already white so leave it; but the
 * "Online" subtitle inherits text-secondary which clashed. */
html:not(.dark) .chatbot-status,
body[data-theme="light"] .chatbot-status,
.chatbot-window.light-theme .chatbot-status {
    color: rgba(255, 255, 255, 0.85);
}

html:not(.dark) .quick-action,
body[data-theme="light"] .quick-action,
.chatbot-window.light-theme .quick-action {
    color: #1E293B;
    background: rgba(0, 180, 216, 0.06);
    border-color: rgba(0, 180, 216, 0.12);
}

html:not(.dark) .quick-action:hover,
body[data-theme="light"] .quick-action:hover,
.chatbot-window.light-theme .quick-action:hover {
    background: rgba(0, 180, 216, 0.12);
    border-color: rgba(0, 180, 216, 0.25);
}

html:not(.dark) .typing-dots,
body[data-theme="light"] .typing-dots,
.chatbot-window.light-theme .typing-dots {
    background: rgba(0, 180, 216, 0.08);
    border-color: rgba(0, 180, 216, 0.15);
}

/* Light mode chatbot overrides (default) */
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-header { background: var(--gradient-primary); } /* Keep gradient header */
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; }

/* ─────────────────────────────────────────────────────────────────
 * PROACTIVE PEEK BUBBLE - appears 12s after page load if chat unopened
 * ───────────────────────────────────────────────────────────────── */
.chatbot-peek-bubble {
    position: fixed;
    bottom: 88px;
    right: 24px;
    z-index: 999;
    background: #fff;
    color: #0F2B5B;
    padding: 12px 36px 12px 16px;
    border-radius: 18px;
    box-shadow: 0 8px 30px rgba(15, 43, 91, 0.18);
    border: 1px solid rgba(0, 180, 216, 0.18);
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 260px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chatbot-peek-bubble.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.chatbot-peek-bubble::before {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 28px;
    width: 14px;
    height: 14px;
    background: #fff;
    transform: rotate(45deg);
    border-right: 1px solid rgba(0, 180, 216, 0.18);
    border-bottom: 1px solid rgba(0, 180, 216, 0.18);
}
.chatbot-peek-bubble:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 36px rgba(15, 43, 91, 0.22);
}
.chatbot-peek-text {
    line-height: 1.45;
}

/* Typing dots inside the peek bubble - looks like AI is composing */
.chatbot-peek-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}
.chatbot-peek-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0F2B5B, #00B4D8);
    opacity: 0.4;
    animation: peekDot 1.2s infinite ease-in-out;
}
.chatbot-peek-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-peek-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes peekDot {
    0%, 80%, 100% { transform: scale(0.85); opacity: 0.4; }
    40% { transform: scale(1.15); opacity: 1; }
}

/* Subtle entrance: bounce + slight rotate for liveliness */
.chatbot-peek-bubble.show {
    animation: peekEntrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes peekEntrance {
    0% { transform: translateY(20px) scale(0.6) rotate(-3deg); opacity: 0; }
    60% { transform: translateY(-4px) scale(1.05) rotate(1deg); opacity: 1; }
    100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────────
 * STREAMING TYPEWRITER CURSOR - appears at end of bot message
 * while characters are being typed in real time
 * ───────────────────────────────────────────────────────────────── */
.streaming-text { white-space: pre-wrap; word-wrap: break-word; }
.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 2px;
    vertical-align: -2px;
    background: linear-gradient(180deg, #0F2B5B, #00B4D8);
    border-radius: 2px;
    animation: streamCursorBlink 0.7s steps(2, end) infinite;
}
@keyframes streamCursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ─────────────────────────────────────────────────────────────────
 * DRAGGABLE HEADER - user can grab and reposition the chat window
 * ───────────────────────────────────────────────────────────────── */
.chatbot-header.draggable-handle {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.chatbot-header.draggable-handle.is-dragging {
    cursor: grabbing;
}
.chatbot-header.draggable-handle::after {
    content: '⋮⋮';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: -2px;
    font-size: 14px;
    pointer-events: none;
}

/* Quick-action chips rendered inline below the streamed greeting */
.inline-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px 16px;
    animation: quickActionsFade 0.4s ease;
}
@keyframes quickActionsFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.chatbot-peek-close {
    position: absolute;
    top: 4px;
    right: 6px;
    background: transparent;
    border: 0;
    color: #94a3b8;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 50%;
    transition: background 0.15s ease;
}
.chatbot-peek-close:hover {
    background: rgba(15, 43, 91, 0.08);
    color: #0F2B5B;
}
html.dark .chatbot-peek-bubble {
    background: #1a2540;
    color: #e2e8f0;
    border-color: rgba(0, 180, 216, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
html.dark .chatbot-peek-bubble::before {
    background: #1a2540;
    border-color: rgba(0, 180, 216, 0.3);
}

@media (max-width: 768px) {
    .chatbot-peek-bubble {
        right: 12px;
        bottom: 78px;
        max-width: 220px;
        font-size: 0.8rem;
    }
}

/* ── 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; }
