/* === AI Chat Styles === */

/* Chat Container */
.ai-chat-container {
    display: none;
    flex-direction: column;
    height: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* Chat Header */
.ai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple, #8b5cf6));
    color: white;
}

.ai-chat-header h4 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
}

.ai-chat-header-actions {
    display: flex;
    gap: 0.5rem;
}

.ai-chat-header-actions button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-chat-header-actions button:hover {
    background: rgba(255,255,255,0.3);
}

/* Chat Zone/Date Row */
.ai-chat-controls {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
}

.ai-chat-controls select,
.ai-chat-controls input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.8rem;
}

/* Chat Messages */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-chat-message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.ai-chat-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-chat-ai {
    align-self: flex-start;
}

.ai-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ai-chat-user .ai-chat-avatar {
    background: var(--accent-cyan);
}

.ai-chat-ai .ai-chat-avatar {
    background: linear-gradient(135deg, var(--accent-purple, #8b5cf6), var(--accent-cyan));
}

.ai-chat-content {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
}

.ai-chat-user .ai-chat-content {
    background: var(--accent-cyan);
    color: white;
    border-color: var(--accent-cyan);
}

.ai-chat-name {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    opacity: 0.7;
}

.ai-chat-text {
    font-size: 0.85rem;
    line-height: 1.5;
}

.ai-chat-text code {
    background: rgba(0,0,0,0.2);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Chat Input */
.ai-chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
}

.ai-chat-input-container input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.ai-chat-input-container input:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

.ai-chat-send {
    padding: 0.7rem 1.2rem;
    background: var(--accent-cyan);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-send:hover:not(:disabled) {
    opacity: 0.9;
}

/* Loading Spinner */
.ai-chat-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Report Actions */
.ai-chat-report-actions {
    background: var(--bg-dark);
    border: 1px solid var(--accent-green, #10b981);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.ai-chat-report-actions p {
    margin: 0 0 0.75rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ai-chat-action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ai-btn-primary {
    padding: 0.5rem 1rem;
    background: var(--accent-green, #10b981);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ai-btn-primary:hover {
    opacity: 0.9;
}

.ai-btn-secondary {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-btn-secondary:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Toggle Button */
.ai-chat-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, var(--accent-purple, #8b5cf6), var(--accent-cyan));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Responsive */
@media (max-width: 600px) {
    .ai-chat-container {
        height: 350px;
    }

    .ai-chat-message {
        max-width: 95%;
    }

    .ai-chat-action-buttons {
        flex-direction: column;
    }

    .ai-btn-primary,
    .ai-btn-secondary {
        width: 100%;
        text-align: center;
    }
}
