/* =====================
   Palette de couleurs
===================== */
:root {
    --color-bg: #F9FAFB;
    --color-text: #111827;
    --color-primary: #2563EB;
    --color-primary-hover: #1D4ED8;
    --color-border: #E5E7EB;
    --color-error: #DC2626;
    --color-success: #16A34A;
}

/* =====================
   Reset & typographie
===================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', 'Roboto', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
}

h1, h2, h3 {
    margin: 0 0 10px 0;
}

h1 { font-size: 22px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }

/* =====================
   Menu principal
===================== */
nav {
    position: relative; /* pour que le z-index des enfants fonctionne */
    background-color: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

nav a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

nav a:hover {
    color: var(--color-primary-hover);
}

/* =====================
   Main content
===================== */
main {
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 15px;
}

/* =====================
   Footer
===================== */
footer {
    text-align: center;
    font-size: 0.9rem;
    padding: 15px 0;
    border-top: 1px solid var(--color-border);
    margin-top: 30px;
    color: #6B7280;
}

/* =====================
   Messages (flash)
===================== */
.error {
    color: var(--color-error);
    font-size: 0.9rem;
}

.success {
    color: var(--color-success);
    font-size: 0.9rem;
}

/* =====================
   Formulaires
===================== */
form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

label {
    font-weight: 500;
    margin-bottom: 5px;
}

input, select, textarea {
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
}

input[type="submit"], button {
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 1rem;
    transition: background-color 0.2s;
}

input[type="submit"]:hover,
button:hover {
    background-color: var(--color-primary-hover);
}

/* =====================
   Tables classiques
===================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th, td {
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    text-align: left;
}

th {
    background-color: #F3F4F6;
}

tr:nth-child(even) {
    background-color: #FAFAFA;
}

/* =====================
   Table responsive (DIV)
===================== */
.table {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}

.table-header,
.table-row {
    display: flex;
    flex-wrap: wrap;
}

.table-header {
    background-color: #F3F4F6;
    font-weight: bold;
}

.table-row {
    border-top: 1px solid var(--color-border);
}

.cell {
    flex: 1 1 25%;
    padding: 10px;
    min-width: 150px;
}

.actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* =====================
   Responsive (tables & layout)
===================== */
@media (max-width: 768px) {

    nav {
        flex-direction: column;
        gap: 5px;
    }

    .table-header {
        display: none;
    }

    .table-row {
        flex-direction: column;
        border-bottom: 1px solid var(--color-border);
        margin-bottom: 10px;
        padding: 10px;
    }

    .cell {
        flex: 1 1 100%;
        padding: 5px 0;
    }

    .cell::before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        width: 120px;
    }

    .menu-links {
        position: absolute;
        top: 100%;              /* juste sous l’entête */
        right: 0;
        background: #fff;
        width: 100%;
        border-bottom: 1px solid var(--color-border);
        box-shadow: 0 4px 10px rgba(0,0,0,0.15);
        order: 2;              /* 👈 passe SOUS le bouton */
        display: none;
        flex-direction: column;
        align-items: flex-start;
        margin-top: 10px;
    }

    .menu-links.open {
        display: flex;
    }
    
    .nav-right {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;        /* 👈 autorise le retour à la ligne */
        justify-content: flex-end;
    }
}

/* ==================================================
   DASHBOARD
   ================================================== */

/* Titre */
.page-title {
    margin-bottom: 5px;
    text-align: center;
}

.subtitle {
    color: #6B7280;
    margin-bottom: 30px;
    text-align: center;
}

/* KPI cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.kpi-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    text-align: center;
}

.kpi-card h3 {
    font-size: 15px;
    margin-bottom: 10px;
    color: #374151;
}

.kpi-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--color-primary);
}

.kpi-label {
    font-size: 13px;
    color: #6B7280;
}

.progress-container {
    position: relative;
    height: 28px;
    background: #E5E7EB;
    border-radius: 30px;
    margin-bottom: 40px;
    margin-top: 40px;
}

.progress-bar {
    height: 100%;
    background: #85a5ed;
    border-radius: 20px 0 0 20px; /* gauche arrondie */
}

.jalon-icon {
    position: absolute;
    top: -16px;          /* au-dessus de la barre */
    font-size: 28px;
    display: block;
    cursor: pointer;
    text-decoration: none;   /* supprime le soulignement */
    
}

.arrival-icon {
    position: absolute;
    right: 0;
    top: -26px;
    font-size: 40px;
}

.jalon-icon {
    color: var(--color-primary);
    text-decoration: none;
    color: initial;
}

/* Statuts */
.jalon-icon.termine {
    color: var(--color-success) !important; /* vert */
}

.jalon-icon.en_cours {
    color: var(--color-primary) !important; /* bleu */
}

.jalon-icon.prevu {
    color: red !important; /* gris */
}

.semester-mark {
    position: absolute;
    top: 4px;
    width: 2px;
    height: 20px;
    background-color: #9CA3AF; /* gris discret */
    opacity: 0.8;
}

.menu-toggle {
    display: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 10; /* assure qu’il est au-dessus */
}
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        order: 1;
    }
}

/* =====================
   Pages entités (commun)
===================== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
}

.btn-secondary {
    background: #E5E7EB;
    color: #111827;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
}

.card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

/* ===== LISTE ===== */

.list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    text-decoration: none;
}

.list-main h3 {
    margin: 0;
    font-size: 16px;
}

.list-actions a {
    margin-left: 10px;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

/* ===== BADGES ===== */

.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.badge.termine { background: #DCFCE7; color: #166534; }
.badge.en { background: #DBEAFE; color: #1E40AF; }
.badge.prevu { background: #FEE2E2; color: #991B1B; }

/* ===== SHOW ===== */

.field {
    margin-bottom: 15px;
}

.field .label {
    display: block;
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 3px;
}

/* ===== FORM ===== */

.form-card form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
    .list-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .main-nav {
        position: relative; /* référence pour le menu */
    }
}
/* =====================
   HEADER / NAV
===================== */
.main-nav {
    width: 100%;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 10px 20px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}
.main-nav {
        flex-wrap: wrap;
    }
.nav-left .site-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    margin-left: 2px;
}
.nav-right .site-name {
    margin-right: auto; /* 👈 pousse le bouton à droite */
    font-size: 26px;
    font-weight: 600;
    color: var(--color-primary);
}
#these_inclureModele {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 15%;
}

#these_inclureModele label {
    display: inline;
    margin: 0;
}
