/* ====================================
   PANEL D'AIDE - Comprendre la recherche RAG
   ==================================== */

/* Container pour grouper titre + bouton aide */
.panel-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Bouton Aide dans le header */
.btn-help {
    background: #3B4858;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.btn-help:hover {
    background: #3B4858;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(74, 90, 111, 0.3);
}

.btn-help i {
    font-size: 16px;
}

/* Panel latéral d'aide */
.help-panel {
    position: fixed;
    top: 90px;
    right: 0;
    width: 500px;
    height: calc(100vh - 90px); /* Ajusté pour correspondre au top: 90px */
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden; /* Important pour empêcher le débordement du panel */
    display: flex;
    z-index: 99999999;
    flex-direction: column;
    max-height: calc(100vh - 90px); /* Ajusté pour correspondre au top: 90px */
}

.help-panel[style*="display: block"] {
    transform: translateX(0);
}

.help-panel-header {
    background: #303D4E;
    color: white;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0; /* Empêche le header de se réduire */
}

.help-panel-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.help-panel-header .btn-close {
    background: #303D4E;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-panel-header .btn-close:hover {
    background: #303D4E;
    transform: rotate(90deg);
}

.help-panel-content {
    flex: 1; /* Prend tout l'espace disponible */
    overflow-y: auto !important; /* Scroll vertical forcé */
    overflow-x: hidden; /* Pas de scroll horizontal */
    padding: 24px;
    background: #f8f9fa;
    min-height: 0; /* Important pour que flex + overflow fonctionnent ensemble */
    max-height: calc(100vh - 90px - 84px); /* viewport - top du panel - hauteur du header */
}

/* Scrollbar personnalisée */
.help-panel-content::-webkit-scrollbar {
    width: 8px;
}

.help-panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.help-panel-content::-webkit-scrollbar-thumb {
    background: #303D4E;
    border-radius: 4px;
}

.help-panel-content::-webkit-scrollbar-thumb:hover {
    background: #303D4E;
}

/* Sections */
.help-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    animation: slideIn 0.5s ease-out;
}

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

.help-section h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #303D4E;
    padding-bottom: 12px;
}

.help-section h4 i {
    color: #303D4E;
    font-size: 20px;
}

.help-intro {
    font-size: 15px;
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Cards numérotées */
.help-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    margin-bottom: 12px;
    border-left: 4px solid #303D4E;
    transition: all 0.3s ease;
}

.help-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.help-card-number {
    width: 40px;
    height: 40px;
    background: #303D4E;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
}

.help-card-content {
    flex: 1;
}

.help-card-content strong {
    display: block;
    color: #2d3748;
    margin-bottom: 6px;
    font-size: 16px;
}

.help-card-content p {
    margin: 0;
    color: #4a5568;
    line-height: 1.5;
}

.help-card-content code {
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: #303D4E;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* Warning box */
.help-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 4px solid #ffc107;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.help-warning i {
    color: #ff9800;
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.help-warning strong {
    color: #856404;
}

/* Processus étape par étape */
.help-process {
    position: relative;
}

.help-step {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
}

.help-step:hover {
    border-color: #303D4E;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.help-step.critical {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.help-step.critical .step-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.step-icon {
    width: 48px;
    height: 48px;
    background: #303D4E;
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 16px;
}

.step-content p {
    margin: 0 0 8px 0;
    color: #4a5568;
    line-height: 1.5;
}

.step-content code {
    display: block;
    background: rgba(102, 126, 234, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    color: #303D4E;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    margin-top: 8px;
}

.help-example {
    margin-top: 12px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 6px;
    border-left: 3px solid #303D4E;
}

.help-example p {
    margin: 6px 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #2d3748;
}

/* Comparaison */
.help-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
}

.comparison-col {
    padding: 20px;
    border-radius: 12px;
    border: 3px solid;
}

.comparison-col.bad {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border-color: #ED7470;
}

.comparison-col.good {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
    border-color: #61C276;
}

.comparison-col h5 {
    margin: 0 0 16px 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comparison-col.bad h5 {
    color: #c53030;
}

.comparison-col.good h5 {
    color: #2f855a;
}

.comparison-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.comparison-list li {
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.5;
}

.result-box {
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}

.result-box.bad {
    background: #ED7470;
    color: white;
}

.result-box.good {
    background: #61C276;
    color: white;
}

.stats-box {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 8px;
}

.stats-box p {
    margin: 6px 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Cartes de recommandations */
.recommendation-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: white;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.recommendation-card:hover {
    border-color: #303D4E;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.rec-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    flex-shrink: 0;
}

.rec-icon.fast {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.rec-icon.balanced {
    background: #303D4E;
}

.rec-icon.deep {
    background: #303D4E;
}

.rec-content {
    flex: 1;
}

.rec-content strong {
    display: block;
    color: #2d3748;
    margin-bottom: 6px;
    font-size: 16px;
}

.rec-content p {
    margin: 4px 0;
    color: #4a5568;
    font-size: 14px;
}

.rec-content code {
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: #303D4E;
    font-family: 'Courier New', monospace;
}

.rec-use {
    font-style: italic;
    color: #718096 !important;
}

/* Code explanation */
.code-explanation {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 10px;
    margin-top: 16px;
}

.code-explanation p {
    margin: 0 0 12px 0;
    color: #cbd5e0;
}

.code-explanation code {
    color: #38bdf8;
    font-family: 'Courier New', monospace;
}

.code-explanation pre {
    background: #0f172a;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.code-explanation pre code {
    display: block;
    color: #fbbf24;
    font-size: 14px;
}

.code-note {
    background: rgba(102, 126, 234, 0.1);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #303D4E;
    color: #e2e8f0 !important;
    margin: 12px 0;
}

.code-explanation ul {
    margin: 12px 0;
    padding-left: 24px;
}

.code-explanation li {
    margin: 8px 0;
    color: #cbd5e0;
}

/* Métaphore */
.metaphor-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 24px;
    border-radius: 12px;
    border: 3px solid #fbbf24;
    margin-top: 16px;
}

.metaphor-text {
    font-size: 16px;
    font-style: italic;
    text-align: center;
    color: #78350f;
    margin: 0 0 20px 0;
    font-weight: 500;
}

.metaphor-text i {
    font-size: 20px;
    margin: 0 8px;
}

.metaphor-comparison {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 16px;
}

.metaphor-item {
    flex: 1;
    text-align: center;
    background: white;
    padding: 16px;
    border-radius: 10px;
    border: 2px solid #f59e0b;
}

.metaphor-item strong {
    display: block;
    color: #92400e;
    margin-bottom: 8px;
    font-size: 15px;
}

.metaphor-item p {
    margin: 0;
    color: #78350f;
    font-size: 14px;
}

.metaphor-arrow {
    font-size: 28px;
    color: #f59e0b;
    font-weight: bold;
    flex-shrink: 0;
}

/* Résumé */
.help-section.summary {
    border: 3px solid #303D4E;
}

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

.summary-point {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: white;
    padding: 12px;
    border-radius: 8px;
}

.summary-point i {
    color: #61C276;
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.summary-point p {
    margin: 0;
    color: #2d3748;
    font-size: 15px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .help-panel {
        width: 100%;
    }

    .help-comparison {
        grid-template-columns: 1fr;
    }

    .metaphor-comparison {
        flex-direction: column;
    }

    .metaphor-arrow {
        transform: rotate(90deg);
    }
}
