/* --- Box-sizing global --- */
*, *::before, *::after {
    box-sizing: border-box;
}

/* --- Mise en page générale et centrage --- */
body {
    font-family: sans-serif;
    color: #222;
    background: #fff;
    margin: 0 auto;
    max-width: 960px;
    padding: 0 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header fixe avec bords arrondis --- */
header {
    background-color: #FC6F6F;
    padding: 10px 20px;
    /*border-radius: 26px;*/
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 1000;
    /*box-shadow: 0 2px 12px rgba(0,0,0,0.04);*/

    /* Layout header : logo à gauche, date centrée, menu + hamburger à droite 
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
    box-sizing: border-box;*/
}

/* Conteneurs gauche, centre, droite */
.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
}

/* Logo à gauche */
.header-left .logo img {
    height: 40px;
    width: auto;
}

/* Date au centre */
.header-center {
  flex-grow: 1;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 1.15em;
  user-select: none;
  text-transform: capitalize;
}

/* Menu + hamburger à droite */
.header-right {
    /*position: relative;
    display: flex;
    align-items: center;*/
    gap: 1em;
    margin-left: auto; /* pousse le menu complètement à droite */
}

/* Navigation principale */
.main-nav {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* Bouton hamburger, toujours visible à droite */
.menu-toggle {
    font-size: 1.8em;
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    z-index: 1100;
    display: block;
}

/* Menu caché par défaut (sur tous les supports) */
.menu-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 120%; /* juste en dessous du header */
    right: 0;
    background: white;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    padding: 15px 20px;
    min-width: 240px;
    z-index: 1050;
}

/* Affichage du menu lorsque actif */
.menu-links.active {
    display: flex;
}

/* Conteneurs de liens dans le menu */
.left-links,
.right-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Style des liens */
.left-links a,
.right-links a,
.menu-admin > a {
    color: #222;
    font-size: 18px;
    text-decoration: none;
    border-radius: 6px;
    padding: 8px 12px;
    transition: background-color 0.3s;
    cursor: pointer;
}

/* Effet au survol des liens */
.left-links a:hover,
.right-links a:hover,
.menu-admin > a:hover {
    background-color: #fdeaea;
    color: #FC6F6F;
}

/* Sous-menu admin */
/* Conteneur Admin (parent) */
.menu-admin {
  position: relative;
  cursor: pointer;
}

/* Le lien principal Admin avec la flèche */
.menu-admin > a {
  padding-right: 18px;
  user-select: none;
  display: inline-block;
}

/* Sous-menu Admin caché par défaut */
.submenu-admin {
  display: none;
  position: absolute;
  top: 0;           /* aligne verticalement en haut */
  right: 100%;      /* décale le sous-menu tout à gauche du parent */
  background: white;
  border-radius: 8px 0 0 8px; /* arrondi sur les côtés à gauche */
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  min-width: 160px;
  flex-direction: column;
  padding: 8px 0;
  z-index: 1100;
  margin-right: 1px
}

/* Liens sous-menu admin */
.submenu-admin a {
  display: block;
  padding: 8px 16px;
  color: #222;
  font-size: 1em;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.3s;
}

.submenu-admin a:hover {
  background-color: #fdeaea;
  color: #FC6F6F;
}

/* Affichage du sous-menu au hover ou focus (accessibilité) */
.menu-admin:hover .submenu-admin,
.menu-admin:focus-within .submenu-admin {
  display: flex;
}

/* --- Décalage contenu à cause de header fixe --- */
main {
    margin-top: 70px; /* ajusté pour hauteur header + marge */
    margin-bottom: 50px;
    flex-grow: 1;
    width: 100%;
    padding: 20px 0;
}

/* --- Footer fixe --- */
footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100vw;
    max-width: none;
    /*border-radius: 18px 18px 0 0;*/
    /*box-shadow: 0 0 12px rgba(0,0,0,0.04);*/
    background-color: #FC6F6F;
    color: white;
    padding: 20px 0;
    text-align: center;
    z-index: 999;
}

/* --- Tables avec bordures --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    table-layout: auto;
    border: 1px solid #ddd;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
}

th {
    text-align: center;
    background-color: #FC6F6F !important;
    color: white;
}

h2, h3 {
    text-align: center;
}

/* --- Alternance des lignes --- */
.ligne-pair {
    background-color: #f9f9f9;
}

.ligne-impair {
    background-color: #ffffff;
}

.probleme {
    background-color: #FFBABA;
}

/* --- Formulaires et boutons --- */
form[method="post"] {
    margin: 0;
    display: flex;
    gap: 0px;
    align-items: center;
}

form[method="post"] input[type="number"],
form[method="post"] select {
    padding: 3px 5px;
    font-size: 0.9em;
    width: auto;
    max-width: 600px;
}

form[method="post"] button {
    padding: 3px 6px;
    cursor: pointer;
    font-size: 0.9em;
}

form label,
form input,
form select,
form textarea,
form button {
    display: block;
    width: 100%;
    max-width: 100%;
    font-size: 1em;
    margin-bottom: 12px;
}

input[type="checkbox"] {
    vertical-align: middle;
    margin: 0 6px 0 0;
}

/* --- Styles boutons --- */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
    color: white;
}

.btn-primary {
    background-color: #FC6F6F;
}

.btn-primary:hover {
    background-color: #e55959;
}

.btn-secondary {
    background-color: #888;
}

.btn-secondary:hover {
    background-color: #666;
    color: white;
}

.btn-troisieme {
    background-color: none;
    color: black;
    font-size: 15px;
    text-decoration: none;
}

.btn-troisieme:hover {
    background-color: #FC6F6F;
    color: white;
}

button.btn {
    border: none;
}

button.btn:hover {
    opacity: 0.9;
}

/* Liens généraux */
a {
    color: #000;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    text-decoration: none;
    color: #fdeaea;
}

/* --- Responsive : tout sous 800px --- */
@media (max-width: 800px) {

    header {
        flex-wrap: wrap;
        padding: 10px 15px;
    }

    

    /* --- Responsive tableaux mobiles --- */
    main {
        margin-top: 140px; /* Espace plus grand pour header + menu hamburger ouvert */
        padding: 10px;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
        width: 100%;
    }

    /* Cacher la ligne d’en-têtes */
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* Chaque ligne devient un bloc visuellement distinct */
    tr {
        border: 1px solid #ddd;
        margin-bottom: 1.5em;
        padding: 10px;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    }

    /* Style cellules avec légendes */
    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        white-space: normal;
        text-align: left;
        font-size: 14px;
    }

    /* Pas de bordure sur la dernière cellule */
    td:last-child {
        border-bottom: 0;
    }

    /* Affiche la légende avant le contenu (data-label) */
    td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        top: 10px;
        font-weight: bold;
        white-space: nowrap;
        color: #FC6F6F;
    }
}
