/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 350px;
    height: 500px;
    background: rgba(17, 17, 17, 0.95);
    /* More opaque background */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.chat-widget.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.chat-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(74, 222, 128, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

.chat-toggle-btn:hover {
    transform: scale(1.05);
    background: var(--primary-dark);
}

.chat-toggle-btn.hidden {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}

.chat-header {
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.chat-status {
    font-size: 12px;
    color: #4ade80;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
}

.close-chat {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.close-chat:hover {
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.ai-message {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.user-message {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 8px;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    outline: none;
}

#chat-input:focus {
    border-color: var(--primary);
}

.send-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-btn:hover {
    background: var(--primary-dark);
}

/* Typing Indicator */
.typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

@media (max-width: 480px) {
    .chat-widget {
        width: calc(100% - 32px);
        bottom: 80px;
        right: 16px;
        left: 16px;
    }
}