* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f6f8;
    color: #222;
}

header {
    background: #ffffff;
    border-bottom: 1px solid #ddd;
    padding: 20px 30px;
}

header h1 {
    margin: 0 0 15px;
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    border: 0;
    border-radius: 6px;
    padding: 10px 16px;
    cursor: pointer;
}

nav button {
    background: #eeeeee;
}

.primary {
    background: #222;
    color: white;
}

.danger {
    background: #b42318;
    color: white;
}

main {
    padding: 30px;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: top;
}

th {
    background: #fafafa;
}

input,
select,
textarea {
    width: 100%;
    padding: 9px;
    margin-top: 5px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.status-active {
    color: #19733b;
    font-weight: bold;
}

.status-inactive {
    color: #b42318;
    font-weight: bold;
}

@media (max-width: 800px) {

    main {
        padding: 15px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    table {
        font-size: 14px;
    }
}


.badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    background: #f0f1f3;
    font-size: 13px;
    font-weight: bold;
}

.muted {
    color: #667085;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.summary-box {
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-block {
    white-space: pre-wrap;
    line-height: 1.5;
    margin-bottom: 20px;
}

@media (max-width: 800px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   CONSTRUCTEUR DE PROGRAMMES
   ============================================================ */

.program-main-card {
    margin-bottom: 25px;
}

.program-total-selected {
    font-weight: bold;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
}

.program-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
    gap: 25px;
    align-items: start;
}

.program-selection-toolbar {
    margin-bottom: 15px;
}

.program-level-card {
    padding: 0;
    overflow: hidden;
}

.program-level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 16px 18px;
    background: #fafafa;
    border-bottom: 1px solid #e4e7ec;
}

.program-level-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0;
}

.program-level-check input {
    width: auto;
    margin: 0;
}

.program-level-count {
    color: #667085;
    font-size: 13px;
    white-space: nowrap;
}

.program-competency-list {
    padding: 8px 18px 14px;
}

.program-competency-row {
    display: grid;
    grid-template-columns: 32px 115px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 9px 0;
    margin: 0;
    border-bottom: 1px solid #f0f1f3;
    cursor: pointer;
}

.program-competency-row:last-child {
    border-bottom: 0;
}

.program-competency-row:hover {
    background: #fafafa;
}

.program-competency-row input {
    width: auto;
    margin: 0;
}

.program-competency-code {
    color: #667085;
    font-size: 13px;
}

.program-competency-name {
    line-height: 1.35;
}

.program-auto-column {
    position: sticky;
    top: 20px;
}

.program-auto-card textarea {
    min-height: 135px;
}

.program-auto-card textarea.program-objectives {
    min-height: 220px;
}

.program-auto-card textarea.short {
    min-height: 95px;
}

.program-auto-title {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.program-auto-title h2 {
    margin-top: 0;
    margin-bottom: 5px;
}

.duration-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.duration-wrapper input {
    margin-bottom: 15px;
}

.duration-wrapper span {
    margin-bottom: 10px;
    color: #667085;
}

.program-save-bar {
    margin-top: 25px;
}

@media (max-width: 1050px) {

    .program-layout {
        grid-template-columns: 1fr;
    }

    .program-auto-column {
        position: static;
    }
}

@media (max-width: 650px) {

    .program-level-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .program-competency-row {
        grid-template-columns: 28px 1fr;
    }

    .program-competency-code {
        grid-column: 2;
    }

    .program-competency-name {
        grid-column: 2;
    }
}


.program-revision-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 12px;
    margin: 6px 0 12px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
}

.program-revision-row input {
    width: auto;
    margin-top: 3px;
}

.program-revision-row span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.program-revision-row small {
    color: #667085;
    line-height: 1.35;
}
