/* AI Assistant Chat Styles */

/* Floating Button */
.ai-float-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s;
    z-index: 998;
}

.ai-float-button:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}

/* AI Chat Modal */
.ai-chat-modal {
    width: 90%;
    max-width: 900px;
    height: 80vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--radius) var(--radius) 0 0;
}

.ai-chat-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
}

#ai-connection-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.2);
}

.status-connected {
    background: rgba(16, 185, 129, 0.3) !important;
    color: #10f981;
}

.status-disconnected {
    background: rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5;
}

/* Chat Container */
.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100% - 60px);
    padding: 1rem;
}

/* Preset Questions */
.ai-preset-questions {
    background: var(--light-bg);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    max-height: 150px;
    overflow-y: auto;
}

.ai-preset-questions h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.preset-categories {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.preset-categories details {
    background: white;
    padding: 0.5rem;
    border-radius: var(--radius);
    min-width: 200px;
}

.preset-categories summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--primary-color);
}

.preset-categories ul {
    list-style: none;
    padding: 0;
    margin-top: 0.5rem;
}

.preset-categories li {
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.2s;
    font-size: 0.9rem;
}

.preset-categories li:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

/* Chat Messages */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    animation: slideIn 0.3s;
}

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

.chat-message.user {
    background: var(--primary-color);
    color: white;
    margin-left: 20%;
}

.chat-message.assistant {
    background: white;
    margin-right: 20%;
}

.chat-message.error {
    background: #fee;
    border-left: 3px solid #f00;
}

.chat-message.system {
    background: #e7f3ff;
    text-align: center;
    font-style: italic;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.message-header strong {
    font-weight: 600;
}

.timestamp {
    font-size: 0.75rem;
    opacity: 0.7;
}

.message-content {
    line-height: 1.6;
}

.message-content code {
    background: rgba(0,0,0,0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-family: monospace;
}

.message-content pre {
    background: rgba(0,0,0,0.05);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 0.5rem 0;
}

/* Typing Indicator */
.typing .message-content {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Input Container */
.ai-chat-input-container {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

#ai-chat-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    resize: vertical;
    min-height: 60px;
    max-height: 150px;
    font-family: inherit;
    font-size: 1rem;
}

#ai-chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.ai-chat-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ai-chat-controls button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-chat-modal {
        width: 95%;
        height: 90vh;
    }

    .preset-categories {
        flex-direction: column;
    }

    .preset-categories details {
        width: 100%;
    }

    .chat-message.user,
    .chat-message.assistant {
        margin-left: 0;
        margin-right: 0;
    }

    .ai-float-button {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
}