/* NeuroLens AI Chatbot Widget Styling */

.chatbot-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-gradient, linear-gradient(135deg, #111111 0%, #555555 100%));
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.15), 0 0 20px rgba(255, 255, 255, 0.1);
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
}

.chatbot-toggle-btn:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 15px 35px rgba(255, 255, 255, 0.25), 0 0 30px rgba(255, 255, 255, 0.15);
}

.chatbot-toggle-btn svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

.chatbot-toggle-btn.active svg {
    transform: rotate(90deg);
}

/* Notification pulse badge on toggle button */
.chatbot-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background-color: #ffffff;
    border: 2px solid #000;
    border-radius: 50%;
    box-shadow: 0 0 8px #ffffff;
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

/* Chatbot Container Window */
.chatbot-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 540px;
    max-height: calc(100vh - 130px);
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Chat Header */
.chatbot-header {
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.chatbot-avatar img {
    width: 22px;
    height: auto;
}

.chatbot-title-group h3 {
    font-family: 'Sora', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.chatbot-status {
    font-size: 0.75rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: monospace;
}

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

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

.chatbot-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

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

.chat-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    font-family: 'Inter', sans-serif;
    animation: msg-appear 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    word-break: break-word;
}

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

.chat-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--accent-gradient, linear-gradient(135deg, #111111 0%, #555555 100%));
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}

.chat-msg p {
    margin: 0 0 8px 0;
}

.chat-msg p:last-child {
    margin-bottom: 0;
}

.chat-msg ul {
    margin: 6px 0;
    padding-left: 18px;
}

.chat-msg li {
    margin-bottom: 4px;
}

/* Quick Action Suggestion Chips */
.chatbot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chip-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #cccccc;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.78rem;
    font-family: 'Sora', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: fit-content;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #888888;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

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

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; background-color: #ffffff; }
}

/* Chat Input Bar */
.chatbot-input-form {
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    padding: 10px 18px;
    color: #ffffff;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.2s ease;
}

.chatbot-input:focus {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
}

.chatbot-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-gradient, linear-gradient(135deg, #111111 0%, #555555 100%));
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

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

/* Mobile Responsiveness & Layout Alignment */
@media (max-width: 768px) {
    .chatbot-toggle-btn {
        bottom: 85px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .chatbot-window {
        position: fixed;
        top: 15px;
        bottom: 90px;
        left: 15px;
        right: 15px;
        width: auto;
        max-width: none;
        height: auto;
        max-height: none;
        border-radius: 20px;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 255, 255, 0.1);
    }

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

    .chatbot-messages {
        padding: 15px;
        gap: 12px;
    }

    .chat-msg {
        max-width: 90%;
        padding: 10px 14px;
        font-size: 0.88rem;
    }

    .chatbot-chips {
        gap: 6px;
        margin-top: 10px;
    }

    .chip-btn {
        padding: 7px 13px;
        font-size: 0.8rem;
        border-radius: 20px;
    }

    .chatbot-input-form {
        padding: 10px 12px;
    }

    .chatbot-input {
        padding: 9px 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        top: 10px;
        bottom: 85px;
        left: 10px;
        right: 10px;
        border-radius: 18px;
    }

    .chatbot-toggle-btn {
        bottom: 80px;
        right: 15px;
        width: 52px;
        height: 52px;
    }

    .chatbot-title-group h3 {
        font-size: 0.92rem;
    }

    .chatbot-status {
        font-size: 0.7rem;
    }
}
