/* ============================================
   TABLEAU DE SYNTHÈSE - STYLES
   ============================================ */

/* -------  LÉGENDE  ------- */
.legend-grid {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.legend-item p {
    margin: 0;
    line-height: 1.4;
}

.legend-item p small {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* -------  MARQUES (symboles)  ------- */
.mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
    cursor: default;
}

.mark-full {
    background: rgba(67, 181, 129, 0.18);
    color: #43b581;
    border: 2px solid rgba(67, 181, 129, 0.35);
}

.mark-partial {
    background: rgba(250, 166, 26, 0.15);
    color: #faa61a;
    border: 2px solid rgba(250, 166, 26, 0.3);
}

.mark-empty {
    background: transparent;
    color: var(--text-secondary);
    opacity: 0.3;
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
}

/* -------  TABLE RÉCAPITULATIF  ------- */
.table-wrapper {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    margin: 2rem 0;
}

.synthese-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
    background: var(--bg-secondary);
}

.synthese-table thead tr.bloc-header th {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

.synthese-table thead tr.bloc-header th.bloc-activite {
    background: var(--bg-primary);
    border-right: 2px solid var(--border-color);
    text-align: left;
    padding-left: 1.5rem;
    width: 220px;
    min-width: 220px;
}

.synthese-table thead tr.bloc-header th.bloc-b1 {
    background: rgba(0, 212, 255, 0.08);
    color: var(--primary-color);
    border-right: 2px solid var(--border-color);
}

.synthese-table thead tr.bloc-header th.bloc-b2 {
    background: rgba(102, 126, 234, 0.08);
    color: #7289da;
}

.synthese-table thead tr.comp-header th {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    position: relative;
    cursor: help;
    white-space: nowrap;
}

.synthese-table thead tr.comp-header th.act-header {
    text-align: left;
    padding-left: 1.5rem;
    color: var(--text-primary);
    border-right: 2px solid var(--border-color);
}

.synthese-table thead tr.comp-header th.b1-sub {
    background: rgba(0, 212, 255, 0.04);
}

.synthese-table thead tr.comp-header th.b2-sub {
    background: rgba(102, 126, 234, 0.04);
    border-left: 2px solid var(--border-color);
}

/* Tooltip sur les en-têtes */
.synthese-table thead tr.comp-header th[data-tooltip] {
    position: relative;
}

.synthese-table thead tr.comp-header th[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.78rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    max-width: 220px;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
    font-weight: 400;
}

.synthese-table thead tr.comp-header th[data-tooltip]:hover::after {
    opacity: 1;
}

/* Lignes du tableau */
.synthese-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    cursor: pointer;
}

.synthese-table tbody tr:last-child {
    border-bottom: none;
}

.synthese-table tbody tr:hover {
    background: rgba(0, 212, 255, 0.04);
}

.synthese-table tbody tr.active-row {
    background: rgba(0, 212, 255, 0.07);
    border-left: 4px solid var(--primary-color);
}

.synthese-table tbody td {
    padding: 0.9rem 0.5rem;
    text-align: center;
    vertical-align: middle;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.synthese-table tbody td:first-child {
    text-align: left;
    padding-left: 1.5rem;
    padding-right: 1rem;
    border-right: 2px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.synthese-table tbody td.b2-start {
    border-left: 2px solid var(--border-color);
}

.activity-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.activity-label strong {
    font-size: 0.9rem;
    color: var(--text-primary);
    display: block;
}

.activity-label span {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.activity-label .act-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--primary-color);
    color: #0a0e27;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* -------  SECTION DÉTAILS  ------- */
.details-section {
    margin-top: 3rem;
}

.activity-detail-card {
    background: var(--bg-secondary);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: border-color 0.3s;
    scroll-margin-top: 100px;
}

.activity-detail-card.highlighted {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.15);
}

.activity-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    cursor: pointer;
    user-select: none;
    gap: 1rem;
}

.activity-detail-header:hover {
    background: rgba(0, 212, 255, 0.04);
}

.activity-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.activity-index {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #667eea 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-header-text h3 {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin: 0 0 0.2rem;
}

.activity-header-text p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
}

.activity-marks-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mark-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.mark-badge.full {
    background: rgba(67, 181, 129, 0.15);
    color: #43b581;
    border: 1px solid rgba(67, 181, 129, 0.25);
}

.mark-badge.partial {
    background: rgba(250, 166, 26, 0.12);
    color: #faa61a;
    border: 1px solid rgba(250, 166, 26, 0.2);
}

.toggle-chevron {
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.toggle-chevron.open {
    transform: rotate(180deg);
}

.activity-detail-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.activity-detail-body.expanded {
    max-height: 1200px;
}

.activity-detail-body-inner {
    padding: 0 1.75rem 1.75rem;
    border-top: 1px solid var(--border-color);
}

.activity-context {
    padding: 1rem 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.65;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.competency-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comp-link-item {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 1rem;
    align-items: start;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 10px;
    border-left: 4px solid transparent;
    transition: border-color 0.2s;
}

.comp-link-item.comp-full {
    border-left-color: #43b581;
}

.comp-link-item.comp-partial {
    border-left-color: #faa61a;
}

.comp-link-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.comp-code {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.comp-link-content h4 {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0 0 0.3rem;
}

.comp-sub {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-style: italic;
    margin: 0 0 0.5rem;
    display: block;
}

.comp-why {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* -------  RESPONSIVE  ------- */
@media (max-width: 768px) {
    .legend-grid {
        gap: 1rem;
    }

    .activity-marks-summary {
        display: none;
    }

    .comp-link-item {
        grid-template-columns: 48px 1fr;
        gap: 0.75rem;
    }

    .activity-detail-header {
        padding: 1rem 1.25rem;
    }

    .activity-detail-body-inner {
        padding: 0 1.25rem 1.25rem;
    }
}
