.ai-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.ai-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(0, 255, 136, 0.4);
}

.ai-chat-panel {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 380px;
    max-height: 520px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

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

.ai-chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #111, #1a1a1a);
    border-bottom: 1px solid #2a2a2a;
}

.ai-chat-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #00ff88;
}

.ai-chat-subtitle {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    max-height: 340px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ai-message {
    background: #222;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #ddd;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ai-message p {
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ai-message a {
    color: #00ff88;
    text-decoration: none;
}

.ai-message a:hover {
    text-decoration: underline;
}

.user-message {
    background: #00ff88;
    color: #000;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    align-self: flex-end;
    max-width: 80%;
    font-weight: 500;
}

.ai-message .typing-cursor {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: #00ff88;
    margin-left: 2px;
    animation: blink 0.8s infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.ai-chat-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #2a2a2a;
    gap: 8px;
}

#ai-chat-input {
    flex: 1;
    background: #222;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#ai-chat-input:focus {
    border-color: #00ff88;
}

#ai-chat-input::placeholder {
    color: #666;
}

.ai-chat-send {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #00ff88;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #000;
    transition: background 0.2s;
}

.ai-chat-send:hover {
    background: #00cc6a;
}

.ai-chat-send:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

.ai-chat-stop {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #ff4444;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    transition: background 0.2s;
}

.ai-chat-stop:hover {
    background: #cc3333;
}

/* Loading spinner */
.ai-spinner {
    display: flex;
    gap: 6px;
    padding: 4px 0;
}

.ai-spinner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff88;
    animation: ai-bounce 1.4s infinite ease-in-out both;
}

.ai-spinner-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-spinner-dot:nth-child(2) { animation-delay: -0.16s; }
.ai-spinner-dot:nth-child(3) { animation-delay: 0s; }

@keyframes ai-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.ai-sources {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.ai-sources-title {
    font-size: 12px;
    color: #00ff88;
    margin-bottom: 6px;
}

.ai-sources a {
    display: block;
    font-size: 13px;
    color: #aaa;
    padding: 3px 0;
    text-decoration: none;
}

.ai-sources a:hover {
    color: #00ff88;
}

/* Mobile */
@media (max-width: 480px) {
    .ai-chat-panel {
        width: calc(100vw - 32px);
        right: -8px;
        max-height: 70vh;
    }
}