/* ===== Caplyst CHATBOT ("Invy") STYLING ===== */

/* Floating Trigger Button */
#chatbot-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563EB, #7C3AED);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 
        0 4px 18px rgba(37, 99, 235, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}

#chatbot-trigger:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 
        0 8px 24px rgba(37, 99, 235, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.2);
}

#chatbot-trigger:active {
    transform: scale(0.95) translateY(0);
}

.chatbot-trigger-icon,
.chatbot-trigger-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Badge Alert */
.chatbot-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #EF4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Pulse on init */
.chatbot-trigger-pulse {
    animation: triggerPulse 3s ease-in-out infinite;
}

@keyframes triggerPulse {
    0%, 100% { box-shadow: 0 4px 18px rgba(37, 99, 235, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(124, 58, 237, 0.7); }
}

/* Chat Panel Container */
.chatbot-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 15px 45px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    z-index: 99998;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Chat Header */
.chatbot-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.9), rgba(124, 58, 237, 0.9));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.chatbot-header-name {
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: -0.01em;
}

.chatbot-header-status {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.05rem;
}

.chatbot-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 6px #10B981;
}

.chatbot-minimize {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-minimize:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Chat Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.chatbot-msg {
    display: flex;
    gap: 0.65rem;
    max-width: 85%;
    align-items: flex-end;
}

.chatbot-msg-enter {
    animation: msgSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.chatbot-msg-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.chatbot-msg-bubble {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    font-size: 0.85rem;
    line-height: 1.45;
    word-break: break-word;
    text-align: left;
}

/* Bot Message */
.chatbot-msg-bot {
    align-self: flex-start;
}

.chatbot-msg-bot .chatbot-msg-bubble {
    background: #F3F4F6;
    color: #1F2937;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.chatbot-msg-bot .chatbot-msg-bubble strong {
    color: #111827;
}

/* User Message */
.chatbot-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-msg-user .chatbot-msg-bubble {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.15);
}

/* Quick Action Suggestion Buttons */
.chatbot-quick-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.5rem 0.85rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none; /* Hide standard Firefox scrollbar */
}

.chatbot-quick-actions::-webkit-scrollbar {
    display: none; /* Hide Chrome scrollbar */
}

.chatbot-quick-btn {
    flex-shrink: 0;
    padding: 0.5rem 0.85rem;
    border-radius: 9999px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: rgba(37, 99, 235, 0.04);
    color: #2563EB;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-quick-btn:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: #2563EB;
    transform: translateY(-1px);
}

/* Typing Indicator Animation */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.75rem 1.15rem;
    background: #F3F4F6;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.chatbot-typing span {
    width: 6px;
    height: 6px;
    background: #9CA3AF;
    border-radius: 50%;
    display: inline-block;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

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

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Chat Input Area */
.chatbot-input-area {
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: var(--white);
    display: flex;
    gap: 0.65rem;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    border: 1.5px solid var(--gray-200);
    border-radius: 9999px;
    padding: 0.65rem 1.15rem;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    background: var(--white);
    color: var(--gray-800);
    transition: all 0.2s;
}

.chatbot-input:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.06);
}

.chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.2);
}

.chatbot-send:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

/* Responsive adjustment for Mobile screens */
@media (max-width: 480px) {
    .chatbot-panel {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    
    #chatbot-trigger {
        bottom: 16px;
        right: 16px;
    }
}
