/* Agenda partagé — feuille de style de base.
   Cible : écran de 375 px minimum, sans défilement horizontal (ENF-01). */

:root {
    --fond: #f8fafc;
    --carte: #ffffff;
    --texte: #0f172a;
    --texte-doux: #64748b;
    --bordure: #e2e8f0;
    --accent: #1d4ed8;
    --rouge: #dc2626;
    --vert: #16a34a;
    --rayon: 12px;
    --touche: 48px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background: var(--fond);
    color: var(--texte);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 {
    margin: 0 0 1.5rem;
    font-size: 1.5rem;
    text-align: center;
}

a {
    color: var(--accent);
}

/* --- Écran de connexion ------------------------------------------------- */

.connexion {
    max-width: 24rem;
    margin: 0 auto;
    padding: 2rem 1rem calc(2rem + env(safe-area-inset-bottom));
}

.consigne {
    margin: 0 0 1rem;
    color: var(--texte-doux);
    text-align: center;
}

.erreur {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--rouge);
    border-radius: var(--rayon);
    background: #fef2f2;
    color: var(--rouge);
    text-align: center;
}

.vide {
    color: var(--texte-doux);
    text-align: center;
}

.prenoms {
    margin: 0;
    padding: 0;
    list-style: none;
}

.prenoms li + li {
    margin-top: 0.75rem;
}

.bouton {
    display: block;
    width: 100%;
    min-height: var(--touche);
    padding: 0.75rem 1rem;
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    background: var(--carte);
    color: var(--texte);
    font: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.bouton-prenom {
    font-size: 1.25rem;
    font-weight: 600;
}

.bouton-valider {
    margin-top: 1rem;
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
}

.etiquette {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--texte-doux);
    font-size: 0.875rem;
    text-align: center;
}

.champ-code {
    display: block;
    width: 100%;
    min-height: var(--touche);
    padding: 0.75rem 1rem;
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    background: var(--carte);
    color: var(--texte);
    font-family: inherit;
    font-size: 1.75rem;
    letter-spacing: 0.5rem;
    text-align: center;
}

.champ-code:focus,
.bouton:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.retour {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    text-align: center;
}

/* --- Gabarit des pages internes ----------------------------------------- */

.entete {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bordure);
    background: var(--carte);
}

.entete-titre {
    font-size: 1rem;
    font-weight: 600;
}

.contenu {
    max-width: 32rem;
    margin: 0 auto;
    /* La marge basse réserve la place du bouton flottant, qui ne doit jamais
       recouvrir la fin du contenu (légende de la vue semaine notamment). */
    padding: 1rem 1rem calc(6rem + env(safe-area-inset-bottom));
}

/* --- Navigation entre les jours ----------------------------------------- */

.nav-jour {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.nav-date {
    flex: 1;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
}

.fleche {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--touche);
    height: var(--touche);
    flex: 0 0 auto;
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    background: var(--carte);
    color: var(--accent);
    font-size: 1.5rem;
    line-height: 1;
    text-decoration: none;
}

.fleche-inactive {
    border-color: transparent;
    background: transparent;
    color: var(--bordure);
}

/* --- Bandeau des personnes ---------------------------------------------- */

.bandeau {
    display: flex;
    margin: 0 0 1rem;
    padding: 0.5rem 0.25rem;
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    background: var(--carte);
    list-style: none;
}

.bandeau-personne {
    display: flex;
    min-width: 0;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.125rem;
}

.bandeau-prenom {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.8125rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bandeau-points {
    display: flex;
    height: 10px;
    gap: 3px;
}

.point {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.point-busy {
    background: var(--rouge);
}

.point-free {
    background: var(--vert);
}

.bandeau-rien {
    height: 10px;
    color: var(--texte-doux);
    font-size: 0.6875rem;
    line-height: 10px;
}

/* --- Liste des créneaux -------------------------------------------------- */

.etat-vide {
    padding: 2rem 1rem;
    color: var(--texte-doux);
    text-align: center;
}

.creneaux {
    margin: 0;
    padding: 0;
    list-style: none;
}

.creneau {
    margin-bottom: 0.5rem;
    padding: 0.625rem 0.75rem 0.625rem 1rem;
    border: 1px solid var(--bordure);
    border-left: 5px solid var(--bordure);
    border-radius: var(--rayon);
    background: var(--carte);
}

.creneau-busy {
    border-left-color: var(--rouge);
}

.creneau-free {
    border-left-color: var(--vert);
}

.creneau-mien {
    background: #eff6ff;
}

.creneau-tete {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.creneau-horaire {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.creneau-qui {
    overflow: hidden;
    color: var(--texte-doux);
    font-size: 0.875rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.creneau-message {
    margin: 0.375rem 0 0;
    overflow-wrap: anywhere;
    font-size: 0.9375rem;
}

/* --- Formulaires --------------------------------------------------------- */

.titre-page {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    text-align: left;
}

.info {
    margin: 0 0 1rem;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    background: #fffbeb;
    color: #92400e;
    font-size: 0.875rem;
}

.erreurs {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem 0.75rem 2rem;
    border: 1px solid var(--rouge);
    border-radius: var(--rayon);
    background: #fef2f2;
    color: var(--rouge);
}

.formulaire {
    margin: 0;
}

.champ {
    margin: 0 0 1rem;
}

.champ .etiquette {
    text-align: left;
}

.saisie {
    display: block;
    width: 100%;
    min-height: var(--touche);
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    background: var(--carte);
    color: var(--texte);
    font: inherit;
}

.zone-message {
    min-height: 5rem;
    resize: vertical;
}

/* Choix du type : deux gros boutons, sans valeur par défaut (EF-18). */

.types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0;
    border: 0;
}

.types .etiquette {
    width: 100%;
    margin-bottom: 0.25rem;
    padding: 0;
}

.type-radio {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.type-choix {
    display: flex;
    min-height: var(--touche);
    flex: 1 1 8rem;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 0.5rem;
    border: 2px solid var(--bordure);
    border-radius: var(--rayon);
    background: var(--carte);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

.type-busy {
    color: var(--rouge);
}

.type-free {
    color: var(--vert);
}

#type-busy:checked + .type-busy {
    border-color: var(--rouge);
    background: var(--rouge);
    color: #ffffff;
}

#type-free:checked + .type-free {
    border-color: var(--vert);
    background: var(--vert);
    color: #ffffff;
}

.type-radio:focus-visible + .type-choix {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Journée entière : masque les champs horaires sans recourir à JavaScript. */

.bascule-journee {
    width: 22px;
    height: 22px;
    margin: 0 0.5rem 0 0;
    vertical-align: -4px;
}

.etiquette-bascule {
    display: inline-block;
    min-height: var(--touche);
    padding: 0.75rem 0 0.75rem 0;
    font-weight: 600;
    cursor: pointer;
}

.bascule-journee:checked ~ .champs-horaire {
    display: none;
}

.bouton-supprimer {
    margin-top: 2rem;
    border-color: var(--rouge);
    background: var(--carte);
    color: var(--rouge);
    font-weight: 600;
}

.formulaire-suppression {
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--bordure);
}

.avertissement {
    color: var(--texte-doux);
    font-size: 0.9375rem;
}

/* --- Bouton flottant d'ajout (EF-13) ------------------------------------- */

.bouton-ajout {
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    display: flex;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    text-decoration: none;
}

/* --- Créneaux cliquables ------------------------------------------------- */

.creneau-lien {
    display: block;
    color: inherit;
    text-decoration: none;
}

.creneau-mien {
    padding: 0;
}

.creneau-mien .creneau-lien {
    padding: 0.625rem 0.75rem 0.625rem 1rem;
}

/* --- Onglets Jour / Semaine ---------------------------------------------- */

.entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.onglets {
    display: flex;
    gap: 0.25rem;
}

.onglet {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    color: var(--accent);
    font-size: 0.875rem;
    text-decoration: none;
}

.onglet-actif {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

/* --- Tableau de la semaine ----------------------------------------------- */

.invisible {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    white-space: nowrap;
}

.tableau-semaine {
    overflow-x: auto;
}

.semaine {
    width: 100%;
    border-collapse: separate;
    border-spacing: 3px;
    table-layout: fixed;
}

.colonne-prenom {
    width: 4.5rem;
    max-width: 4.5rem;
    overflow: hidden;
    padding-right: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.colonne-jour {
    padding-bottom: 0.25rem;
    color: var(--texte-doux);
    font-size: 0.75rem;
    font-weight: 600;
}

.jour-initiale {
    display: block;
}

.jour-quantieme {
    display: block;
    color: var(--texte);
    font-variant-numeric: tabular-nums;
}

.cellule-hote {
    padding: 0;
}

.cellule {
    display: block;
    height: 44px;
    border-radius: 6px;
    text-decoration: none;
}

.cellule-vide {
    background: #eef2f7;
}

.cellule-busy {
    background: var(--rouge);
}

.cellule-free {
    background: var(--vert);
}

/* Les deux types coexistent : deux demi-blocs nets, sans dégradé. */
.cellule-deux {
    background: linear-gradient(to bottom, var(--rouge) 0, var(--rouge) 50%, var(--vert) 50%, var(--vert) 100%);
}

.cellule:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- Légende ------------------------------------------------------------- */

.legende {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin: 1rem 0 0;
    padding: 0;
    color: var(--texte-doux);
    font-size: 0.8125rem;
    list-style: none;
}

.legende li {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.pastille {
    display: block;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border-radius: 4px;
}

/* --- Aide à l'installation ----------------------------------------------- */

.aide-installation {
    margin-top: 2rem;
    font-size: 0.875rem;
    text-align: center;
}

.aide {
    margin: 0 0 1.5rem;
    padding: 1rem;
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    background: var(--carte);
}

.aide h2 {
    margin: 0 0 0.75rem;
    font-size: 1.0625rem;
}

.aide ol {
    margin: 0;
    padding-left: 1.25rem;
}

.aide li + li {
    margin-top: 0.5rem;
}

.note {
    margin: 0.75rem 0 0;
    color: var(--texte-doux);
    font-size: 0.875rem;
}
