/* ===================================================
   Module Doublons Professeurs — Styles
   Layout deux panneaux, accent violet #8B5CF6
   Modélisé sur integrite-textuelle-module.css
   =================================================== */

/* ===== CONTAINER PRINCIPAL ===== */
.dbl-container {
    display: grid;
    grid-template-columns: 340px 1fr;
    grid-template-rows: 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
    background: var(--card-bg, white);
    overflow: hidden;
    height: 100%;
}

/* ===== PANNEAU GAUCHE ===== */
.dbl-left-panel {
    background: var(--bg-tertiary, #f9fafb);
    border-right: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dbl-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: var(--card-bg, white);
    gap: 0.5rem;
    min-height: 0;
}

.dbl-panel-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.dbl-panel-count {
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    flex-shrink: 0;
}

.dbl-scan-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.7rem;
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: white;
    border: none;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.dbl-scan-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.35);
}

/* ===== LISTE SCROLLABLE ===== */
.dbl-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    min-height: 0;
}

/* ===== EMPTY STATE ===== */
.dbl-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-tertiary, #9ca3af);
}

.dbl-list-empty .dbl-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.dbl-list-empty p {
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

/* ===== CARTE GROUPE (panneau gauche) ===== */
.dbl-group-card {
    background: var(--card-bg, white);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.dbl-group-card:hover {
    border-color: #8B5CF6;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.1);
}

.dbl-group-card.active {
    border-color: #8B5CF6;
    background: rgba(139, 92, 246, 0.04);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.dbl-group-card.resolved {
    opacity: 0.4;
    pointer-events: none;
}

.dbl-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.dbl-card-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary, #111827);
    line-height: 1.3;
    flex: 1;
    margin-right: 0.5rem;
}

.dbl-score-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    color: white;
    flex-shrink: 0;
}

.dbl-card-names {
    font-size: 0.78rem;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

.dbl-card-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.72rem;
    color: var(--text-tertiary, #9ca3af);
}

.dbl-resolved-badge {
    font-size: 0.7rem;
    color: #22c55e;
    font-weight: 600;
    margin-top: 0.3rem;
}

/* ===== PANNEAU DROIT ===== */
.dbl-right-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary, #f3f4f6);
    min-height: 0;
}

.dbl-right-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ===== EMPTY STATE PANNEAU DROIT ===== */
.dbl-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    text-align: center;
    color: var(--text-tertiary, #9ca3af);
    padding: 3rem;
}

.dbl-empty-state .dbl-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.dbl-empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    margin: 0 0 0.5rem 0;
}

.dbl-empty-state p {
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0;
    max-width: 320px;
}

/* ===== HEADER COMPARAISON ===== */
.dbl-comparison-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    background: var(--card-bg, white);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    flex-shrink: 0;
}

.dbl-comparison-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dbl-comparison-title h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0;
}

.dbl-comparison-score {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.65rem;
    border-radius: 8px;
    color: white;
}

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

/* ===== EN-TÊTES PROFESSEURS (colonnes A / B) ===== */
.dbl-prof-headers {
    display: grid;
    grid-template-columns: 180px 1fr 1fr;
    gap: 0;
    background: var(--card-bg, white);
    border-bottom: 2px solid var(--border-color, #e5e7eb);
    flex-shrink: 0;
}

.dbl-prof-header-spacer {
    border-right: 1px solid var(--border-color, #e5e7eb);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
}

.dbl-prof-col-header {
    padding: 0.85rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dbl-prof-col-header.col-a {
    background: rgba(96, 165, 250, 0.05);
    border-right: 1px solid var(--border-color, #e5e7eb);
}

.dbl-prof-col-header.col-b {
    background: rgba(244, 114, 182, 0.05);
}

.dbl-prof-col-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dbl-prof-col-label.label-a { color: #3B82F6; }
.dbl-prof-col-label.label-b { color: #EC4899; }

.dbl-prof-col-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary, #111827);
}

.dbl-prof-col-sub {
    font-size: 0.78rem;
    color: var(--text-secondary, #6b7280);
}

.dbl-prof-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
    margin-right: 0.65rem;
}

.dbl-prof-avatar.avatar-a { background: linear-gradient(135deg, #3B82F6, #2563EB); }
.dbl-prof-avatar.avatar-b { background: linear-gradient(135deg, #EC4899, #DB2777); }

.dbl-prof-col-info {
    display: flex;
    align-items: center;
}

/* ===== CORPS DE COMPARAISON ===== */
.dbl-comparison-body {
    flex: 1;
    min-height: 0;
}

/* ===== SECTIONS ACCORDÉON ===== */
.dbl-section {
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.dbl-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    background: var(--bg-tertiary, #f9fafb);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.dbl-section-title:hover {
    background: rgba(139, 92, 246, 0.06);
}

.dbl-section.collapsed .dbl-section-content {
    display: none;
}

.dbl-chevron {
    transition: transform 0.2s;
    opacity: 0.5;
    font-size: 0.65rem;
}

.dbl-section.collapsed .dbl-chevron {
    transform: rotate(-90deg);
}

.dbl-section-stats {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    font-size: 0.68rem;
    font-weight: 600;
}

.dbl-section-stat-identical { color: #22c55e; }
.dbl-section-stat-similar { color: #f97316; }
.dbl-section-stat-conflict { color: #ef4444; }
.dbl-section-stat-unique { color: #8B5CF6; }

/* ===== LIGNES DE CHAMPS ===== */
.dbl-field-row {
    display: grid;
    grid-template-columns: 180px 1fr 1fr;
    gap: 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    min-height: 42px;
    align-items: stretch;
}

.dbl-field-row:last-child {
    border-bottom: none;
}

.dbl-field-label {
    padding: 0.6rem 1rem 0.6rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    background: var(--bg-tertiary, #f9fafb);
    border-right: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.dbl-field-val {
    padding: 0.6rem 1rem;
    font-size: 0.84rem;
    color: var(--text-primary, #111827);
    word-break: break-word;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-right: 1px solid rgba(0,0,0,0.03);
}

.dbl-field-val:last-child {
    border-right: none;
}

/* === ÉTATS DE COULEUR (les 4 couleurs sémantiques) === */

/* VERT : identique */
.dbl-field-row.state-identical .dbl-field-val {
    background: rgba(34, 197, 94, 0.07);
}

/* ORANGE : similaire / différence mineure */
.dbl-field-row.state-similar .dbl-field-val {
    background: rgba(249, 115, 22, 0.08);
}

/* ROUGE : contradiction */
.dbl-field-row.state-conflict .dbl-field-val {
    background: rgba(239, 68, 68, 0.08);
}

/* VIOLET : info unique (un seul côté) */
.dbl-field-row.state-unique .dbl-field-val.has-value {
    background: rgba(139, 92, 246, 0.08);
}

.dbl-field-row.state-unique .dbl-field-val.is-empty {
    background: transparent;
    color: var(--text-tertiary, #9ca3af);
    font-style: italic;
    font-size: 0.78rem;
}

/* === DARK MODE === */
[data-theme="dark"] .dbl-field-row.state-identical .dbl-field-val {
    background: rgba(34, 197, 94, 0.1);
    color: #bbf7d0;
}

[data-theme="dark"] .dbl-field-row.state-similar .dbl-field-val {
    background: rgba(249, 115, 22, 0.1);
    color: #fed7aa;
}

[data-theme="dark"] .dbl-field-row.state-conflict .dbl-field-val {
    background: rgba(239, 68, 68, 0.1);
    color: #fecaca;
}

[data-theme="dark"] .dbl-field-row.state-unique .dbl-field-val.has-value {
    background: rgba(139, 92, 246, 0.12);
    color: #ddd6fe;
}

/* Point coloré indicateur d'état */
.dbl-state-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4rem;
    flex-shrink: 0;
}

.state-identical .dbl-state-dot { background: #22c55e; }
.state-similar .dbl-state-dot { background: #f97316; }
.state-conflict .dbl-state-dot { background: #ef4444; }
.state-unique .dbl-state-dot { background: #8B5CF6; }

/* Valeur vide placeholder */
.dbl-empty-val {
    font-style: italic;
    opacity: 0.4;
    font-size: 0.78rem;
}

/* ===== TAGS (domaines expertise, projets) ===== */
.dbl-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin: 1px 2px;
    font-weight: 500;
    border: 1px solid transparent;
}

.dbl-tag.matched {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.25);
}

.dbl-tag.unique-a {
    background: rgba(96, 165, 250, 0.12);
    color: #1d4ed8;
    border-color: rgba(96, 165, 250, 0.25);
}

.dbl-tag.unique-b {
    background: rgba(244, 114, 182, 0.12);
    color: #be185d;
    border-color: rgba(244, 114, 182, 0.25);
}

[data-theme="dark"] .dbl-tag.matched { background: rgba(34, 197, 94, 0.2); color: #86efac; }
[data-theme="dark"] .dbl-tag.unique-a { background: rgba(96, 165, 250, 0.2); color: #93c5fd; }
[data-theme="dark"] .dbl-tag.unique-b { background: rgba(244, 114, 182, 0.2); color: #f9a8d4; }

/* ===== FOOTER ACTIONS ===== */
.dbl-action-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--card-bg, white);
    flex-shrink: 0;
    gap: 0.75rem;
}

.dbl-btn-keep {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s;
}

.dbl-btn-keep:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(34, 197, 94, 0.3);
}

.dbl-btn-merge {
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s;
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.25);
}

.dbl-btn-merge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.dbl-btn-dismiss {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dbl-btn-dismiss:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(107, 114, 128, 0.3);
}

.dbl-btn-secondary {
    background: var(--bg-tertiary, #e5e7eb);
    color: var(--text-primary, #111827);
    border: 1px solid var(--border-color, #d1d5db);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dbl-btn-secondary:hover {
    background: var(--border-color, #d1d5db);
}

/* ===== LÉGENDE ===== */
.dbl-legend {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
}

.dbl-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ===== LOADING ===== */
.dbl-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
    color: var(--text-tertiary, #9ca3af);
}

.dbl-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color, #e5e7eb);
    border-top-color: #8B5CF6;
    border-radius: 50%;
    animation: dbl-spin 0.8s linear infinite;
}

@keyframes dbl-spin {
    to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .dbl-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .dbl-left-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color, #e5e7eb);
        max-height: 280px;
    }

    .dbl-right-panel {
        min-height: 60vh;
    }

    .dbl-prof-headers,
    .dbl-field-row {
        grid-template-columns: 120px 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .dbl-prof-headers,
    .dbl-field-row {
        grid-template-columns: 100px 1fr 1fr;
        font-size: 0.78rem;
    }

    .dbl-field-label {
        font-size: 0.72rem;
        padding: 0.5rem 0.6rem;
    }

    .dbl-field-val {
        padding: 0.5rem 0.6rem;
        font-size: 0.78rem;
    }
}

/* ===== CHECKBOXES DE SÉLECTION ===== */
.dbl-field-checkbox {
    width: 15px;
    height: 15px;
    min-width: 15px;
    cursor: pointer;
    accent-color: #8B5CF6;
    margin: 0;
    flex-shrink: 0;
}

.dbl-section-check {
    width: 16px;
    height: 16px;
    min-width: 16px;
    cursor: pointer;
    accent-color: #8B5CF6;
    margin: 0 0.4rem 0 0;
    flex-shrink: 0;
}

.dbl-field-row.unchecked {
    opacity: 0.35;
    transition: opacity 0.2s ease;
}

.dbl-field-row.unchecked .dbl-field-val {
    background: transparent !important;
}

.dbl-selection-count {
    font-size: 0.78rem;
    color: #8B5CF6;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    background: rgba(139, 92, 246, 0.08);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    text-align: center;
    width: 100%;
}

[data-theme="dark"] .dbl-field-checkbox,
[data-theme="dark"] .dbl-section-check {
    accent-color: #a78bfa;
}

[data-theme="dark"] .dbl-selection-count {
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.15);
}
