/* ===== RAG AGENTIC STYLES ===== */
/* Container de progression RAG */
.rag-progress-container {
    background: linear-gradient(135deg, #3B4757 0%, #3B4757 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.rag-progress-container.show {
    opacity: 1;
    transform: translateY(0);
}

.rag-progress-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.rag-progress-header i {
    font-size: 24px;
    animation: pulse 2s infinite;
}

/* Statuts des agents */
.rag-agents-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.agent-status {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.agent-status.agent-active {
    background: rgba(255, 255, 255, 0.25);
    border-color: #ffd700;
    animation: agentPulse 1s infinite;
}

.agent-status.agent-completed {
    background: rgba(40, 167, 69, 0.3);
    border-color: #28a745;
}

.agent-status.agent-error {
    background: rgba(220, 53, 69, 0.3);
    border-color: #dc3545;
}

.agent-icon {
    font-size: 28px;
    margin-bottom: 5px;
}

.agent-name {
    color: white;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 3px;
}

.agent-state {
    color: rgba(255, 255, 255, 0.8);
    font-size: 10px;
    height: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Barre de progression */
.rag-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.rag-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Action courante */
.rag-current-action {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    text-align: center;
    font-style: italic;
    min-height: 20px;
    animation: fadeInOut 2s infinite;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes agentPulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(255, 215, 0, 0);
        transform: scale(1.05);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
        transform: scale(1);
    }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .rag-agents-status {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .agent-icon {
        font-size: 20px;
    }
    
    .agent-name {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .rag-agents-status {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rag-progress-container {
        padding: 15px;
    }
}

/* Effet de brillance sur la progression */
.rag-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Style pour les résultats RAG */
.rag-result-section {
    background: linear-gradient(135deg, #3B4757 0%, #3B4757 100%);
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    color: white;
}

.rag-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 600;
}

.rag-result-content {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.rag-confidence {
    display: inline-block;
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-left: 10px;
}

/* Indicateur de pensée des agents */
.agent-thinking {
    display: inline-block;
    margin-left: 5px;
}

.agent-thinking span {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #ffd700;
    margin: 0 1px;
    animation: thinking 1.4s infinite ease-in-out both;
}

.agent-thinking span:nth-child(1) { animation-delay: -0.32s; }
.agent-thinking span:nth-child(2) { animation-delay: -0.16s; }

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

/* Forcer la visibilité du container RAG */
.rag-progress-container {
    position: relative;
    z-index: 100;
    margin-bottom: 20px;
}

/* Animation plus visible pour les agents actifs */
.agent-status.agent-active {
    animation: agentPulse 0.8s infinite !important;
    transform: scale(1.1);
}

/* Texte plus visible */
.agent-state {
    font-weight: bold;
    color: white !important;
}

.agent-status.agent-active .agent-state {
    color: #ffd700 !important;
}

.agent-status.agent-completed .agent-state {
    color: #28a745 !important;
}

/* Message RAG Progress comme un message de chat */
.rag-progress-message {
    width: 100%;
    margin: 20px 0;
}

.rag-progress-message .rag-progress-container {
    display: block !important;
    opacity: 1 !important;
    max-width: 100%;
    width: 100%;
}

/* Forcer la visibilité */
.rag-progress-container.show {
    display: block !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Animation de sortie */
.rag-progress-message.fade-out {
    animation: fadeOut 0.3s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* S'assurer que les agents sont visibles */
.rag-agents-status {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 10px !important;
    margin: 20px 0 !important;
}

/* Forcer l'affichage des états actifs */
.agent-status.agent-active {
    background: rgba(255, 215, 0, 0.3) !important;
    border-color: #ffd700 !important;
    transform: scale(1.05) !important;
}

.agent-status.agent-completed {
    background: rgba(40, 167, 69, 0.3) !important;
    border-color: #28a745 !important;
}

.agent-status.agent-completed .agent-icon {
    animation: checkmark 0.3s ease;
}

@keyframes checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Barre de progression animée */
.rag-progress-fill {
    transition: width 0.5s ease !important;
    background: linear-gradient(90deg, #ffd700, #ffed4e) !important;
    height: 100% !important;
    position: relative;
}

/* Texte d'action plus visible */
.rag-current-action {
    font-weight: bold !important;
    color: white !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    min-height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Agent actif plus visible */
.agent-status.agent-active .agent-state {
    font-weight: bold !important;
    color: #ffd700 !important;
    animation: pulse 1s infinite;
}

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

/* Sélecteur de type RAG */
.rag-type-selector {
    background: #3B4757;
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.rag-type-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: #333;
}

.rag-type-label {
    color: #303D4E;
    font-weight: 600;
    font-size: 14px;
}

.rag-type-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.rag-type-btn {
    position: relative;
    padding: 10px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

.rag-type-btn:hover {
    border-color: #fafafa;
    background: #5296D5;
    color: white;
    transform: translateY(-2px);
}

.rag-type-btn.active {
    background: #5296D5;
    color: white;
    border-color: transparent;
}

.rag-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    margin-bottom: 5px;
    z-index: 1000;
}

.rag-type-btn:hover .rag-tooltip {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .rag-type-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Sources RAG Agentic */
.rag-sources-section {
    margin-top: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
}

.rag-sources-section h4 {
    margin-bottom: 15px;
    color: #333;
}

.agent-sources {
    margin-bottom: 15px;
}

.agent-sources h5 {
    margin-bottom: 10px;
    color: #667eea;
    font-size: 14px;
}

.agent-sources .source-card {
    margin-left: 15px;
}

.source-chunk {
    font-size: 11px;
    color: #999;
    margin-left: 10px;
}