:root {
    --primary: #0056b3;
    --accent: #00a8ff;
    --gold: #c5a059;
    --dark: #1a1a1a;
    --bg-gray: #f4f6f9;
}

body { font-family: 'Segoe UI', sans-serif; background: var(--bg-gray); margin: 0; }

/* Admin Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; }
.btn { padding: 8px 15px; border: none; border-radius: 4px; cursor: pointer; color: white; text-decoration:none; display:inline-block;}
.btn-primary { background: var(--primary); }
.btn-danger { background: #dc3545; }
.btn-success { background: #28a745; }

/* --- NOUVEAU DESIGN BADGE PORTRAIT --- */
/* Taille standard ~ A6/A7 pour badge cou (9cm x 13cm) */
.badge-wrapper {
    width: 9cm; 
    height: 13cm; 
    position: relative;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-family: 'Trebuchet MS', sans-serif;
    text-align: center;
    display: flex;
    flex-direction: column;
    page-break-inside: avoid;
    border: 1px solid #ddd;
}

/* === DESIGN STANDARD (PARTICIPANT) === */
.badge-wrapper.standard {
    background: linear-gradient(180deg, #ffffff 60%, #eef2f5 100%);
}
.badge-wrapper.standard::before {
    content: ""; position: absolute; top: -50px; left: -50%; width: 200%; height: 150px;
    background: var(--primary); border-radius: 0 0 50% 50%; z-index: 0;
}

.badge-photo-container {
    margin-top: 40px; position: relative; z-index: 1;
    display: flex; justify-content: center;
}
.badge-photo {
    width: 140px; height: 140px; border-radius: 50%; object-fit: cover;
    border: 5px solid white; box-shadow: 0 4px 8px rgba(0,0,0,0.2); background: #ddd;
}

.badge-content { padding: 10px; flex: 1; display: flex; flex-direction: column; justify-content: center; z-index: 1;}
.badge-event { color: rgba(255,255,255,0.9); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 5px; font-weight: bold; position: absolute; top: 15px; width: 100%; left:0;}

.badge-name { font-size: 24px; font-weight: 900; color: #333; margin: 10px 0 5px 0; line-height: 1.1; text-transform: uppercase; }
.badge-role { font-size: 14px; color: var(--primary); font-weight: bold; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.badge-meta { font-size: 14px; color: #666; margin-bottom: 2px; }
.badge-assoc { font-weight: bold; color: #444; }

.badge-footer {
    margin-top: auto; padding: 15px;
    display: flex; justify-content: space-between; align-items: center;
    background: white; border-top: 1px dashed #ccc;
}
.qr-code { width: 60px; height: 60px; } /* QR généré ici */
.badge-id { font-family: monospace; font-size: 14px; background: #eee; padding: 3px 8px; border-radius: 4px; }

/* === DESIGN COMITÉ (GOLD/DARK) === */
.badge-wrapper.committee {
    background: #1a1a1a; color: white; border: 2px solid var(--gold);
}
.badge-wrapper.committee::before {
    background: linear-gradient(45deg, var(--gold), #f3e5ab);
    height: 160px; top: -60px;
}
.badge-wrapper.committee .badge-photo { border-color: var(--gold); }
.badge-wrapper.committee .badge-name { color: var(--gold); text-shadow: 0 1px 2px black; }
.badge-wrapper.committee .badge-role { color: white; background: var(--gold); display: inline-block; padding: 2px 15px; border-radius: 20px; font-size: 12px; color: black; margin-bottom:15px;}
.badge-wrapper.committee .badge-meta { color: #ccc; }
.badge-wrapper.committee .badge-footer { background: #222; border-top: 1px solid #444; }
.badge-wrapper.committee .badge-id { background: #333; color: var(--gold); border: 1px solid #555; }

/* PRINT SETTINGS */
@media print {
    body * { visibility: hidden; }
    .print-area, .print-area * { visibility: visible; }
    .print-area { 
        position: absolute; top: 0; left: 0; width: 100%;
        display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; 
    }
    .badge-wrapper { 
        margin: 5px; page-break-inside: avoid; border: 1px solid #ccc; 
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .no-print { display: none !important; }
}


/* --- BATCH PRINTING (A4) --- */
.a4-page {
    width: 210mm;
    height: 297mm;
    background: white;
    margin: 0 auto 20px auto; /* Marge visuelle à l'écran */
    padding: 10mm; /* Marge interne de sécurité */
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 colonnes */
    grid-template-rows: 1fr 1fr;    /* 2 lignes */
    gap: 10mm; /* Espace entre les badges */
    page-break-after: always; /* Force nouvelle page après chaque bloc de 4 */
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Le dernier badge ne doit pas forcer une page blanche inutile */
.a4-page:last-child {
    page-break-after: auto;
}

@media print {
    body { background: white; }
    .a4-page {
        margin: 0;
        box-shadow: none;
        page-break-after: always;
    }
    /* Cacher les boutons et interfaces lors de l'impression */
    .no-print { display: none !important; }
}