/* ==========================================================================
   Cybersecurity4Vet - Gemini AI Assistant Floating Widget (Bottom-Left)
   Solid high-contrast styling isolated from theme overrides
   ========================================================================== */

#c4v-ai-root {
    font-family: 'Poppins', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

#c4v-ai-root *,
#c4v-ai-root *::before,
#c4v-ai-root *::after {
    box-sizing: border-box;
}

/* Launcher positioned cleanly at bottom-left, above Cookie Settings button */
#c4v-ai-root #c4v-ai-launcher {
    position: fixed !important;
    left: 20px !important;
    bottom: 76px !important;
    z-index: 999991 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 18px 10px 12px !important;
    margin: 0 !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%) !important;
    color: #ffffff !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    cursor: pointer !important;
    box-shadow: 0 10px 28px rgba(124, 58, 237, 0.45) !important;
    transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

#c4v-ai-root #c4v-ai-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(236, 72, 153, 0.52) !important;
    filter: brightness(1.06);
}

#c4v-ai-root #c4v-ai-launcher:focus-visible {
    outline: 2px solid #f472b6 !important;
    outline-offset: 3px;
}

#c4v-ai-root .c4v-ai-launcher-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    font-size: 15px;
    color: #ffffff;
}

#c4v-ai-root .c4v-ai-status-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #4ade80;
    border: 2px solid #7c3aed;
}

/* Chat Panel (solid opaque background, zero theme padding) */
#c4v-ai-root #c4v-ai-panel {
    position: fixed !important;
    left: 20px !important;
    bottom: 138px !important;
    z-index: 999995 !important;
    width: 380px !important;
    max-width: calc(100vw - 32px) !important;
    height: 530px !important;
    max-height: calc(100vh - 165px) !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: #111827 !important;
    background-color: #111827 !important;
    color: #f9fafb !important;
    border: 1px solid #2d3748 !important;
    border-radius: 20px !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
    overflow: hidden !important;
    animation: c4vAiSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

#c4v-ai-root #c4v-ai-panel[hidden] {
    display: none !important;
}

@keyframes c4vAiSlideUp {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
#c4v-ai-root .c4v-ai-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 15px 16px !important;
    background: linear-gradient(135deg, #2b1d4c 0%, #1a2138 100%) !important;
    border-bottom: 1px solid #2d3748 !important;
    flex-shrink: 0 !important;
}

#c4v-ai-root .c4v-ai-header-info {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

#c4v-ai-root .c4v-ai-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    font-size: 17px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.45);
}

#c4v-ai-root .c4v-ai-title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    line-height: 1.3 !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    color: #ffffff !important;
}

#c4v-ai-root .c4v-ai-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #cbd5e1 !important;
    line-height: 1.3;
}

#c4v-ai-root .c4v-ai-online-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #4ade80;
    display: inline-block;
}

#c4v-ai-root .c4v-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

#c4v-ai-root .c4v-ai-icon-btn {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 9px !important;
    border: 1px solid #3b4661 !important;
    background-color: #262f47 !important;
    color: #e2e8f0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#c4v-ai-root .c4v-ai-icon-btn:hover {
    background-color: #36415e !important;
    color: #ffffff !important;
}

/* Messages (explicit solid dark background so page behind NEVER bleeds through) */
#c4v-ai-root #c4v-ai-messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 16px 14px !important;
    background-color: #111827 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    scroll-behavior: smooth;
}

#c4v-ai-root #c4v-ai-messages::-webkit-scrollbar {
    width: 6px;
}

#c4v-ai-root #c4v-ai-messages::-webkit-scrollbar-track {
    background: #111827;
}

#c4v-ai-root #c4v-ai-messages::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 999px;
}

#c4v-ai-root .c4v-ai-msg {
    display: flex;
    max-width: 88%;
}

#c4v-ai-root .c4v-ai-msg-bot {
    align-self: flex-start;
}

#c4v-ai-root .c4v-ai-msg-user {
    align-self: flex-end;
}

#c4v-ai-root .c4v-ai-bubble {
    padding: 11px 14px !important;
    border-radius: 14px !important;
    font-size: 13.5px !important;
    line-height: 1.55 !important;
    word-break: break-word;
}

#c4v-ai-root .c4v-ai-msg-bot .c4v-ai-bubble {
    background-color: #1f2937 !important;
    color: #f3f4f6 !important;
    border: 1px solid #374151 !important;
    border-bottom-left-radius: 4px !important;
}

#c4v-ai-root .c4v-ai-msg-user .c4v-ai-bubble {
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-bottom-right-radius: 4px !important;
}

#c4v-ai-root .c4v-ai-msg-error .c4v-ai-bubble {
    background-color: #3b1720 !important;
    border: 1px solid #ef4444 !important;
    color: #fecaca !important;
}

#c4v-ai-root .c4v-ai-bubble p {
    margin: 0 0 8px 0 !important;
    color: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

#c4v-ai-root .c4v-ai-bubble p:last-child {
    margin-bottom: 0 !important;
}

#c4v-ai-root .c4v-ai-bubble strong {
    color: #ffffff !important;
    font-weight: 700 !important;
}

#c4v-ai-root .c4v-ai-bubble ul {
    margin: 6px 0 !important;
    padding-left: 18px !important;
}

#c4v-ai-root .c4v-ai-bubble li {
    margin-bottom: 4px !important;
    list-style-type: disc !important;
    color: inherit !important;
}

#c4v-ai-root .c4v-ai-bubble code {
    background-color: #0f172a !important;
    color: #93c5fd !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-size: 12.5px !important;
}

#c4v-ai-root .c4v-ai-bubble a {
    color: #7dd3fc !important;
    text-decoration: underline !important;
}

/* Typing indicator */
#c4v-ai-root .c4v-ai-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 2px;
}

#c4v-ai-root .c4v-ai-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #a78bfa;
    animation: c4vAiBounce 1.2s infinite ease-in-out;
}

#c4v-ai-root .c4v-ai-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

#c4v-ai-root .c4v-ai-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes c4vAiBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.45; }
    40% { transform: scale(1); opacity: 1; }
}

/* Quick suggestions */
#c4v-ai-root #c4v-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 12px 14px !important;
    background-color: #111827 !important;
    flex-shrink: 0 !important;
}

#c4v-ai-root #c4v-ai-suggestions[hidden] {
    display: none !important;
}

#c4v-ai-root .c4v-ai-chip {
    background-color: #231b3d !important;
    border: 1px solid #5b4399 !important;
    color: #e9d5ff !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
    padding: 6px 11px !important;
    margin: 0 !important;
    border-radius: 999px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#c4v-ai-root .c4v-ai-chip:hover {
    background-color: #3a2669 !important;
    border-color: #ec4899 !important;
    color: #ffffff !important;
}

/* Input area */
#c4v-ai-root .c4v-ai-input-wrap {
    display: flex !important;
    align-items: flex-end !important;
    gap: 8px !important;
    padding: 12px 14px !important;
    background-color: #0f172a !important;
    border-top: 1px solid #2d3748 !important;
    flex-shrink: 0 !important;
}

#c4v-ai-root #c4v-ai-input {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 40px !important;
    max-height: 104px !important;
    resize: none !important;
    border: 1px solid #334155 !important;
    border-radius: 12px !important;
    background-color: #1e293b !important;
    color: #ffffff !important;
    font-size: 13.5px !important;
    line-height: 1.45 !important;
    padding: 9px 12px !important;
    margin: 0 !important;
    overflow-y: hidden;
    font-family: inherit !important;
    box-shadow: none !important;
}

#c4v-ai-root #c4v-ai-input::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
}

#c4v-ai-root #c4v-ai-input:focus {
    outline: none !important;
    border-color: #a855f7 !important;
    color: #ffffff !important;
    background-color: #1e293b !important;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.28) !important;
}

#c4v-ai-root #c4v-ai-send {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 12px !important;
    border: none !important;
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%) !important;
    color: #ffffff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#c4v-ai-root #c4v-ai-send:hover:not(:disabled) {
    transform: translateY(-1px);
}

#c4v-ai-root #c4v-ai-send:disabled {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
}

#c4v-ai-root .c4v-ai-legal-note {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 6px 12px 9px 12px !important;
    background-color: #0b1120 !important;
    color: #94a3b8 !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    flex-shrink: 0 !important;
}

#c4v-ai-root .c4v-ai-legal-note a {
    color: #c4b5fd !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
}

@media (max-width: 576px) {
    #c4v-ai-root #c4v-ai-launcher {
        left: 14px !important;
        bottom: 72px !important;
        padding: 9px 14px 9px 10px !important;
        font-size: 13px !important;
    }

    #c4v-ai-root #c4v-ai-panel {
        left: 12px !important;
        right: 12px !important;
        bottom: 126px !important;
        width: auto !important;
        max-width: none !important;
        height: 460px !important;
        max-height: calc(100vh - 150px) !important;
    }
}
