/* ===========================
   CJCA 2026 - Badge Premium CSS
   =========================== */

/* Page Body */
.badge-page-body {
    background: var(--dark);
    min-height: 100vh;
}

/* Main */
.badge-main {
    padding: 140px 0 80px;
    min-height: 100vh;
}

/* Page Header */
.badge-page-header {
    text-align: center;
    margin-bottom: 60px;
}

.badge-page-header .page-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 24px;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 24px;
}

.badge-page-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--white);
    margin-bottom: 16px;
}

.badge-page-header h1 em {
    font-style: normal;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.badge-page-header p {
    font-size: 1.1rem;
    color: var(--gray-400);
}

/* Badge Wrapper */
.badge-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

/* No Badge State */
.no-badge-state {
    text-align: center;
    padding: 80px 40px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    max-width: 500px;
}

.no-badge-icon {
    width: 100px;
    height: 100px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--white);
    margin: 0 auto 24px;
    opacity: 0.5;
}

.no-badge-state h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--white);
    margin-bottom: 12px;
}

.no-badge-state p {
    color: var(--gray-400);
    margin-bottom: 32px;
    line-height: 1.7;
}

/* Badge Display */
.badge-display {
    display: none;
}

.badge-display.active {
    display: block;
}

/* ===========================
   Badge Template (PNG fond + overlays)
   Image source : 1668 x 2362 (ratio portrait A4)
   =========================== */
@font-face {
    font-family: 'JekoBold';
    src: url('../jeko-bold.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'Jeko';
    src: url('../jeko-bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: block;
}

.badge-template {
    position: relative;
    width: 480px;
    max-width: 94vw;
    aspect-ratio: 1668 / 2362;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    container-type: inline-size;
    font-family: 'JekoBold', 'Jeko', sans-serif;
}
.badge-template * {
    font-family: 'JekoBold', 'Jeko', sans-serif !important;
}

/* Photo — mesures réelles du template (cyan #36B3FF) */
.badge-template .bt-photo {
    position: absolute;
    left: 12.82%;
    top: 28.47%;
    width: 32.57%;
    height: 27.02%;
    overflow: hidden;
    background: #fff;
}
.badge-template .bt-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.badge-template .bt-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #94a3b8;
    font-size: 8cqw;
}

/* Drapeau — cercle blanc haut droite de la zone blanche */
.badge-template .bt-flag {
    position: absolute;
    right: 9%;
    top: 28%;
    width: 11%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.22);
}
.badge-template .bt-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.badge-template .bt-flag .bt-flag-fallback {
    font-family: 'Jeko', sans-serif;
    font-weight: 700;
    font-size: 3.8cqw;
    color: #1a202c;
}

/* Identité — juste sous la photo (photo bottom = 28.47+27.02 = 55.49%) */
.badge-template .bt-identity {
    position: absolute;
    left: 12.82%;
    top: 57.5%;
    width: 50%;
    color: #0d0d0d;
    font-family: 'Jeko', sans-serif;
}
.badge-template .bt-name {
    font-family: 'Jeko', sans-serif;
    font-size: 5.6cqw;
    font-weight: 700;
    line-height: 1.05;
    margin-bottom: 1cqw;
    letter-spacing: -0.3px;
    color: #0d0d0d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.badge-template .bt-fonction {
    font-family: 'Jeko', sans-serif;
    font-size: 2.7cqw;
    font-weight: 700;
    color: #222;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* QR — carré blanc imprimé (mesuré : right 13.5%, top 62.8%, w 12.8%) */
.badge-template .bt-qr {
    position: absolute;
    right: 13.5%;
    top: 62.8%;
    width: 12.8%;
    aspect-ratio: 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3cqw;
}
.badge-template .bt-qr img,
.badge-template .bt-qr canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    border-radius: 0 !important;
}

/* Bande type de participation en bas — mesures réelles */
.badge-template .bt-type {
    position: absolute;
    left: 7.98%;
    top: 78.79%;
    width: 84.34%;
    height: 15.05%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: 'Jeko', sans-serif;
    font-style: italic;
    font-weight: 700;
    font-size: 11cqw;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1;
    text-shadow: 0 2px 6px rgba(0,0,0,0.22);
    white-space: nowrap;
    overflow: hidden;
    padding: 0 2%;
}

@media (max-width: 520px) {
    .badge-template { width: 100%; }
}

/* Badge Card */
.badge-card {
    width: 400px;
    background: linear-gradient(180deg, var(--dark-lighter) 0%, var(--dark) 100%);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Badge Header */
.badge-card-header {
    padding: 24px;
    text-align: center;
    position: relative;
    background: linear-gradient(135deg, #5BC0DE 0%, #3AAED0 100%);
}

/* Couleurs du bandeau basées sur la langue sélectionnée */
.badge-card.lang-fr .badge-card-header { background: linear-gradient(135deg, #5BC0DE 0%, #3AAED0 100%); }
.badge-card.lang-en .badge-card-header { background: linear-gradient(135deg, #1C358E 0%, #152A70 100%); }
.badge-card.lang-ar .badge-card-header { background: linear-gradient(135deg, #E74C3C 0%, #C0392B 100%); }
.badge-card.lang-pt .badge-card-header { background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%); }
.badge-card.lang-sw .badge-card-header { background: linear-gradient(135deg, #F1C40F 0%, #D4AC0D 100%); }

.badge-event-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 4px;
}

.badge-event-year {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 2px;
}

.badge-category-tag {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--white);
}

/* Badge Body */
.badge-card-body {
    padding: 32px 24px;
    text-align: center;
}

.badge-photo-container {
    width: 140px;
    height: 170px;
    margin: 0 auto 20px;
    position: relative;
}

.badge-photo {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 4px solid var(--glass-border);
}

.badge-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-photo-icon {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.9rem;
}

.badge-card.vip .badge-photo-icon { background: var(--gradient-gold); }
.badge-card.paneliste .badge-photo-icon { background: var(--gradient-primary); }
.badge-card.directeur .badge-photo-icon { background: linear-gradient(135deg, #4B5563 0%, #374151 100%); }
.badge-card.participant .badge-photo-icon { background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%); }
.badge-card.staff .badge-photo-icon { background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%); }
.badge-card.presse .badge-photo-icon { background: linear-gradient(135deg, #A855F7 0%, #9333EA 100%); }
.badge-card.hotesse .badge-photo-icon { background: linear-gradient(135deg, #EC4899 0%, #DB2777 100%); }
.badge-card.organisateur .badge-photo-icon { background: var(--gradient-accent); }

.badge-name {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 4px;
    line-height: 1.3;
}

.badge-fonction {
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 4px;
}

.badge-organisation {
    font-size: 0.9rem;
    color: var(--gray-400);
    margin-bottom: 4px;
}

.badge-pays {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* Badge Footer / QR */
.badge-card-footer {
    padding: 24px;
    background: var(--glass-bg);
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 20px;
}

.badge-qr {
    width: 100px;
    height: 100px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 8px;
    flex-shrink: 0;
}

.badge-qr canvas {
    width: 100% !important;
    height: 100% !important;
}

.badge-qr-info {
    flex: 1;
}

.badge-id {
    font-family: 'Jeko', sans-serif !important;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.badge-qr-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
    line-height: 1.5;
}

/* Badge Actions */
.badge-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 60px;
    flex-wrap: wrap;
}

/* Search Section */
.badge-search-section {
    max-width: 600px;
    margin: 0 auto;
}

.search-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 40px;
    text-align: center;
}

.search-card h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--white);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.search-card h3 i {
    color: var(--accent);
}

.search-card > p {
    color: var(--gray-400);
    margin-bottom: 24px;
}

.search-form {
    display: flex;
    gap: 12px;
}

.search-form .input-wrapper {
    flex: 1;
    position: relative;
}

.search-form .input-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}

.search-form input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: var(--dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--white);
    font-size: 0.95rem;
}

.search-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-form input::placeholder {
    color: var(--gray-600);
}

/* Mini Footer */
.mini-footer {
    padding: 24px 0;
    background: transparent;
}

.mini-footer .footer-bottom {
    padding: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .badge-card {
        width: 100%;
        max-width: 360px;
    }
    
    .badge-actions {
        flex-direction: column;
        padding: 0 20px;
    }
    
    .badge-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .badge-card-footer {
        flex-direction: column;
        text-align: center;
    }
}

/* Print Styles */
@media print {
    @page {
        size: auto;
        margin: 10mm;
    }

    html, body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body * {
        visibility: hidden;
    }

    #badgeCard, #badgeCard * {
        visibility: visible;
    }

    #badgeCard {
        position: absolute !important;
        left: 50% !important;
        top: 0 !important;
        transform: translateX(-50%) !important;
        box-shadow: none !important;
        background-color: #fff !important;
        width: 160mm !important;
        max-width: 160mm !important;
    }

    /* Forcer l'impression des couleurs et images de fond (template PNG) */
    #badgeCard,
    #badgeCard * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}

/* === Code d'accès sur le badge === */
.badge-access-code {
    background: linear-gradient(135deg, rgba(35, 65, 175, 0.08) 0%, rgba(91, 192, 222, 0.08) 100%);
    border: 1px dashed rgba(35, 65, 175, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 16px 20px 20px;
    text-align: center;
}

.access-code-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary, #2341AF);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.access-code-credentials {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.access-code-credentials span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Jeko', sans-serif !important;
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
    background: rgba(255, 255, 255, 0.7);
    padding: 8px 16px;
    border-radius: 8px;
}

.access-code-credentials span i {
    font-size: 12px;
    color: var(--primary, #2341AF);
}

.access-code-hint {
    font-size: 10px;
    color: #64748B;
    line-height: 1.4;
}

.access-code-hint strong {
    color: var(--primary, #2341AF);
}
