/* multi-agents.css - Styles pour le système Multi-Agents */

/* Conteneur du workflow dans messagesArea */
.multi-agents-workflow-container {
    margin-bottom: 20px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    animation: slideIn 0.3s ease-out;
}

/* Header */
.multi-agents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.multi-agents-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4em;
    font-weight: 600;
    color: #3498db;
}

.multi-agents-title i {
    font-size: 1.3em;
}

.multi-agents-badge {
    background: #303D4E;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: 500;
}

.multi-agents-mode-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.multi-agents-mode-selector label {
    font-weight: 600;
    color: #4a5568;
}

.mode-select {
    padding: 8px 16px;
    border: 2px solid #3498db;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    background: white;
    color: #3498db;
    font-weight: 600;
    transition: all 0.3s;
}

.mode-select:hover {
    background: #3498db;
    color: white;
}

.mode-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Workflow */
.multi-agents-workflow {
    background: transparent;
    border-radius: 8px;
    padding: 0;
    max-height: none;
    overflow: visible;
}

.workflow-phase {
    margin-bottom: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.8);
    border-left: 4px solid #3498db;
    border-radius: 6px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.workflow-phase.completed {
    border-left-color: #61C276;
    background: #f0fdf4;
}

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

.phase-header i {
    color: #3498db;
    font-size: 1.2em;
}

.workflow-phase.completed .phase-header i {
    color: #61C276;
}

.phase-name {
    flex: 1;
    font-size: 1.1em;
    color: #2d3748;
}

.phase-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: #718096;
}

.phase-content {
    padding-left: 34px;
    color: #4a5568;
    line-height: 1.6;
}

.plan-info,
.research-info,
.refinement-info,
.evaluation-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plan-info div,
.research-info div,
.refinement-info div,
.evaluation-info div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-info i,
.research-info i,
.refinement-info i,
.evaluation-info i {
    color: #3498db;
    width: 20px;
}

.quality-score {
    font-size: 1.2em;
    font-weight: 700;
}

/* Messages */
.multi-agents-messages {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-height: 300px;
}

.multi-agents-message {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 10px;
    animation: slideIn 0.3s ease-out;
}

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

.multi-agents-message.assistant-message {
    background: linear-gradient(135deg, #3498db10, #764ba210);
    border-left: 4px solid #3498db;
}

.multi-agents-message.error-message {
    background: #fee;
    border-left: 4px solid #ED7470;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #2d3748;
}

.message-header i {
    color: #3498db;
}

.error-message .message-header i {
    color: #ED7470;
}

.message-time {
    margin-left: auto;
    font-size: 0.85em;
    color: #a0aec0;
    font-weight: 400;
}

.message-content {
    color: #2d3748;
    line-height: 1.8;
    white-space: pre-wrap;
}

.message-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.message-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.9em;
    color: #718096;
}

.message-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-stats i {
    color: #3498db;
}

/* Input Area */
.multi-agents-input-area {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.multi-agents-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s;
    background: white;
}

.multi-agents-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.multi-agents-textarea::placeholder {
    color: #a0aec0;
}

.multi-agents-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* Scrollbar personnalisée */
.multi-agents-workflow::-webkit-scrollbar,
.multi-agents-messages::-webkit-scrollbar {
    width: 8px;
}

.multi-agents-workflow::-webkit-scrollbar-track,
.multi-agents-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.multi-agents-workflow::-webkit-scrollbar-thumb,
.multi-agents-messages::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 10px;
}

.multi-agents-workflow::-webkit-scrollbar-thumb:hover,
.multi-agents-messages::-webkit-scrollbar-thumb:hover {
    background: #303D4E;
}

/* Responsive */
@media (max-width: 768px) {
    .multi-agents-container {
        padding: 12px;
    }

    .multi-agents-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .multi-agents-title {
        font-size: 1.2em;
    }

    .multi-agents-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

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

.fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* ==================== TREE OF THOUGHTS STYLES ==================== */

.tot-strategies {
    margin-top: 16px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03), rgba(118, 75, 162, 0.03));
    border-radius: 12px;
    border: 2px solid rgba(102, 126, 234, 0.15);
}

.tot-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

.tot-header i {
    color: #3B4757;
    font-size: 1.3em;
}

.tot-branches {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tot-branch {
    background: white;
    border-radius: 10px;
    padding: 16px;
    border: 2px solid #e2e8f0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tot-branch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #303D4E;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s ease;
}

.tot-branch.exploring {
    border-color: #fbbf24;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.05), rgba(251, 191, 36, 0.02));
    animation: pulse 2s ease-in-out infinite;
}

.tot-branch.evaluated {
    border-color: #3498db;
}

.tot-branch.selected {
    border-color: #61C276;
    background: linear-gradient(135deg, rgba(97, 194, 118, 0.08), rgba(97, 194, 118, 0.03));
    box-shadow: 0 8px 24px rgba(97, 194, 118, 0.2);
    transform: scale(1.02);
}

.tot-branch.selected::before {
    transform: scaleX(1);
    background: linear-gradient(90deg, #61C276, #4ade80);
}

.tot-branch.not-selected {
    opacity: 0.5;
    filter: grayscale(30%);
}

.tot-branch-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.tot-branch-icon {
    font-size: 1.4em;
    color: #3498db;
}

.tot-branch.selected .tot-branch-icon {
    color: #61C276;
}

.tot-branch-title {
    font-weight: 600;
    font-size: 1.05em;
    color: #2d3748;
}

.tot-branch-status {
    margin-left: auto;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    background: #e2e8f0;
    color: #4a5568;
}

.tot-branch.exploring .tot-branch-status {
    background: #fef3c7;
    color: #92400e;
}

.tot-branch.evaluated .tot-branch-status {
    background: #dbeafe;
    color: #1e40af;
}

.tot-branch.selected .tot-branch-status {
    background: #d1fae5;
    color: #065f46;
}

.tot-selected-badge {
    margin-left: 8px;
    padding: 4px 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, #61C276, #4ade80);
    color: white;
    font-size: 0.8em;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.tot-branch-content {
    padding-left: 40px;
}

.tot-strategy {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 1.02em;
}

.tot-reasoning {
    color: #4a5568;
    font-size: 0.95em;
    line-height: 1.6;
    font-style: italic;
}

.tot-branch-score {
    margin-top: 12px;
    padding: 0 40px;
}

.score-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.score-fill {
    height: 100%;
    background: #3498db;
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.score-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

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

.tot-summary {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(97, 194, 118, 0.1), rgba(74, 222, 128, 0.05));
    border-radius: 10px;
    border-left: 4px solid #61C276;
    animation: slideInUp 0.5s ease;
}

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

.tot-summary-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #065f46;
    font-weight: 500;
}

.tot-summary-content i {
    font-size: 1.5em;
    color: #f59e0b;
}

.tot-summary-details {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(97, 194, 118, 0.3);
    color: #047857;
    font-size: 0.95em;
    font-style: italic;
}

.tot-plan-summary {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==================== SELF-REFLECTION STYLES ==================== */

.reflection-container {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03), rgba(118, 75, 162, 0.03));
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.reflection-header {
    font-size: 1.1em;
    color: #303D4E;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(92, 136, 246, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.reflection-header i {
    font-size: 1.3em;
    color: #3B4757;
}

.reflection-metrics {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reflection-metric {
    background: white;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    animation: slideInUp 0.4s ease;
}

.reflection-metric:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.metric-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05em;
}

.metric-label i {
    color: 3498db;
}

.metric-bar {
    width: 100%;
    height: 12px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.metric-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-out;
    background: l#303D4E;
    position: relative;
    overflow: hidden;
}

.metric-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%);
    animation: shimmer 2s infinite;
}

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

.metric-score {
    font-size: 1.2em;
    font-weight: 700;
    color: #303D4E;
    text-align: right;
}

.metric-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.95em;
}

.detail-strength {
    color: #61C276;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 6px;
    font-weight: 500;
}

.detail-weakness {
    color: #dc2626;
    padding: 4px 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    font-weight: 500;
}

.detail-warning {
    color: #f59e0b;
    padding: 4px 10px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 6px;
    font-weight: 500;
}

.metric-info {
    padding: 12px;
    background: rgba(249, 250, 251, 0.8);
    border-radius: 8px;
    margin-top: 8px;
    font-size: 1em;
    font-weight: 500;
}

.bias-item {
    padding: 8px 12px;
    background: rgba(251, 146, 60, 0.08);
    border-left: 3px solid #f97316;
    border-radius: 6px;
    margin-top: 6px;
    font-size: 0.95em;
    color: #9a3412;
}

.alternative-item {
    padding: 8px 12px;
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid #3498db;
    border-radius: 6px;
    margin-top: 6px;
    font-size: 0.95em;
    color: #1e3a8a;
}

.reflection-summary {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03), rgba(118, 75, 162, 0.03));
    border: 2px solid rgba(92, 166, 246, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    animation: slideInUp 0.5s ease;
}

.summary-header {
    font-size: 1.15em;
    font-weight: 700;
    color: #303D4E;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-score {
    font-size: 1.5em;
    font-weight: 700;
    text-align: center;
    padding: 16px;
    margin-bottom: 16px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.summary-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    transition: all 0.2s;
}

.summary-row:hover {
    background: rgba(249, 250, 251, 1);
    transform: translateX(4px);
}

.summary-label {
    font-weight: 600;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-value {
    font-size: 1.2em;
    font-weight: 700;
    color: #3498db;
    padding: 4px 12px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 6px;
}

/* ==================== PANEL LATÉRAL ToT & SELF-REFLECTION ==================== */

.multi-agents-side-panel {
    position: fixed;
    top: 70px;
    right: 0;
    width: 500px;
    height: calc(90vh - 70px);
    background: white;
    border-left: 2px solid rgba(102, 126, 234, 0.3);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.multi-agents-side-panel.open {
    transform: translateX(0);
}

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #303D4E;
    color: white;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.side-panel-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.side-panel-header i {
    font-size: 1.3em;
}

.close-panel-btn {
    background: #303D4E;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-panel-btn:hover {
    background: #303D4E;
}

.side-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Ajuster le chat-container quand le panel est ouvert */
.chat-container.panel-open {
    margin-right: 400px;
    transition: margin-right 0.3s ease-in-out;
}

/* Styles ToT dans le panel latéral */
.side-panel-content .tot-strategies {
    background: rgba(102, 126, 234, 0.05);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    animation: slideInPanel 0.3s ease-out;
}

.side-panel-content .tot-header {
    font-size: 1.1em;
    font-weight: 600;
    color: #303D4E;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.side-panel-content .tot-subtitle {
    font-size: 0.9em;
    color: #6b7280;
    margin-bottom: 16px;
    font-style: italic;
}

/* Styles Self-Reflection dans le panel latéral */
.side-panel-content .reflection-container {
    background: rgba(92, 164, 246, 0.05);
    border: 2px solid rgba(92, 177, 246, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    animation: slideInPanel 0.3s ease-out;
}

.side-panel-content .reflection-header {
    font-size: 1.1em;
    font-weight: 600;
    color: #303D4E;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.side-panel-content .reflection-subtitle {
    font-size: 0.9em;
    color: #6b7280;
    margin-bottom: 16px;
    font-style: italic;
}

/* Animation pour les éléments du panel */
@keyframes slideInPanel {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 1400px) {
    .multi-agents-side-panel {
        width: 350px;
    }

    .chat-container.panel-open {
        margin-right: 350px;
    }
}

@media (max-width: 1200px) {
    .multi-agents-side-panel {
        width: 100%;
        top: 0;
        height: 100vh;
    }

    .chat-container.panel-open {
        margin-right: 0;
    }
}
