/* ==========================================================================
   Guggen'App - feuille de style
   CSS pur, organise par sections, sans dependance (pas de framework).
   Mobile-first : les regles de base ciblent le telephone, les media
   queries etendent progressivement vers tablette puis ordinateur.
   ========================================================================== */

/* ---------- 1. Variables (identite visuelle vert / noir) ---------- */
:root {
    --noir:            #12180f;
    --noir-doux:       #1c261a;
    --vert-fonce:      #10502c;
    --vert:            #1f8a4c;
    --vert-vif:        #2fbf6a;
    --vert-pale:       #e6f4ea;
    --fond:            #f4f7f3;
    --carte:           #ffffff;
    --texte:           #17201a;
    --texte-discret:   #647166;
    --bordure:         #dfe6db;
    --rouge:           #c9382a;
    --rouge-pale:      #fbe8e5;
    --jaune:           #b8871f;
    --jaune-pale:      #fbf1de;
    --ombre:           0 2px 10px rgba(18, 24, 15, 0.08);
    --rayon:           14px;
    --rayon-petit:     8px;
    --hauteur-topbar:  56px;
    --hauteur-nav:     64px;
}

/* ---------- 2. Reset minimal ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--fond);
    color: var(--texte);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; color: var(--noir); }
p { margin: 0 0 1em; }
a { color: var(--vert-fonce); text-decoration: none; }
ul, dl { padding: 0; margin: 0; list-style: none; }
img { max-width: 100%; }
button { font-family: inherit; }
.icone { width: 1.3em; height: 1.3em; flex-shrink: 0; }

/* ---------- 3. Structure generale ---------- */
.contenu {
    padding: 16px 16px calc(var(--hauteur-nav) + 24px);
    max-width: 720px;
    margin: 0 auto;
}
.contenu-public { padding-bottom: 24px; }

.page-titre {
    font-size: 1.5rem;
    margin-top: 0.2em;
}

.entete-page {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.lien-retour {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--texte-discret);
    font-weight: 600;
    font-size: 0.95rem;
}
.lien-retour .icone { width: 1.1em; height: 1.1em; }

.texte-discret { color: var(--texte-discret); font-size: 0.92rem; }

/* ---------- 4. Barre superieure ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--hauteur-topbar);
    background: var(--noir);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}
.topbar-marque {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.topbar-marque .icone { color: var(--vert-vif); width: 1.5em; height: 1.5em; }
.topbar-profil {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 0.9rem;
}
.topbar-profil .icone { width: 1.4em; height: 1.4em; }
.topbar-profil-nom { display: none; }

/* ---------- 5. Navigation mobile (bas d'ecran) ---------- */
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    height: var(--hauteur-nav);
    background: var(--noir);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.25);
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #9db3a2;
    font-size: 0.68rem;
    font-weight: 600;
}
.bottom-nav a .icone { width: 1.5em; height: 1.5em; }
.bottom-nav a.actif { color: var(--vert-vif); }

/* ---------- 6. Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--rayon-petit);
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn .icone { width: 1.15em; height: 1.15em; }
.btn-primary { background: var(--vert); color: #fff; }
.btn-primary:active { background: var(--vert-fonce); }
.btn-secondaire { background: var(--vert-pale); color: var(--vert-fonce); }
.btn-danger { background: var(--rouge-pale); color: var(--rouge); }
.btn-texte { background: transparent; color: var(--texte-discret); }
.btn-large { width: 100%; padding: 13px; font-size: 1rem; margin-top: 4px; }
.btn-present { background: var(--vert-pale); color: var(--vert-fonce); flex: 1; }
.btn-absent { background: var(--rouge-pale); color: var(--rouge); flex: 1; }
.btn-icone {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--carte); border: 1px solid var(--bordure); color: var(--texte);
}
.btn-icone-suivant .icone { transform: scaleX(-1); }
.btn-icone-danger {
    background: transparent; border: none; color: var(--rouge);
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; cursor: pointer;
}
.entete-page .btn { flex-shrink: 0; }

/* ---------- 7. Formulaires ---------- */
.formulaire { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.formulaire label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--texte-discret);
    margin-top: 10px;
}
.formulaire input[type=text],
.formulaire input[type=email],
.formulaire input[type=tel],
.formulaire input[type=password],
.formulaire input[type=search],
.formulaire input[type=date],
.formulaire input[type=time],
.formulaire input[type=datetime-local],
.formulaire input[type=file],
.formulaire select,
.formulaire textarea {
    font-size: 1rem;
    padding: 11px 12px;
    border-radius: var(--rayon-petit);
    border: 1px solid var(--bordure);
    background: var(--carte);
    color: var(--texte);
    width: 100%;
    font-family: inherit;
}
.formulaire input:focus, .formulaire select:focus, .formulaire textarea:focus {
    outline: 2px solid var(--vert);
    outline-offset: 1px;
}
.formulaire textarea { resize: vertical; }
.formulaire-colonnes { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.formulaire-ajout-fichier { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--bordure); }

.barre-filtres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 18px;
}
.champ-recherche {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon-petit);
    padding: 0 12px;
}
.champ-recherche .icone { color: var(--texte-discret); width: 1.1em; height: 1.1em; }
.champ-recherche input { border: none; padding: 10px 0; flex: 1; background: transparent; font-size: 1rem; }
.champ-recherche input:focus { outline: none; }
.barre-filtres select {
    flex: 1;
    padding: 9px 10px;
    border-radius: var(--rayon-petit);
    border: 1px solid var(--bordure);
    background: var(--carte);
    font-size: 0.9rem;
}
.barre-filtres .btn { flex: 1 1 100%; }

/* ---------- 8. Cartes / sections ---------- */
.section-carte {
    background: var(--carte);
    border-radius: var(--rayon);
    padding: 16px;
    margin: 16px 0;
    box-shadow: var(--ombre);
}
.section-carte h2 { font-size: 1.05rem; }
.section-carte summary { cursor: pointer; font-weight: 700; color: var(--noir); }

.grille-cartes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 14px;
}
.carte {
    background: var(--carte);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    padding: 14px 16px;
}
.carte-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
}
.icone-stat { width: 2em; height: 2em; color: var(--vert); flex-shrink: 0; }
.carte-stat-valeur { font-weight: 700; font-size: 1.05rem; color: var(--noir); }
.carte-stat-label { font-size: 0.85rem; color: var(--texte-discret); }

.acces-rapides {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 18px 0;
}
.acces-rapide {
    background: var(--carte);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    padding: 14px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--noir);
    text-align: center;
}
.acces-rapide .icone { width: 1.6em; height: 1.6em; color: var(--vert); }

/* ---------- 9. Badges & statuts ---------- */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 100px;
    background: var(--vert-pale);
    color: var(--vert-fonce);
    white-space: nowrap;
}
.badge-comite { background: var(--noir); color: #fff; }
.badge-membre { background: var(--vert-pale); color: var(--vert-fonce); }
.badge-inactif { background: #ececec; color: #6b6b6b; }
.badge-actif { background: var(--vert-pale); color: var(--vert-fonce); }
.badge-neutre { background: #ececec; color: #4a4a4a; }
.badge-repetition { background: var(--vert-pale); color: var(--vert-fonce); }
.badge-sortie { background: var(--jaune-pale); color: var(--jaune); }
.badge-autre { background: #ececec; color: #4a4a4a; }

.statut-actuel {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 100px;
    background: #ececec;
    color: #555;
}
.statut-present { background: var(--vert-pale); color: var(--vert-fonce); }
.statut-absent { background: var(--rouge-pale); color: var(--rouge); }
.statut-sans_reponse { background: var(--jaune-pale); color: var(--jaune); }

.alerte-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--jaune-pale);
    color: var(--jaune);
    padding: 10px 14px;
    border-radius: var(--rayon-petit);
    font-size: 0.9rem;
    font-weight: 600;
}

/* ---------- 10. Messages flash ---------- */
.flash-zone { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.flash {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--rayon-petit);
    font-size: 0.9rem;
    font-weight: 600;
}
.flash .icone { width: 1.2em; height: 1.2em; flex-shrink: 0; }
.flash-succes { background: var(--vert-pale); color: var(--vert-fonce); }
.flash-erreur { background: var(--rouge-pale); color: var(--rouge); }

/* ---------- 11. Listes (membres, morceaux, evenements) ---------- */
.liste-membres, .liste-morceaux { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.carte-membre, .carte-morceau {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--carte);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    padding: 12px 14px;
    color: inherit;
}
.avatar-initiales {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--vert);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.avatar-grand { width: 68px; height: 68px; font-size: 1.4rem; margin: 0 auto 8px; }
.carte-membre-nom { font-weight: 700; color: var(--noir); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.carte-membre-detail { color: var(--texte-discret); font-size: 0.85rem; }
.icone-morceau { width: 1.7em; height: 1.7em; color: var(--vert); flex-shrink: 0; }
.carte-morceau-titre { font-weight: 700; color: var(--noir); }
.carte-morceau-detail { color: var(--texte-discret); font-size: 0.82rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }

.liste-evenements li + li { border-top: 1px solid var(--bordure); }
.liste-evenements a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    color: inherit;
}
.liste-evenements-nom { font-weight: 600; color: var(--noir); flex: 1; }
.liste-evenements-date { font-size: 0.8rem; color: var(--texte-discret); white-space: nowrap; }

.fiche-membre { text-align: center; margin-top: 8px; }
.badges-fiche { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }

.liste-details { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; }
.liste-details dt { color: var(--texte-discret); font-size: 0.85rem; }
.liste-details dd { margin: 0; font-weight: 600; color: var(--noir); }

.liste-historique li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--bordure);
}
.liste-historique li:last-child { border-bottom: none; }
.liste-historique .icone { width: 1.1em; height: 1.1em; }
.liste-historique.statut-present .icone,
li.statut-present .icone { color: var(--vert); }
li.statut-absent .icone { color: var(--rouge); }
li.statut-sans_reponse .icone { color: var(--jaune); }

.actions-fiche { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.actions-fiche form { display: contents; }
.actions-fiche .btn { width: 100%; }

/* ---------- 12. Fichiers / partitions ---------- */
.liste-fichiers { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.liste-fichiers li { display: flex; align-items: center; gap: 6px; }
.lien-fichier {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--vert-pale);
    color: var(--vert-fonce);
    padding: 10px 12px;
    border-radius: var(--rayon-petit);
}
.lien-fichier-nom { flex: 1; font-weight: 700; display: flex; flex-direction: column; }
.lien-fichier-nom small { font-weight: 400; color: var(--texte-discret); }

/* ---------- 13. Presence (comite) ---------- */
.stats-presence { display: flex; gap: 8px; margin: 10px 0; }
.stat-presence {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 6px;
    border-radius: var(--rayon-petit);
    font-weight: 700;
}
.stat-presence .icone { width: 1.3em; height: 1.3em; }
.stat-presence small { font-weight: 500; font-size: 0.72rem; }
.stat-present { background: var(--vert-pale); color: var(--vert-fonce); }
.stat-absent { background: var(--rouge-pale); color: var(--rouge); }
.stat-attente { background: var(--jaune-pale); color: var(--jaune); }

.choix-presence { display: flex; gap: 10px; margin-top: 10px; }

.liste-presences-comite { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.liste-presences-comite li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--bordure);
}
.liste-presences-nom { font-weight: 600; }
.liste-presences-nom small { color: var(--texte-discret); font-weight: 400; }
.selecteur-statut select {
    padding: 6px 8px;
    border-radius: var(--rayon-petit);
    border: 1px solid var(--bordure);
    font-size: 0.85rem;
    font-weight: 600;
}
.marge-haut { margin-top: 6px; }

/* ---------- 14. Details evenement / agenda ---------- */
.details-evenement { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 16px; }
.details-evenement li { display: flex; align-items: center; gap: 8px; color: var(--texte-discret); font-size: 0.92rem; }
.details-evenement .icone { width: 1.1em; height: 1.1em; color: var(--vert); }

.onglets { display: flex; gap: 6px; margin: 14px 0; background: #eceee9; padding: 4px; border-radius: 100px; }
.onglet { flex: 1; text-align: center; padding: 8px; border-radius: 100px; font-weight: 700; font-size: 0.85rem; color: var(--texte-discret); }
.onglet-actif { background: var(--noir); color: #fff; }

/* ---------- 15. Calendrier ---------- */
.calendrier-entete { display: flex; align-items: center; justify-content: space-between; margin: 14px 0; }
.calendrier-entete h2 { margin: 0; font-size: 1.05rem; }
.calendrier-grille {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    background: var(--carte);
    border-radius: var(--rayon);
    padding: 10px;
    box-shadow: var(--ombre);
}
.calendrier-jour-label { text-align: center; font-size: 0.7rem; font-weight: 700; color: var(--texte-discret); padding-bottom: 4px; }
.calendrier-case {
    min-height: 54px;
    border-radius: 6px;
    padding: 3px;
    background: var(--fond);
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}
.calendrier-case-vide { background: transparent; }
.calendrier-numero { font-size: 0.72rem; font-weight: 700; color: var(--texte-discret); }
.a-des-evenements { background: var(--vert-pale); }
.a-des-evenements .calendrier-numero { color: var(--vert-fonce); }
.calendrier-evenements { display: flex; flex-direction: column; gap: 2px; }
.calendrier-puce {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    background: var(--vert);
    color: #fff;
    padding: 1px 4px;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.calendrier-puce.badge-sortie { background: var(--jaune); }
.calendrier-puce.badge-autre { background: #6b6b6b; }

/* ---------- 16. Ecrans d'authentification ---------- */
.page-auth { background: var(--noir); min-height: 100vh; }
.auth-ecran { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-carte {
    background: var(--carte);
    border-radius: var(--rayon);
    padding: 28px 22px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 6px; }
.icone-logo { width: 3em; height: 3em; color: var(--vert); }
.auth-titre { font-size: 1.3rem; margin-bottom: 2px; }
.auth-soustitre { color: var(--texte-discret); font-size: 0.9rem; margin-bottom: 18px; }
.auth-carte .formulaire { text-align: left; margin-bottom: 12px; }
.auth-lien { display: inline-block; margin-top: 6px; font-size: 0.88rem; color: var(--texte-discret); font-weight: 600; }

/* ---------- 17. Pages d'erreur ---------- */
.page-erreur { background: var(--noir); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.erreur-box { text-align: center; color: #fff; }
.erreur-box h1 { font-size: 3rem; color: var(--vert-vif); margin-bottom: 4px; }
.erreur-box .btn { margin-top: 16px; }

/* ---------- 18. Tablette / ordinateur (>= 720px) ---------- */
@media (min-width: 720px) {
    .contenu { padding: 24px 24px calc(var(--hauteur-nav) + 24px) 100px; max-width: none; }
    body.connecte .contenu { margin-left: var(--hauteur-nav); }

    .bottom-nav {
        top: var(--hauteur-topbar);
        bottom: 0;
        left: 0;
        right: auto;
        width: 84px;
        height: auto;
        flex-direction: column;
        padding-top: 18px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.15);
    }
    .bottom-nav a { flex: none; padding: 14px 0; font-size: 0.7rem; }

    .contenu-app { max-width: 760px; margin-left: calc(var(--hauteur-nav) + 24px); }

    .topbar-profil-nom { display: inline; }

    .grille-cartes { grid-template-columns: repeat(2, 1fr); }
    .formulaire-colonnes { grid-template-columns: 1fr 1fr; }
    .barre-filtres { flex-wrap: nowrap; }
    .champ-recherche { flex: 2 1 auto; }
    .barre-filtres .btn { flex: 0 0 auto; }

    .actions-fiche { flex-direction: row; }

    .calendrier-case { min-height: 90px; }
}

@media (min-width: 1100px) {
    .contenu-app { max-width: 920px; margin-left: calc(var(--hauteur-nav) + 40px); margin-right: auto; }
}
