/* Chat Assistant */
#chat-assistant {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
}

.chat-window {
    position: absolute;
    bottom: 5rem;
    right: 0;
    width: 20rem;
    max-width: 90vw;
    max-height: 500px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: scaleUp 0.3s;
}

.dark-mode .chat-window {
    background: rgba(15, 15, 15, 0.9);
    border-color: var(--border-dark);
}

.chat-window.active {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-dot {
    width: 0.625rem;
    height: 0.625rem;
    background: white;
    border-radius: 9999px;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.chat-header h3 {
    color: white;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
}

.close-chat-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.3s;
}

.close-chat-btn:hover {
    color: white;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 20rem;
}

.message {
    display: flex;
}

.message.user-message {
    justify-content: flex-end;
}

.message.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 85%;
    padding: 0.875rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.user-message .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.bot-message .message-content {
    background: rgba(0, 0, 0, 0.05);
    color: inherit;
    border-bottom-left-radius: 0.25rem;
    border: 1px solid var(--border-light);
}

.dark-mode .bot-message .message-content {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-dark);
}

.loading-dots {
    display: flex;
    gap: 0.375rem;
    align-items: center;
}

.loading-dots span {
    width: 0.375rem;
    height: 0.375rem;
    background: var(--primary);
    border-radius: 9999px;
    animation: bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.chat-input-area {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.5rem;
}

.dark-mode .chat-input-area {
    background: rgba(255, 255, 255, 0.02);
    border-top-color: var(--border-dark);
}

#chat-input {
    flex: 1;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.3s;
}

.dark-mode #chat-input {
    background: var(--surface-dark);
    border-color: var(--border-dark);
    color: white;
}

#chat-input:focus {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.send-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 0.625rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.send-btn:hover {
    background: #2563eb;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-toggle-btn {
    position: relative;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 9999px;
    padding: 1rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    transition: all 0.3s;
}

.chat-toggle-btn:hover {
    transform: translateY(-4px);
    filter: brightness(1.1);
}

.chat-toggle-btn.active .chat-icon {
    display: none;
}

.chat-toggle-btn:not(.active) .status-indicator {
    display: none;
}

.status-indicator {
    position: absolute;
    top: -0.375rem;
    right: -0.375rem;
    width: 1rem;
    height: 1rem;
}

.status-indicator::before {
    content: '';
    position: absolute;
    inset: 0;
    background: white;
    border-radius: 9999px;
    animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
    opacity: 0.75;
}

.status-indicator::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #22c55e;
    border-radius: 9999px;
    border: 2px solid var(--primary);
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.dark-mode .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}
