/**
 * Styles pour le bilan du diagnostic
 * Extraits du template bilan-auto-diagnostic.php
 */

/* Conteneur principal */
.bilan-container {
    max-width: 1200px;
    margin: 0 auto;
}

.bilan-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.section-bilan {
    margin-bottom: 40px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.section-bilan h2 {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-bottom: 20px;
    color: #444;
}

/* Score global */
.score-global-container {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.score-global {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    border-radius: 50%;
    width: 200px;
    height: 200px;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.score-global.faible {
    background-color: #ffebee;
    border: 3px solid #ef5350;
}

.score-global.moyen {
    background-color: #fff8e1;
    border: 3px solid #ffca28;
}

.score-global.eleve {
    background-color: #e8f5e9;
    border: 3px solid #66bb6a;
}

.score-value {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.score-icon {
    font-size: 40px;
    margin: 10px 0;
}

.score-label {
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
}

/* Tableau de classement */
.classement-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.classement-table th,
.classement-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.classement-table th {
    background-color: #f9f9f9;
    font-weight: 600;
}

.classement-table tr.top-1 {
    background-color: rgba(255, 215, 0, 0.1);
}

.classement-table tr.top-2 {
    background-color: rgba(192, 192, 192, 0.1);
}

.classement-table tr.top-3 {
    background-color: rgba(205, 127, 50, 0.1);
}

.classement-table .niveau,
.classement-table .score {
    font-weight: bold;
}

.classement-table .niveau.faible,
.classement-table .score.faible {
    color: #e53935;
}

.classement-table .niveau.moyen,
.classement-table .score.moyen {
    color: #ff9800;
}

.classement-table .niveau.eleve,
.classement-table .score.eleve {
    color: #43a047;
}

/* Graphique des scores */
.graphique-scores {
    margin-top: 20px;
}

.score-item {
    margin-bottom: 15px;
}

.score-label {
    margin-bottom: 5px;
    font-weight: 500;
}

.score-bar-container {
    height: 25px;
    background-color: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
}

.score-bar {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: bold;
    transition: width 1s ease-in-out;
}

.score-bar.eleve {
    background-color: #66bb6a;
}

.score-bar.moyen {
    background-color: #ffb74d;
    color: #333;
}

.score-bar.faible {
    background-color: #ef5350;
}

/* Recommandations */
.recommandations-liste ul {
    padding-left: 20px;
}

.recommandations-liste li {
    margin-bottom: 12px;
    line-height: 1.5;
}

.recommandations-groupe {
    margin-bottom: 25px;
}

.recommandations-groupe.prioritaire h3 {
    color: #d32f2f;
}

.recommandations-groupe.moyenne h3 {
    color: #f57c00;
}

.recommandations-groupe.autre h3 {
    color: #388e3c;
}

/* Méthodologie */
.methodologie-explication {
    line-height: 1.6;
}

.methodologie-explication ol {
    margin-left: 20px;
    margin-bottom: 20px;
}

.methodologie-explication li {
    margin-bottom: 10px;
}

/* Styles pour la matrice de vulnérabilité avec smileys */
.vulnerability-matrix {
    max-width: 1200px;
    margin: 40px auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.vulnerability-matrix h2 {
    text-align: center;
    font-size: 32px;
    margin-bottom: 25px;
    color: #333;
}

.matrix-container {
    border-radius: 16px;
    padding: 30px;
}

.categories-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 0 80px 0 180px;
}

.category-item {
    text-align: center;
    flex: 1;
    font-size: 14px;
    color: #333;
    padding: 0 10px;
}

.risk-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

.risk-label {
    background-color: #003399;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    width: 150px;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    margin-right: 30px;
}

.risk-label .icon {
    margin-right: 10px;
    font-size: 20px;
}

.smileys-row {
    display: flex;
    justify-content: space-between;
    flex: 1;
}

.smiley-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex: 1;
    margin: 0 5px;
}

/* Section boutons */
.vulnerability-matrix .action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

.vulnerability-matrix .btn {
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    height: 48px;
    box-sizing: border-box;
}

.vulnerability-matrix .btn-outline {
    background-color: white;
    border: 2px solid #003399;
    color: #003399;
}

.vulnerability-matrix .btn-primary {
    background-color: #003399;
    color: white;
}

.vulnerability-matrix .btn-primary img {
    filter: brightness(0) invert(1);
    /* Make SVG white */
}

.vulnerability-matrix .btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Messages divers */
.no-data-message {
    color: #757575;
    font-style: italic;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
    text-align: center;
}

.diagnostic-date {
    text-align: center;
    color: #757575;
    margin-bottom: 20px;
}

/* Hide mobile cards on desktop */
.mobile-risk-cards {
    display: none;
}

/* Desktop legend styles */
.impact-legend {
    margin-bottom: 25px;
}

.legend-items {
    display: flex;
    justify-content: center;
    gap: 30px;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-smiley {
    width: 24px;
    height: 24px;
}

.legend-text {
    font-size: 14px;
    color: #666;
}

/* Legend button - Hidden on desktop */
.legend-button-container {
    display: none;
}

.btn-legend {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-legend:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* Legend modal */
.legend-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.legend-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
}

.close-modal {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #333;
}

.legend-modal h3 {
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.legend-items-modal {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.legend-item-modal {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.legend-item-modal .smiley-image {
    width: 30px;
    height: 30px;
}

.legend-item-modal .legend-text {
    font-size: 16px;
    color: #333;
}

/* Responsive for medium screens */
@media (max-width: 1200px) {
    .vulnerability-matrix {
        margin: 20px auto;
    }

    .vulnerability-matrix h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .matrix-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .risks-header {
        min-width: 800px;
    }

    .enjeu-row {
        min-width: 800px;
    }

    .empty-cell {
        width: 140px;
    }

    .enjeu-label {
        width: 140px;
        font-size: 13px;
        padding: 12px 15px;
    }

    .risks-header .risk-item {
        font-size: 13px;
        padding: 12px 8px;
    }

    .smiley-indicator {
        margin: 0 2px;
        padding: 8px;
    }
}

/* Responsive */
@media (max-width: 992px) {
    /* Hide desktop legend */
    .impact-legend.desktop-only {
        display: none;
    }

    /* Show legend button on mobile */
    .legend-button-container {
        display: block;
        text-align: center;
        margin-bottom: 20px;
    }

    .categories-header {
        padding: 0 40px 0 140px;
    }

    .category-item {
        font-size: 12px;
    }

    .risk-label {
        width: 120px;
        font-size: 14px;
        padding: 12px 15px;
    }

    .smiley-indicator {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .vulnerability-matrix {
        padding: 10px;
    }

    .categories-header {
        display: none;
    }

    .matrix-container {
        padding: 15px;
    }

    /* Mobile: Transform to grouped risk cards */
    .risks-header,
    .enjeu-row,
    .matrix-container {
        display: none !important;
        /* Hide desktop layout */
    }

    /* Mobile grouped cards layout - Horizontal slider */
    .mobile-risk-cards {
        display: flex;
        padding: 0 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        gap: 15px;
        padding-bottom: 10px;
    }

    .mobile-risk-cards::-webkit-scrollbar {
        height: 4px;
    }

    .mobile-risk-cards::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }

    .mobile-risk-cards::-webkit-scrollbar-thumb {
        background: #003399;
        border-radius: 2px;
    }

    .risk-level-card {
        background: white;
        border: #E0E0E0 1px solid;
        border-radius: 12px;
        overflow: hidden;
        transform: translateY(0);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        flex: 0 0 280px;
        height: auto;
    }

    .risk-level-card:hover,
    .risk-level-card:active {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    }

    /* Slide-in animation for cards - horizontal */
    .risk-level-card {
        animation: slideInLeft 0.6s ease-out forwards;
    }

    .risk-level-card:nth-child(2) {
        animation-delay: 0.1s;
    }

    .risk-level-card:nth-child(3) {
        animation-delay: 0.2s;
    }

    .risk-level-card:nth-child(4) {
        animation-delay: 0.3s;
    }

    .risk-level-card:nth-child(5) {
        animation-delay: 0.4s;
    }

    @keyframes slideInLeft {
        0% {
            transform: translateX(30px);
            opacity: 0;
        }

        100% {
            transform: translateX(0);
            opacity: 1;
        }
    }

    .risk-header {
        background: #003399;
        color: white;
        padding: 16px 20px;
        font-weight: 400;
        font-size: 16px;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-align: center;
    }

    .risk-icon {
        font-size: 24px;
    }

    .risk-icon img,
    .risk-header img {
        filter: brightness(0) invert(1);
        /* Make SVG white on blue background */
    }

    .risk-title {
        font-size: 14px;
        line-height: 1.2;
    }

    /* Desktop matrix icons */
    .risk-item .icon img {
        margin-right: 5px;
    }

    .risk-level-content {
        padding: 0;
        /* No max-height, no overflow - show all content */
    }

    /* Mobile card risk items (enjeux) */
    .risk-level-content .risk-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background-color: transparent !important;
        color: #333 !important;
        padding: 16px 20px;
        transition: background-color 0.2s ease;
    }

    .risk-item:last-child {
        border-bottom: none;
    }

    .risk-item:hover {
        background-color: #f8f9fa;
    }

    .risk-item-name {
        font-size: 15px;
        color: #333;
        flex: 1;
        margin-right: 15px;
        text-align: left;
    }

    .risk-item-smiley {
        font-size: 24px;
        min-width: 30px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .risk-item-smiley .smiley-image {
        border-radius: 50%;
        object-fit: cover;
    }

    /* Empty state */
    .risk-level-empty {
        padding: 20px;
        text-align: center;
        color: #666;
        font-style: italic;
    }

    .vulnerability-matrix .action-buttons {
        flex-direction: column;
        margin-top: 30px;
    }

    .vulnerability-matrix .btn {
        width: 100%;
        text-align: center;
    }
}

/* Impression */
@media print {
    .bilan-container {
        padding: 0;
    }

    .section-bilan {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #eee;
    }
}