:root {
    --jaune-wipsee: #d7ab32;
    --vert-olive: #767c55;
    --bleu-vert: #548584;
    --rose-saumon: #ed968d;
    --blanc: #ffffff;
    --gris-clair: #f5f5f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: var(--gris-clair);
    color: #333;
}

/* Header */
header {
    background-color: var(--vert-olive);
    padding: 15px 30px;
    overflow: hidden;  
}

.header-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.logo {
    height: 60px;
    width: auto;
    object-fit: contain;
}

nav {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 30px;
}


nav a {
    color: var(--blanc);
    text-decoration: none;
    margin-left: 20px;
    font-weight: bold;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--jaune-wipsee);
}

/* Boutons */
.btn {
    background-color: var(--bleu-vert);
    color: var(--blanc);
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: var(--jaune-wipsee);
}

/* Contenu principal */
main {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px); 
    padding: 30px;
}

/* ==========================================
   Page de Connexion (Administration)
   ========================================== */


.boite-connexion {
    background-color: var(--blanc);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); 
    width: 100%;
    max-width: 450px; 
    border-top: 5px solid var(--jaune-wipsee); 
}

.boite-connexion h2 {
    color: var(--vert-olive);
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.6rem;
}

/* Style du formulaire */
.boite-connexion form {
    display: flex;
    flex-direction: column; 
    gap: 15px; 
}

.boite-connexion label {
    font-weight: bold;
    color: #555;
    font-size: 0.9rem;
    margin-bottom: -5px; 
}

.boite-connexion input[type="email"],
.boite-connexion input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
}


.boite-connexion input[type="email"]:focus,
.boite-connexion input[type="password"]:focus {
    border-color: var(--bleu-vert);
    box-shadow: 0 0 5px rgba(84, 133, 132, 0.3);
}


.boite-connexion button[type="submit"] {
    background-color: var(--bleu-vert);
    color: var(--blanc);
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.3s, transform 0.1s;
}

.boite-connexion button[type="submit"]:hover {
    background-color: var(--jaune-wipsee);
    color: #333; 
}

.boite-connexion button[type="submit"]:active {
    transform: scale(0.98); 
}

/* Message d'erreur */
.boite-connexion .erreur {
    background-color: rgba(237, 150, 141, 0.2); 
    color: #b83c31; 
    padding: 12px;
    border-left: 4px solid var(--rose-saumon);
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-align: center;
}

/* Footer */
footer {
    background-color: var(--vert-olive);
    color: var(--blanc);
    text-align: center;
    padding: 15px;
    margin-top: 50px;
}

/* Dashboard */
.dashboard {
    text-align: center;
    padding: 40px 20px;
}

.dashboard h1 {
    color: var(--vert-olive);
    font-size: 28px;
    margin-bottom: 10px;
}

.sous-titre {
    color: #666;
    margin-bottom: 40px;
}

/* Cartes stats */
.stats-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 50px;
}

.stat-card {
    background: var(--blanc);
    border-radius: 10px;
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-width: 180px;
}

.stat-icon {
    font-size: 35px;
}

.stat-nombre {
    font-size: 45px;
    font-weight: bold;
    color: var(--bleu-vert);
}

.stat-label {
    color: #666;
    font-size: 14px;
}

/* Cards container */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px; 
    color : var(--vert-olive)
}

.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: center;
    margin-top: 20px; 
}

.card {
    background: var(--blanc);
    border-radius: 10px;
    padding: 25px;
    width: 280px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.card-image img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 50%;
    color: transparent; 
}

.card-placeholder {
    width: 100px;
    height: 100px;
    background: var(--gris-clair);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 45px;
}

.card-content h3 {
    color: var(--vert-olive);
    margin-bottom: 8px;
}

.card-content p {
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

.card-footer {
    margin-top: auto;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-supprimer {
    background-color: var(--rose-saumon);
    color: var(--blanc);
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-supprimer:hover {
    background-color: #d44;
}

/* Formulaire */
.form-card {
    background: var(--blanc);
    border-radius: 10px;
    padding: 40px;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: bold;
    color: var(--vert-olive);
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group textarea,
.form-group input[type="email"],
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background-color: var(--blanc);
    cursor: pointer;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--bleu-vert);
}

.form-group textarea {
    height: 100px;
    resize: vertical;
}

.form-group input[type="file"] {
    padding: 8px 0;
}

/* Table */
.table-container {
    background: var(--blanc);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

table th:nth-child(1) { width: 20%; } /* Badge */
table th:nth-child(2) { width: 15%; } /* Destinataire */
table th:nth-child(3) { width: 22%; } /* Email */
table th:nth-child(4) { width: 13%; } /* Attribué par */
table th:nth-child(5) { width: 13%; } /* Date */
table th:nth-child(6) { width: 17%; } /* Actions */

thead {
    background-color: var(--vert-olive);
    color: var(--blanc);
}

thead th {
    padding: 15px 20px;
    text-align: left;
    font-weight: bold;
}

tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: var(--gris-clair);
}

tbody td {
    padding: 12px 20px;
    vertical-align: middle;  /* ← centre verticalement */
    white-space: normal;   
    overflow: hidden;        /* ← ajoute ça */
    text-overflow: ellipsis;
    word-break: break-word;
}

/* Badge mini */
.badge-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-mini img {
    width: 40px;      
    height: 40px;     
    object-fit: contain;
    border-radius: 50%;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 16px;
}

.erreur {
    background-color: #ffe0e0;
    color: #d44;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid #d44;
}

/* Rôle badge */
.role-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.role-super {
    background-color: var(--jaune-wipsee);
    color: var(--blanc);
}

.role-admin {
    background-color: var(--bleu-vert);
    color: var(--blanc);
}

/* Responsive mobile */
@media (max-width: 768px) {
    
    /* Header */
    .header-container {
        flex-direction: column;
        gap: 15px;
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    nav a {
        margin-left: 0;
    }

    /* Dashboard */
    .stats-container {
        flex-direction: column;
        align-items: center;
    }

    .stat-card {
        width: 80%;
    }

    /* Main */
    main {
        padding: 15px;
    }

    .cards-container {
        flex-direction: column;
        align-items: center;
    }

    .card {
        width: 90%;
    }
    
    .form-card {
        padding: 20px;
    }
    
    table {
        font-size: 12px;
    }

    thead th, tbody td {
        padding: 8px 10px;
    }

    /* Cache le header du tableau */
    thead {
        display: none;
    }

    /* Chaque ligne devient une carte */
    tbody tr {
        display: block;
        background: var(--blanc);
        border-radius: 10px;
        margin-bottom: 15px;
        padding: 15px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        border-bottom: none;
        text-align: center;
    }

    /* Chaque cellule s'affiche en block */
    tbody td {
        display: block;
        padding: 8px 0;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        font-size: 15px;
    }
    tbody td:nth-child(4) .btn-supprimer {
        margin-top: 8px;
        display: inline-block;
    }

    tbody td::before {
        display: block;
        font-size: 12px;
        color: #999;
        margin-bottom: 3px;
    }

    /* Ajoute un label avant chaque cellule */
    tbody td:nth-child(1)::before { content: "🏅 Badge : "; font-weight: bold; color: var(--vert-olive); }
    tbody td:nth-child(2)::before { content: "👤 Destinataire : "; font-weight: bold; color: var(--vert-olive); }
    tbody td:nth-child(3)::before { content: "📧 Email : "; font-weight: bold; color: var(--vert-olive); }
    tbody td:nth-child(4)::before { content: "👨‍💼 Attribué par : "; font-weight: bold; color: var(--vert-olive); }
    tbody td:nth-child(5)::before { content: "📅 Date : "; font-weight: bold; color: var(--vert-olive); }
    tbody td:nth-child(6)::before { content: ""; }

    
    .table-container {
        background: transparent;
        box-shadow: none;
        padding: 0;
    }

    .badge-mini {
        justify-content: center; /* ← centre le badge */
    }

    .badge-mini img {
        width: 50px; /* ← badge plus grand sur mobile */
        height: 50px;
    }
}

/* Filtre année */
.filtre-container {
    display: flex;
    align-items: center;
    gap: 25px;
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.filtre-container label {
    font-weight: bold;
    color: var(--vert-olive);
    margin-right: 10px;
    font-size: 16px;
}

.filtre-container select {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    background-color: var(--bleu-vert);
    color: var(--blanc);
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
}

.filtre-container select:hover {
    background-color: var(--bleu-vert);
}

.filtre-container select option {
    background-color: var(--blanc);
    color: #333;
    font-weight: normal;
}

.compteur-annee {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compteur-annee-texte {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.compteur-nombre {
    font-size: 28px;
    font-weight: bold;
    color: var(--bleu-vert);
}

.compteur-label {
    color: #666;
    font-size: 14px;
}

@media (max-width: 768px) {
    .filtre-container {
        flex-direction: column;
        text-align: center;
    }

    .compteur-nombre {
        font-size: 36px;
    }
}