/* ============================================================
   STRAFOR AI ASSISTANT (GROQ)
============================================================ */

#saa-chatbot-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999999;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* 1. Floating Trigger Button */
.saa-floating-btn {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    /* Tech blue to purple */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.5);
    position: relative;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.saa-floating-btn:hover {
    transform: scale(1.1);
}

.saa-floating-img {
    width: 36px;
    height: 36px;
    z-index: 2;
    object-fit: contain;
}

/* Soft Pulsing Effect */
.saa-floating-pulse {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(139, 92, 246, 0.8);
    animation: saaPulse 2s infinite cubic-bezier(0.455, 0.03, 0.515, 0.955);
    z-index: 1;
}

@keyframes saaPulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* 2. Chat Window */
.saa-chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 380px;
    height: 520px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: saaOpenChat 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes saaOpenChat {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Header */
.saa-chat-header {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}

.saa-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.saa-profile-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 4px;
    object-fit: contain;
}

.saa-bot-name {
    margin: 0 0 2px 0;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.saa-bot-status {
    font-size: 11px;
    color: #e2e8f0;
    font-weight: 500;
}

.saa-header-actions {
    display: flex;
    gap: 8px;
}

.saa-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.saa-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.saa-action-btn.active {
    background-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Bulletproof Icons via CSS Data URI (Bypasses Cache & DOM Purifiers) */
#saa-voice-toggle {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'%3E%3C/polygon%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
}

#saa-voice-toggle.muted {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'%3E%3C/polygon%3E%3Cline x1='23' y1='9' x2='17' y2='15'%3E%3C/line%3E%3Cline x1='17' y1='9' x2='23' y2='15'%3E%3C/line%3E%3C/svg%3E");
}

#saa-chat-close {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
}

/* Hide any inner SVGs just in case they render later */
.saa-action-btn svg {
    display: none !important;
}

/* Messages Area */
.saa-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.saa-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.saa-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.saa-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.saa-msg.bot {
    align-self: flex-start;
    background: #ffffff;
    color: #334155;
    border-bottom-left-radius: 4px;
}

.saa-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Type Indicator */
.saa-typing {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: #fff;
    border-radius: 16px;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.saa-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: saaTyping 1.4s infinite ease-in-out both;
}

.saa-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.saa-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes saaTyping {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Input Area */
.saa-chat-input-area {
    padding: 15px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.saa-chat-input-area input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: #f8fafc;
}

.saa-chat-input-area input:focus {
    border-color: #3b82f6;
    background: #fff;
}

.saa-mic-btn {
    background: #f1f5f9;
    border: none;
    color: #64748b;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.saa-mic-btn:hover {
    background: #e2e8f0;
    color: #3b82f6;
}

.saa-mic-btn.listening {
    background: #ef4444;
    color: #fff;
    animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.saa-send-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.saa-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

/* Listening Indicator Text */
.saa-listening-text {
    position: absolute;
    top: -30px;
    left: 20px;
    font-size: 12px;
    color: #ef4444;
    font-weight: 600;
    background: #fef2f2;
    padding: 4px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.2);
}

/* Links inside bot message */
.saa-msg a {
    color: #3b82f6;
    text-decoration: underline;
}

@media (max-width: 480px) {
    #saa-chatbot-wrapper {
        bottom: 15px;
        right: 15px;
    }

    .saa-chat-window {
        width: calc(100vw - 30px);
        height: 80vh;
        bottom: 80px;
        right: 0;
    }
}