/* Styles pour l'interface de Code Review IA */

.code-review-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.code-review-modal {
    background: var(--background-color, #ffffff);
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

/* Header */
.review-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.review-header h2 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.review-progress {
    flex-grow: 1;
    text-align: center;
    margin: 0 20px;
}

.review-progress span {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 5px;
    opacity: 0.9;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.3);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    background: #4CAF50;
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Contenu principal */
.review-content {
    padding: 0;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* Phases */
.review-phase {
    min-height: 400px;
    padding: 30px;
}

/* Phase d'analyse */
.analysis-container {
    text-align: center;
}

.analysis-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.analysis-header i {
    font-size: 2rem;
    color: var(--primary-color, #667eea);
}

.analysis-header h3 {
    margin: 0;
    color: var(--text-color, #333);
}

.analysis-loader {
    margin-bottom: 30px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color, #667eea);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

.analysis-loader p {
    color: var(--text-secondary, #666);
    font-style: italic;
}

/* Résultats d'analyse */
.analysis-results {
    text-align: center;
    background: var(--background-secondary, #f8f9fa);
    border-radius: 10px;
    padding: 25px;
    margin-top: 20px;
}

.analysis-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.metric {
    background: white;
    padding: 20px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.metric-label {
    display: block;
    font-weight: 600;
    color: var(--text-color, #333);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.metric-value {
    display: block;
    font-weight: bold;
    color: var(--primary-color, #667eea);
    font-size: 1.3rem;
}


/* Phase de questions */
.question-container {
    max-width: 100%;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color, #e9ecef);
}

.question-type {
    display: flex;
    gap: 10px;
}

.type-badge {
    background: var(--primary-color, #667eea);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.points-badge {
    background: var(--success-color, #28a745);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.question-content {
    margin-bottom: 30px;
}

.question-text {
    font-size: 1.2rem;
    line-height: 1.5;
    margin-bottom: 20px;
    color: var(--text-color, #333);
}

.code-snippet {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid var(--primary-color, #667eea);
}

.code-snippet h5 {
    color: #ccc;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.code-snippet pre {
    margin: 0;
    color: #f8f8f2;
    font-family: 'Fira Code', 'Monaco', 'Menlo', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.response-area {
    margin-top: 25px;
}

.response-area label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-color, #333);
}

.response-textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.response-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #667eea);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.response-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.85rem;
}

#char-count.invalid {
    color: var(--danger-color, #dc3545);
}

#char-count.valid {
    color: var(--success-color, #28a745);
}

.min-chars {
    color: var(--text-secondary, #666);
}

/* Actions */
.question-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color, #e9ecef);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color, #6c757d);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-color, #28a745);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning-color, #ffc107);
    color: #212529;
}

.btn-warning:hover:not(:disabled) {
    background: #e0a800;
    transform: translateY(-1px);
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
}

/* Phase de résultats */
.results-container {
    text-align: center;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.results-header i {
    font-size: 2.5rem;
    color: #ffd700;
}

.final-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    padding: 30px;
    background: var(--background-secondary, #f8f9fa);
    border-radius: 15px;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--success-color, #28a745) 0deg, var(--success-color, #28a745) calc(var(--score, 85) * 3.6deg), #e9ecef calc(var(--score, 85) * 3.6deg));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.score-circle::before {
    content: '';
    width: 90px;
    height: 90px;
    background: white;
    border-radius: 50%;
    position: absolute;
}

.score-circle span {
    position: relative;
    z-index: 1;
}

#final-score-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-color, #333);
}

.score-suffix {
    font-size: 1.2rem;
    color: var(--text-secondary, #666);
}

.score-details {
    text-align: left;
}

.score-details h4 {
    color: var(--success-color, #28a745);
    margin-bottom: 10px;
}

.score-details p {
    color: var(--text-secondary, #666);
    line-height: 1.5;
}

/* Résumé des questions */
.questions-summary {
    text-align: left;
    margin-bottom: 30px;
}

.questions-summary h4 {
    margin-bottom: 20px;
    color: var(--text-color, #333);
}

.questions-breakdown {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.question-result {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.question-summary {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: var(--background-secondary, #f8f9fa);
    border-bottom: 1px solid var(--border-color, #e9ecef);
}

.question-number {
    background: var(--primary-color, #667eea);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
}

.question-type-mini {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color, #667eea);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.question-score {
    margin-left: auto;
    font-weight: bold;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
}

.question-score.good {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color, #28a745);
}

.question-score.medium {
    background: rgba(255, 193, 7, 0.1);
    color: var(--warning-color, #ffc107);
}

.question-score.poor {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color, #dc3545);
}

.question-feedback {
    padding: 15px 20px;
    color: var(--text-secondary, #666);
    line-height: 1.5;
    font-size: 0.9rem;
}

/* Badges d'évaluation */
.ai-evaluation-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 5px;
}

.temp-evaluation-badge {
    background: #ffc107;
    color: #212529;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 5px;
}

.manual-review-badge {
    background: #6c757d;
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 5px;
}

.question-score.pending {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
    border: 1px solid #6c757d;
}

/* Contenu détaillé des questions */
.question-content-breakdown {
    padding: 15px 20px;
}

.user-response-preview {
    background: var(--background-secondary, #f8f9fa);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    border-left: 3px solid var(--primary-color, #667eea);
}

.user-response-preview strong {
    color: var(--text-color, #333);
    display: block;
    margin-bottom: 5px;
}

/* Insights IA mini */
.ai-insights-mini {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    font-size: 0.8rem;
}

.ai-insights-mini strong {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.ai-insights-mini ul {
    margin: 0;
    padding-left: 15px;
    list-style-type: none;
}

.ai-insights-mini li {
    margin-bottom: 3px;
    position: relative;
}

.ai-insights-mini li::before {
    content: "•";
    color: var(--primary-color, #667eea);
    font-weight: bold;
    position: absolute;
    left: -10px;
}

.review-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

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

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .code-review-modal {
        width: 95%;
        max-width: none;
        margin: 20px;
    }
    
    .review-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .review-progress {
        margin: 0;
        width: 100%;
    }
    
    .final-score {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .score-details {
        text-align: center;
    }
    
    .question-actions {
        flex-direction: column;
    }
    
    .review-actions {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
}

/* Variables CSS pour les thèmes */
:root {
    --primary-color: #667eea;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --background-color: #ffffff;
    --background-secondary: #f8f9fa;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e9ecef;
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #1e1e1e;
        --background-secondary: #2d2d2d;
        --text-color: #ffffff;
        --text-secondary: #cccccc;
        --border-color: #404040;
    }
    
    .response-textarea {
        background: var(--background-secondary);
        color: var(--text-color);
    }
    
    .metric {
        background: var(--background-secondary);
    }
    
    .question-result {
        background: var(--background-secondary);
    }
    
    .score-circle::before {
        background: var(--background-color);
    }
}