/**
 * AI MODULE - ISOLATED STYLES
 * Prefix: .module-isolated-ai-*
 * Design: Premium UI with gradients and animations
 */

/* ==========================================================================
   WRAPPER & LAYOUT
   ========================================================================== */

.module-isolated-ai-wrapper {
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

.module-isolated-ai-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.module-isolated-ai-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ==========================================================================
   MODEL SELECTOR
   ========================================================================== */

.model-selector {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 2px solid var(--color-border-primary, #e0e0e0);
    background: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-selector:hover {
    border-color: var(--primary-color, #667eea);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* ==========================================================================
   FEATURES PANEL
   ========================================================================== */

.module-isolated-ai-features {
    display: flex;
    flex-direction: column;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.feature-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--color-border-primary, #e0e0e0);
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
    border-color: var(--primary-color, #667eea);
}

.feature-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.feature-content {
    flex: 1;
}

.feature-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--color-text-primary, #333);
}

.feature-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-secondary, #666);
    line-height: 1.5;
}

/* ==========================================================================
   CHAT PANEL
   ========================================================================== */

.module-isolated-ai-chat {
    display: flex;
    flex-direction: column;
}

.chat-card {
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-border-primary, #e0e0e0);
    margin-bottom: 1rem;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-secondary, #999);
}

.empty-chat i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ccc;
}

.empty-chat p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.empty-chat small {
    font-size: 0.9rem;
    color: #bbb;
}

.chat-message {
    display: flex;
    gap: 1rem;
    animation: fadeInSlide 0.3s ease;
}

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

.message-avatar {
    font-size: 2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-message .message-content {
    background: white;
    color: var(--color-text-primary, #333);
}

.message-content {
    flex: 1;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.message-time {
    opacity: 0.7;
    font-size: 0.8rem;
}

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

.message-text pre {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.message-text code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.chat-input-container {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
}

/* ==========================================================================
   RAG DOCUMENTS SECTION
   ========================================================================== */

.module-isolated-ai-rag {
    margin-top: 2rem;
}

.rag-section summary {
    cursor: pointer;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    list-style: none;
}

.rag-section summary:hover {
    background: linear-gradient(135deg, #e8f0fe 0%, #f8f9fa 100%);
    color: var(--primary-color, #667eea);
}

.rag-section summary i {
    color: var(--primary-color, #667eea);
}

.rag-section summary::marker {
    display: none;
}

.rag-section[open] summary {
    margin-bottom: 1.5rem;
}

.section-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.document-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--color-border-primary, #e0e0e0);
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
}

.document-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color, #667eea);
}

.document-icon {
    font-size: 2rem;
}

.document-info {
    flex: 1;
}

.document-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    color: var(--color-text-primary);
}

.document-info small {
    color: var(--color-text-secondary, #666);
    font-size: 0.85rem;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 0.5rem;
    border: 1px solid var(--color-border-primary, #e0e0e0);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--primary-color, #667eea);
    border-color: var(--primary-color, #667eea);
    color: white;
}

.btn-icon.btn-danger:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
    .module-isolated-ai-grid {
        grid-template-columns: 1fr;
    }
    
    .chat-card {
        height: 500px;
    }
}

@media (max-width: 768px) {
    .module-isolated-ai-wrapper {
        padding: 1rem;
    }
    
    .module-isolated-ai-stats {
        grid-template-columns: 1fr;
    }
    
    .feature-card {
        padding: 1rem;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }
    
    .chat-card {
        height: 400px;
    }
    
    .chat-input-container {
        flex-direction: column;
    }
    
    .documents-grid {
        grid-template-columns: 1fr;
    }
}
