/**
 * AI Brain Chat - Styles
 * Clean, modern chat interface
 */

/* ==================== Chat Section ==================== */

.ai-brain-chat-section {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.ai-brain-chat-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #1a1a1a;
}

/* ==================== Chat Container ==================== */

.chat-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 700px;
}

/* ==================== Chat Status Bar ==================== */

.chat-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6c757d;
}

.status-dot.status-ready {
    background: #28a745;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.4);
}

.status-dot.status-loading {
    background: #ffc107;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.status-error {
    background: #dc3545;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
}

.chat-stats {
    font-size: 12px;
    color: #6c757d;
}

/* ==================== Chat Messages Area ==================== */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f3f5;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #868e96;
}

/* Welcome Message */

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #495057;
}

.welcome-message h3 {
    font-size: 24px;
    margin-bottom: 12px;
    color: #212529;
}

.welcome-message p {
    font-size: 16px;
    margin-bottom: 24px;
}

.example-questions {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.example-questions p {
    margin-bottom: 12px;
    font-weight: 600;
}

.example-questions ul {
    list-style: none;
    padding: 0;
}

.example-questions li {
    padding: 8px 0;
    color: #6c757d;
    font-style: italic;
}

/* Chat Messages */

.chat-message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
}

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

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

.message-author {
    font-weight: 600;
    font-size: 14px;
    color: #495057;
}

.message-time {
    font-size: 12px;
    color: #adb5bd;
}

.message-content {
    padding: 12px 16px;
    border-radius: 8px;
    line-height: 1.6;
    font-size: 15px;
}

.message-stats {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #6c757d;
}

/* User Message */

.user-message .message-content {
    background: #007bff;
    color: white;
    margin-left: 40px;
    border-bottom-right-radius: 4px;
}

/* AI Message */

.ai-message .message-content {
    background: #f8f9fa;
    color: #212529;
    margin-right: 40px;
    border-bottom-left-radius: 4px;
    border: 1px solid #e9ecef;
}

.ai-message code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.ai-message strong {
    color: #495057;
}

/* System Message */

.system-message .message-content {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    text-align: center;
    font-size: 14px;
}

/* Loading Message */

.loading-message .message-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6c757d;
    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;
}

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

.loading-text {
    color: #6c757d;
    font-style: italic;
}

/* ==================== Chat Input ==================== */

.chat-input-container {
    border-top: 1px solid #e9ecef;
    padding: 16px 20px;
    background: #f8f9fa;
}

.chat-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.chat-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-options {
    display: flex;
    gap: 16px;
    align-items: center;
}

.chat-options label {
    font-size: 14px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-options select {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.send-btn {
    padding: 10px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.send-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.send-btn:active {
    transform: translateY(0);
}

.send-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* ==================== Sources Panel ==================== */

.sources-panel {
    border-top: 1px solid #e9ecef;
    padding: 16px 20px;
    background: #f8f9fa;
    max-height: 200px;
    overflow-y: auto;
}

.sources-panel h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #495057;
}

.source-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
}

.source-number {
    width: 24px;
    height: 24px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.source-details {
    flex: 1;
}

.source-name {
    font-size: 14px;
    font-weight: 500;
    color: #212529;
    margin-bottom: 4px;
}

.source-meta {
    font-size: 12px;
    color: #6c757d;
    display: flex;
    gap: 16px;
}

.source-meta a {
    color: #007bff;
    text-decoration: none;
}

.source-meta a:hover {
    text-decoration: underline;
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
    .chat-container {
        height: 600px;
    }

    .user-message .message-content {
        margin-left: 20px;
    }

    .ai-message .message-content {
        margin-right: 20px;
    }

    .chat-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .send-btn {
        width: 100%;
    }
}
