/* ==========================================================================
   MELLIS PLATFORM — STYLES GLOBAUX NETTOYÉS
   
   TABLE DES MATIÈRES :
   1. RESET & BASE (Styles globaux)
   2. LAYOUT & NAVIGATION (Structure, Conteneurs, Navbar)
   3. BOUTONS & INTERACTIONS (Variantes de boutons)
   4. FORMULAIRES & SAISIE (Groupes, Champs, Focus, Grilles)
   5. COMPOSANTS RÉUTILISABLES (Cartes, Badges, Alertes, Tableaux, Pagination)
   6. PAGES SPÉCIFIQUES & COMPOSANTS DÉDIÉS
   ========================================================================== */


/* ==========================================================================
   1. RESET & BASE
   ========================================================================== */
*, 
*::before, 
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: #f4f6f9;
    color: #1e293b;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Typographie de base */
.gris-25 { 
    color: #64748b; 
    margin-bottom: 25px; 
}

.sub-text { 
    font-size: 0.8rem; 
    color: #64748b; 
}

/* ==========================================================================
  1.1 STYLES PAR DÉFAUT DES LIENS (SANS CLASSE - SANS SOULIGNEMENT)
   ========================================================================== */

/* Liens simples */
a:not([class]) {
    color: #2563eb;
    text-decoration: none; /* Enlève le trait dessous */
    transition: color 0.2s ease;
}

/* État au survol / focus */
a:not([class]):hover,
a:not([class]):focus {
    color: #1d4ed8;
    text-decoration: none; /* S'assure que le trait ne réapparaît pas au survol */
}

/* État déjà visité */
a:not([class]):visited {
    color: #2563eb;
}
/* ==========================================================================
  1.2 STYLE PAR DÉFAUT DES LIENS SANS CLASSE (Style Bouton)
   ========================================================================== */

a:not([class]) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: #2563eb;
    color: #ffffff !important;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

/* État au survol et actif */
a:not([class]):hover,
a:not([class]):focus {
    background-color: #1d4ed8;
    color: #ffffff !important;
    text-decoration: none !important;
}

/* Conserve la couleur blanche même si le lien a été visité */
a:not([class]):visited {
    color: #ffffff !important;
}
/* ==========================================================================
   2. LAYOUT & NAVIGATION
   ========================================================================== */
/* Conteneurs principaux */
.container,
.container-900,
.container-1100,
.admin-container {
    width: 100%; 
    max-width: 850px;
    margin: 30px auto; 
    padding: 0 20px; 
}

.container-700 { max-width: 700px; }
.container-900 { max-width: 900px; }
.container-1100,
.admin-container { max-width: 1100px; }

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: #1e293b;
    color: #ffffff;
}

.navbar h1 {
    margin: 0;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
}


/* ==========================================================================
   3. BOUTONS & INTERACTIONS
   ========================================================================== */
/* Boutons de base */
.btn-nav {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Boutons primaires & d'ajout */
.btn-nav-primary, 
.btn-nav-primary:visited,
.btn-add {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

.btn-nav-primary:hover,
.btn-add:hover {
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
}

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

/* Boutons danger */
.btn-nav-danger, 
.btn-nav-danger:visited {
    background-color: #dc2626 !important;
    color: #ffffff !important;
}

.btn-nav-danger:hover {
    background-color: #b91c1c !important;
    color: #ffffff !important;
}

/* Boutons secondaires */
.btn-nav-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-nav-secondary:hover {
    background-color: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
}

/* Bouton principal de formulaire (ex: "Se connecter", "Enregistrer") —
   utilisé un peu partout mais jamais défini jusqu'ici, d'où un rendu
   par défaut du navigateur, plus discret que le lien juste à côté. */
.btn-submit {
    display: inline-block;
    padding: 10px 20px;
    background-color: #2563eb;
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease;
}

.btn-submit:hover {
    background-color: #1d4ed8;
}

/* Lien texte discret, volontairement à l'écart de la règle
   "a:not([class]) = gros bouton bleu" ci-dessus (section 1.2) — pour les
   actions secondaires (ex: "Mot de passe oublié ?") qui ne doivent
   jamais rivaliser visuellement avec l'action principale d'un
   formulaire. */
.link-plain {
    color: #64748b !important;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none !important;
    background: none !important;
    padding: 0 !important;
    display: inline !important;
}

.link-plain:hover {
    color: #2563eb !important;
    text-decoration: underline !important;
}


/* ==========================================================================
   4. FORMULAIRES & SAISIE
   ========================================================================== */
.form-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); 
    gap: 15px; 
    margin-top: 15px; 
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.form-group.full-width { 
    grid-column: 1 / -1; 
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control[readonly] { 
    background-color: #f1f5f9; 
    color: #64748b; 
    cursor: not-allowed; 
}


/* ==========================================================================
   5. COMPOSANTS RÉUTILISABLES
   ========================================================================== */
/* Cartes */
.card {
    padding: 25px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filter-card { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 15px; 
    flex-wrap: wrap; 
    margin-bottom: 20px; 
    padding: 15px 20px; 
    background: #eff6ff; 
    border: 1px solid #bfdbfe; 
    border-radius: 8px; 
}

.filter-card label { 
    color: #1e40af; 
    font-size: 0.95rem; 
    font-weight: 600; 
}

.filter-card select, 
.filter-card input[type="text"] {
    padding: 10px 12px;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    background: #ffffff;
    color: #1e293b;
    font-size: 0.95rem;
    outline: none;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    background-color: #e0e7ff;
    border-radius: 4px;
    color: #4338ca;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-type { 
    margin-left: 5px; 
    background-color: #e0f2fe; 
    color: #0369a1; 
}

/* Alertes & Messages */
.alert {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.alert-success {
    background-color: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.alert-danger {
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* Tableaux de données */
.table-responsive {
    width: 100%;
    margin-top: 20px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.data-table th, 
.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
}

/* Titres de Section */
.section-title {
    grid-column: 1 / -1;
    margin-top: 20px;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Pagination */
.pagination-container { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 10px; 
    margin-top: 20px; 
    flex-wrap: wrap; 
}

.pagination { 
    display: flex; 
    gap: 5px; 
    margin: 0; 
    padding: 0; 
    list-style: none; 
}

.pagination a, 
.pagination span { 
    padding: 6px 12px; 
    background: #ffffff; 
    border: 1px solid #cbd5e1; 
    border-radius: 6px; 
    color: #334155; 
    font-size: 0.85rem; 
    text-decoration: none; 
}

.pagination .active { 
    background-color: #2563eb; 
    border-color: #2563eb; 
    color: #ffffff; 
    font-weight: 600; 
}

.pagination a:hover:not(.active) { 
    background-color: #f1f5f9; 
}


/* ==========================================================================
   6. PAGES SPÉCIFIQUES & COMPOSANTS DÉDIÉS
   ========================================================================== */
/* Login / Connexion */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 35px 30px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

.login-header {
    margin-bottom: 25px;
    text-align: center;
}

.login-header img {
    width: 220px;
    max-width: 100%;
    height: auto;
    margin-bottom: 15px;
}

.login-header h2 {
    margin: 0 0 8px 0;
    color: #1e293b;
    font-size: 1.4rem;
    font-weight: 600;
}

.login-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
}

/* Dashboard / Adhérents */
.div-alfa { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 20px; 
}

.div-alfa1 {
    padding: 25px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.div-alfa1 h4 { 
    margin: 0 0 10px 0; 
    color: #1e293b; 
    font-size: 1.1rem; 
}

.div-alfa1 p { 
    margin-bottom: 20px; 
    color: #64748b; 
    font-size: 0.9rem; 
}

.div-alha2 { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap;
}

.div-alha2 a { 
    padding: 8px 14px; 
    background: #e2e8f0; 
    border-radius: 6px; 
    color: #334155; 
}

.div-alha2 a.gerez { 
    background: #0f172a; 
    border-radius: 6px; 
    color: #ffffff; 
    font-weight: 500; 
    text-decoration: none; 
}

.div-alha2 a.ajoutez { 
    background: #e2e8f0; 
    border-radius: 6px; 
    color: #334155; 
    text-decoration: none; 
}

.div-alha2 a.ajoutez500 { 
    background: #2563eb; 
    border-radius: 6px; 
    color: #ffffff; 
    font-weight: 500; 
    text-decoration: none; 
}

.asso-badge-box { 
    grid-column: 1 / -1; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 12px 15px; 
    background: #f8fafc; 
    border: 1px solid #e2e8f0; 
    border-radius: 6px; 
}

/* Pied de page commun — pages PUBLIQUES uniquement (voir
   includes/public_footer.php). Les pages internes ont leur propre
   style, non concerné ici. */
.public-footer {
    text-align: center;
    padding: 30px 20px;
    color: #94a3b8;
    font-size: 0.85rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 40px;
}

.public-footer-links {
    margin-bottom: 10px;
}

.public-footer-links span {
    white-space: nowrap;
}

.public-footer a.footer-link,
.public-footer a.footer-link:visited {
    color: #94a3b8 !important;
    text-decoration: underline !important;
    background: none !important;
    padding: 0 !important;
    display: inline !important;
}

.public-footer a.footer-link:hover {
    color: #2563eb !important;
}

/* Bloc partenaires institutionnels (voir includes/public_partenaires.php)
   — valeurs alignées sur les autres sites AEPM pour cohérence visuelle. */
#partenaires-pied {
    max-width: 1100px;
    text-align: center;
    margin: 0 auto;
    padding: 15px 0;
    background-color: #f9f9f9;
}

#partenaires-pied p {
    font-size: 0.85rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    font-weight: bold;
}

#partenaires-pied2 {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
    padding: 0 10px;
}

#partenaires-pied2 img {
    height: 50px;
    width: auto;
    max-width: 100%;
    filter: grayscale(100%);
    opacity: 0.8;
    transition: all 0.3s ease;
}

#partenaires-pied2 img:hover {
    filter: none;
    opacity: 1;
}

/* Neutralisation propre à Mellis : sans classe, ces liens hériteraient
   du style "bouton bleu" de la section 1.2 (voir a:not([class])). Pas
   nécessaire sur les autres sites AEPM s'ils n'ont pas cette règle. */
#partenaires-pied2 a.partner-link {
    display: inline-block !important;
    padding: 0 !important;
    background: none !important;
}


/* ==========================================================================
   7. BARRE DE NAVIGATION COMMUNE (includes/navbar.php) — 16/10/2026
   Mêmes boutons, même taille et mêmes couleurs sur toutes les pages.
   ========================================================================== */
.navbar { flex-wrap: wrap; gap: 10px 20px; }
.navbar-user { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.navbar-connecte { font-size: 0.85rem; color: #cbd5e1; margin-right: 4px; }
.navbar-connecte b { color: #ffffff; }

/* Tous les boutons de la barre ont la même taille */
.navbar-user .btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 6px;
    white-space: nowrap;
}
.navbar-user .btn-nav-danger { border: 1px solid #dc2626; }

/* Bouton de la page en cours */
.navbar-user .btn-nav-secondary.btn-nav-actif {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}
.navbar-user .btn-nav-secondary.btn-nav-actif:hover {
    background-color: #1d4ed8;
    color: #ffffff;
}

/* Bandeau « page prévue pour un ordinateur » ($navOrdi) : téléphone seulement */
.bandeau-ordi { display: none; }

/* Téléphone : la barre passe sur deux lignes au lieu de déborder */
@media (max-width: 700px) {
    .navbar { padding: 12px 16px; }
    .navbar-user { justify-content: flex-start; }
    .bandeau-ordi {
        display: block;
        margin: 0;
        padding: 10px 16px;
        background: #fef3c7;
        border-bottom: 1px solid #fcd34d;
        color: #92400e;
        font-size: 0.85rem;
        line-height: 1.4;
    }
}

/* Règle générale téléphone : un tableau large défile dans son cadre
   au lieu d'élargir toute la page (classe existante .table-responsive) */
.table-responsive { -webkit-overflow-scrolling: touch; }


/* ==========================================================================
   8. LIENS DANS LE TEXTE DES PAGES PUBLIQUES (CGU, mentions légales…)
   Ajouté le 17/10/2026 : dans une phrase, un lien doit rester un simple
   lien texte, jamais le « gros bouton bleu » de la section 1.2 ni le
   petit lien gris .link-plain. Ne concerne que les liens placés dans un
   paragraphe, une liste ou un tableau d'un .legal-container (le lien
   « ← Retour à l'accueil », hors paragraphe, n'est pas touché).
   ========================================================================== */
.legal-container p a,
.legal-container li a,
.legal-container td a {
    display: inline !important;
    padding: 0 !important;
    background: none !important;
    border-radius: 0 !important;
    color: #2563eb !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    white-space: normal !important;
    text-decoration: none !important;
}
.legal-container p a:hover,
.legal-container p a:focus,
.legal-container li a:hover,
.legal-container li a:focus,
.legal-container td a:hover,
.legal-container td a:focus {
    background: none !important;
    color: #1d4ed8 !important;
    text-decoration: underline !important;
}
.legal-container p a:visited,
.legal-container li a:visited,
.legal-container td a:visited {
    color: #2563eb !important;
}

/* ==========================================================================
   7. CLASSES COMMUNES À TOUS LES MODULES (01/11/2026)
   ========================================================================== */
/* Lien en bouton bleu : même rendu que a:not([class]) plus haut, pour un lien
   qui a besoin d'une classe (ex. « ← Retour au tableau de bord »). */
.lien-bouton { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background-color: #2563eb; color: #ffffff !important; border-radius: 6px; font-size: 0.9rem; font-weight: 600; text-decoration: none !important; white-space: nowrap; transition: background-color 0.2s ease; }
.lien-bouton:hover, .lien-bouton:focus { background-color: #1d4ed8; color: #ffffff !important; text-decoration: none !important; }
.lien-bouton:visited { color: #ffffff !important; }

/* Petit texte gris d'explication ou d'état (« valorisé », « soit 24 km aller-retour »…) */
.texte-discret { color: #64748b; font-size: 0.82rem; }

/* Pastilles d'état communes (01/11/2026) : <span class="pastille pastille-vert">Validé</span> */
.pastille { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.pastille-vert { background: #dcfce7; color: #166534; }
.pastille-rouge { background: #fee2e2; color: #991b1b; }
.pastille-orange { background: #fef3c7; color: #92400e; }
.pastille-bleu { background: #dbeafe; color: #1e40af; }
/* Message d'avertissement (orange), à côté de .alert-success et .alert-danger */
.alert-warning { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* 01/11/2026 : « Mise en route de la comptabilité » (tableau de bord Comptabilité
   et fiche association) — comptabilite/functions/mise_en_route.php */
.mer-encadre { border-radius: 8px; padding: 16px 20px; margin: 15px 0 25px; border: 1px solid #e2e8f0; background: #ffffff; }
.mer-encadre-manque { border-color: #fde68a; background: #fffbeb; }
.mer-encadre-info { border-color: #bfdbfe; background: #eff6ff; }
.mer-titre { margin: 0 0 10px; font-size: 1.05rem; color: #1e293b; }
.mer-titre .texte-discret { font-weight: 400; margin-left: 8px; }
.mer-liste { list-style: none; margin: 0; padding: 0; }
.mer-ligne { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-top: 1px solid rgba(0,0,0,0.05); font-size: 0.92rem; color: #334155; }
.mer-ligne:first-child { border-top: none; }
.mer-ok { color: #64748b; }
.mer-manque { color: #92400e; font-weight: 600; }
.mer-icone { flex: 0 0 22px; }
.mer-texte { flex: 1; }
.mer-details { display: block; margin-top: 4px; font-weight: 400; }
.mer-lien { color: #2563eb !important; font-weight: 600; text-decoration: underline !important; margin-left: 4px; }
.mer-details .mer-lien { margin-left: 0; }

/* 01/11/2026 : « Échéances à ne pas oublier » (tableaux de bord adhérent et Comptabilité)
   — comptabilite/functions/echeances.php */
.ech-encadre { border: 1px solid #fde68a; background: #fffbeb; border-radius: 8px; padding: 16px 20px; margin: 15px 0 25px; }
.ech-titre { margin: 0 0 10px; font-size: 1.05rem; color: #1e293b; }
.ech-ligne { padding: 10px 0; border-top: 1px solid rgba(0,0,0,0.06); }
.ech-ligne:first-of-type { border-top: none; padding-top: 0; }
.ech-entete { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; color: #92400e; }
.ech-date { font-size: 0.88rem; font-weight: 600; }
.ech-urgent .ech-entete { color: #991b1b; }
.ech-urgent .ech-date { background: #fee2e2; padding: 1px 8px; border-radius: 12px; }
.ech-texte { margin: 6px 0; font-size: 0.92rem; color: #334155; }
.ech-lien { color: #2563eb !important; font-weight: 600; text-decoration: underline !important; font-size: 0.92rem; }
