* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    padding: 10px;
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
}

h1 {
    background: #4a6b7c;
    color: white;
    padding: 8px;
    text-align: center;
    font-size: 16px;
    letter-spacing: 2px;
    margin: 0;
}

h2 {
    background: #4a6b7c;
    color: rgb(248, 248, 248);
    padding: 8px;
    text-align: center;
    font-size: 20px;
    letter-spacing: 2px;
    margin: 0;
}

.help-button {
    position: absolute;
    top: 10px;
    right: 20px;
    background: white;
    color: #4a6b7c;
    border: 2px solid #4a6b7c;
    padding: 6px 18px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
    letter-spacing: 0.5px;
}

.help-button:hover {
    background: #4a6b7c;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 107, 124, 0.3);
}

.container {
    position: relative;
}

.tabs {
    display: flex;
    background: #d8d8d8;
    overflow-x: auto;
    border-bottom: 3px solid #4a6b7c;
    flex-shrink: 0;
}

.tab-button {
    flex: 1;
    min-width: 130px;
    padding: 10px 12px;
    background: #d8d8d8;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: all 0.3s;
    border-right: 1px solid #c0c0c0;
    text-align: center;
}

.tab-button:hover {
    background: #c0c0c0;
}

.tab-button.active {
    background: white;
    color: #4a6b7c;
    border-bottom: 3px solid #4a6b7c;
    margin-bottom: -3px;
}

.tab-content {
    display: none;
    padding: 15px;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

.critere-title {
    font-size: 18px;
    color: #f4f6f7;
    margin-bottom: 12px;
    margin-top: 15px;
    font-weight: 700;
}

.critere-title:first-child {
    margin-top: 0;
}

.levels-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.level-card {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    min-height: 120px;
}

.level-card:hover {
    border-color: #4a6b7c;
    box-shadow: 0 4px 12px rgba(74, 107, 124, 0.15);
    transform: translateY(-2px);
}

.level-card.selected {
    border: 3px solid #4a6b7c;
    box-shadow: 0 6px 20px rgba(74, 107, 124, 0.3);
    transform: scale(1.02);
}

.level-card.selected::after {
    content: "✓";
    position: absolute;
    top: 5px;
    right: 5px;
    background: #4a6b7c;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
}

.level-card h3 {
    color: white;
    padding: 6px;
    border-radius: 5px;
    margin-bottom: 8px;
    text-align: center;
    font-size: 11px;
    line-height: 1.3;
}

.level-1 h3 {
    background: #c0504d;
}

.level-2 h3 {
    background: #e67e22;
}

.level-3 h3 {
    background: #f39c12;
}

.level-4 h3 {
    background: #7cb342;
}

.level-5 h3 {
    background: #4a7c59;
}

.level-card p {
    color: #333;
    line-height: 1.4;
    font-size: 14px;
    margin-bottom: 8px;
}

@media (max-width: 1400px) {
    .levels-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .levels-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .tab-button {
        min-width: 120px;
        font-size: 12px;
        padding: 12px 8px;
    }
}

@media (max-width: 768px) {
    .levels-container {
        grid-template-columns: 1fr;
    }
}

.print-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4a6b7c;
    color: white;
    border: none;
    padding: 12px 22px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    z-index: 100;
}

.print-button:hover {
    background: #3a5b6c;
    transform: scale(1.05);
}

footer {
    background: #a0a0a0;
    color: #333;
    text-align: center;
    padding: 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 0 0 8px 8px;
    letter-spacing: 0.5px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    color: #4a6b7c;
    margin-bottom: 20px;
    font-size: 20px;
    text-align: center;
}

.modal-form-group {
    margin-bottom: 20px;
}

.modal-form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.modal-form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ccc;
    border-radius: 5px;
    font-size: 15px;
}

.modal-form-group input:focus {
    outline: none;
    border-color: #4a6b7c;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.modal-button {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-button.confirm {
    background: #4a6b7c;
    color: white;
}

.modal-button.confirm:hover {
    background: #3a5b6c;
}

.modal-button.cancel {
    background: #ccc;
    color: #333;
}

.modal-button.cancel:hover {
    background: #999;
}

/* Styles pour la modale d'aide */
.help-modal-content {
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
}

.help-modal-content h3 {
    color: #4a6b7c;
    margin-bottom: 5px;
    font-size: 22px;
    text-align: center;
}

.help-subtitle {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-bottom: 25px;
    font-size: 16px;
}

.help-section {
    margin-bottom: 25px;
}

.help-section h4 {
    color: #4a6b7c;
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #4a6b7c;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.help-section p {
    color: #333;
    line-height: 1.6;
    margin-bottom: 10px;
}

.help-section ul {
    list-style: none;
    padding-left: 0;
}

.help-section li {
    color: #333;
    line-height: 1.8;
    margin-bottom: 8px;
    padding-left: 25px;
    position: relative;
}

.help-section li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #4a6b7c;
    font-weight: bold;
    font-size: 16px;
}

.help-final {
    margin-top: 15px;
    padding: 12px;
    background: #e3f2fd;
    border-left: 4px solid #4a6b7c;
    border-radius: 4px;
}

.help-close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
    width: 35px;
    height: 35px;
    line-height: 35px;
}

.help-close-button:hover {
    color: #4a6b7c;
    transform: rotate(90deg);
}

/* Styles d'impression */
@page {
    size: A4;
}

@media print {
    * {
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    html,
    body {
        height: 100%;
        margin: 0;
        padding: 0;
    }

  .tabs,
    .print-button,
    .help-button,
    .modal,
    .container > h1,
    .container > h2 {
        display: none !important;
    }

    body {
        padding: 0;
        margin-right: 1cm;
        margin-left: 1cm;
        margin-top: 1cm;
        margin-bottom: 0cm;
        background: white;
        height: auto;
        overflow: hidden;
    }

    .container {
        box-shadow: none;
        max-width: 100%;
        height: auto;
        overflow: visible;
        page-break-before: avoid;
        page-break-after: avoid;
    }

    .tab-content {
        display: none !important;
    }

    #print-view {
        display: block !important;
        padding: 0;
        page-break-before: avoid;
        page-break-after: avoid;
        page-break-inside: avoid;
        position: relative;
        min-height: 100vh;
    }

    .print-header {
        text-align: center;
        margin-bottom: 2mm;
        padding-bottom: 1.5mm;
        border-bottom: 2px solid #4a6b7c;
        page-break-before: avoid;
    }

    .print-header h1 {
        display: block !important;
        font-size: 12.5pt;
        margin: 0 0 1.5mm 0;
        color: #4a6b7c;
        font-weight: bold;
        background: none;
        padding: 0;
        line-height: 1.1;
    }

    .print-identity-date {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .print-header h2 {
        font-size: 9pt;
        color: #4a6b7c;
        margin: 0;
        font-weight: bold;
        background: none;
        padding: 0;
        line-height: 1.1;
    }

    .print-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.2mm;
        padding-bottom: 12mm;
    }

    .print-section {
        page-break-inside: avoid;
        margin-bottom: 0.8mm;
    }

    .print-section-title {
        font-weight: bold;
        color: white;
        background: #4a6b7c;
        font-size: 8pt;
        padding: 0.7mm 1.5mm;
        margin-bottom: 0.7mm;
        line-height: 1.1;
    }

    .print-critere {
        border: 1px solid #ccc;
        padding: 0.7mm;
        margin-bottom: 0.7mm;
        page-break-inside: avoid;
    }

    .print-critere-title {
        font-weight: bold;
        color: #4a6b7c;
        font-size: 7.2pt;
        margin-bottom: 0.7mm;
        border-bottom: 1px solid #4a6b7c;
        padding-bottom: 0.3mm;
        line-height: 1.1;
    }

    .print-levels {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0.7mm;
    }

    .print-level {
        border: 1px solid #ccc;
        padding: 0.7mm;
        font-size: 5.8pt;
        text-align: center;
        background: #f9f9f9;
        line-height: 1.1;
    }

    .print-level.selected {
        border: 2px solid #4a6b7c;
        background: #e3f2fd;
        font-weight: bold;
    }

    .print-level-title {
        font-weight: bold;
        padding: 0.4mm;
        color: white;
        border-radius: 1px;
        margin-bottom: 0.4mm;
        font-size: 6.3pt;
        line-height: 1.05;
    }

    .print-level.level-1 .print-level-title {
        background: #c0504d;
    }

    .print-level.level-2 .print-level-title {
        background: #e67e22;
    }

    .print-level.level-3 .print-level-title {
        background: #f39c12;
    }

    .print-level.level-4 .print-level-title {
        background: #7cb342;
    }

    .print-level.level-5 .print-level-title {
        background: #4a7c59;
    }

    .print-level-content {
        line-height: 1.1;
    }

    footer {
        display: block !important;
        position: fixed;
        bottom: 10px;
        left: 0;
        right: 0;
        margin: 0;
        padding: 1.5mm;
        font-size: 6.3pt;
        background: #a0a0a0;
        text-align: center;
        page-break-before: avoid;
        page-break-after: avoid;
        page-break-inside: avoid;
        line-height: 1.1;
    }
}

#print-view {
    display: none;
}