/* ==================== POPUP OVERLAY ==================== */
.wgb-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: none;
    overflow-y: auto;
    padding: 20px;
}

/* Bloquer le scroll du body quand popup ouverte */
body.wgb-popup-open {
    overflow: hidden;
}

/* ==================== POPUP CONTAINER ==================== */
.wgb-popup-container {
    max-width: 900px;
    margin: 40px auto;
    background: #142451;
    border-radius: 12px;
    position: relative;
    transform: translateY(-30px);
    opacity: 0;
    transition: all 0.3s ease;
}
/* ==================== BADGE SVG ==================== */
/* ==================== BADGE SVG ==================== */
.wgb-popup-badge {
    position: absolute;
    top: -60px;
    left: -60px;
    z-index: 20;
    width: 150px;
    height: 150px;
    pointer-events: none;
    animation: badgeBounce 2.5s ease-in-out infinite;
}

.wgb-popup-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Animation bounce douce */
@keyframes badgeBounce {
    0%, 100% { 
        transform: scale(1) translateY(0) rotate(0deg); 
    }
    50% { 
        transform: scale(1.08) translateY(-5px) rotate(-3deg); 
    }
}

/* Responsive */
@media (max-width: 768px) {
    .wgb-popup-badge {
        width: 100px;
        height: 100px;
        top: -20px;
        left: -20px;
    }
}
.wgb-popup-container.wgb-popup-show {
    transform: translateY(0);
    opacity: 1;
}

/* ==================== BOUTON FERMETURE ==================== */
.wgb-popup-close {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    background: transparent !important;
    border: 2px solid #F0B9F0 !important;
    color: #F0B9F0 !important;
    width: 45px !important;
    height: 45px !important;
    border-radius: 50% !important;
    font-size: 28px !important;
    cursor: pointer !important;
    z-index: 10 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s !important;
    line-height: 45px !important;
    padding: 0 !important;
}

.wgb-popup-close:hover,
button.wgb-popup-close:hover,
button.wgb-popup-close:focus-visible {
    background: #F0B9F0 !important;
    color: #142451 !important;
    transform: rotate(90deg) !important;
    line-height: 45px !important;
}

/* 26/10 : croix des boutons de fermeture dessinée en CSS (deux traits centrés)
   au lieu du caractère « × », dont la position dans le rond dépend de la
   police. Couleur = celle du texte du bouton, survol compris. */
.wgb-popup-close,
.wgb-modal-close,
.wgb-sub-modal-close,
.wgb-participant-detail-close {
    font-size: 0 !important;
    line-height: 0 !important;
}
.wgb-popup-close::before, .wgb-popup-close::after,
.wgb-modal-close::before, .wgb-modal-close::after,
.wgb-sub-modal-close::before, .wgb-sub-modal-close::after,
.wgb-participant-detail-close::before, .wgb-participant-detail-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
    pointer-events: none;
}
.wgb-popup-close::after,
.wgb-modal-close::after,
.wgb-sub-modal-close::after,
.wgb-participant-detail-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}


/* ==================== CONTENU POPUP ==================== */
.wgb-popup-content {
    padding: 0;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* Scrollbar personnalisée */
.wgb-popup-content::-webkit-scrollbar {
    width: 8px;
}

.wgb-popup-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.wgb-popup-content::-webkit-scrollbar-thumb {
    background: #F0B9F0;
    border-radius: 4px;
}

.wgb-popup-content::-webkit-scrollbar-thumb:hover {
    background: #fff;
}

/* ==================== AJUSTEMENTS FORMULAIRE DANS POPUP ==================== */
.wgb-popup-overlay .wgb-registration-modal {
    min-height: auto;
    padding: 40px 20px;
    margin: 0;
}

.wgb-popup-overlay .wgb-modal-header {
    margin-bottom: 20px;
}

.wgb-popup-overlay .wgb-modal-body {
    max-width: 100%;
}

/* Masquer le badge si trop encombrant dans popup */
.wgb-popup-overlay .wgb-badge {
    display: block;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .wgb-popup-overlay {
        padding: 0;
    }
    
    .wgb-popup-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        max-width: 100%;
    }
    
    .wgb-popup-content {
        max-height: calc(100vh - 80px);
    }
    
    .wgb-popup-close {
        position: fixed;
        top: 10px;
        right: 10px;
        background: #F0B9F0;
        color: #142451;
        z-index: 99999;
    }
}

/* ==================== ANIMATION ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==================== FENÊTRES SYSTÈME (26/10) ====================
   Chargement, message, « Adresse email différente », « Compte existant »
   (popup-groupbuy.js : showLoader, showMessage, showChoiceDialog). Charte :
   fond bleu marine, texte crème, titre rose ; bouton principal rose / texte
   bleu, secondaire contour crème ; survol et focus contrastés. */
.wgb-sys-overlay {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(20, 36, 81, 0.75);
}
.wgb-sys-box {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: auto;
    padding: 36px 32px 28px;
    background: #142451;
    color: #F2E2D0;
    border: 2px solid rgba(240, 185, 240, 0.35);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    font-family: 'hoss-sharp', sans-serif;
    text-align: left;
    box-sizing: border-box;
}
.wgb-sys-box-compact {
    max-width: 400px;
    padding: 28px 28px 24px;
    text-align: center;
}
.wgb-sys-box .wgb-popup-close {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    width: 40px !important;
    height: 40px !important;
}
.wgb-sys-title {
    margin: 0 48px 14px 0;
    color: #F0B9F0;
    font-family: 'Decoy', 'hoss-sharp', serif;
    font-size: 24px;
    line-height: 1.25;
}
.wgb-sys-text {
    margin: 0 0 12px;
    color: #F2E2D0;
    font-size: 15px;
    line-height: 1.55;
}
.wgb-sys-text strong {
    color: #F0B9F0;
    word-break: break-word;
}
.wgb-sys-box-compact .wgb-sys-text {
    margin: 0;
    font-size: 16px;
}
.wgb-sys-box-compact .wgb-spinner {
    margin: 0 auto 14px;
}
.wgb-sys-box.is-error {
    border-color: #F0B9F0;
}
.wgb-sys-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 22px;
}
.wgb-sys-overlay .wgb-sys-btn {
    display: block;
    width: 100%;
    padding: 13px 18px;
    border-radius: 999px;
    border: 2px solid transparent;
    font-family: 'hoss-sharp', sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    word-break: break-word;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.wgb-sys-overlay .wgb-sys-btn.is-primary {
    background: #F0B9F0;
    border-color: #F0B9F0;
    color: #142451;
}
.wgb-sys-overlay .wgb-sys-btn.is-primary:hover,
.wgb-sys-overlay .wgb-sys-btn.is-primary:focus-visible,
.wgb-sys-overlay .wgb-sys-btn.is-primary:active {
    background: #fff;
    border-color: #F2E2D0;
    color: #142451;
}
.wgb-sys-overlay .wgb-sys-btn.is-secondary {
    background: transparent;
    border-color: #F2E2D0;
    color: #F2E2D0;
}
.wgb-sys-overlay .wgb-sys-btn.is-secondary:hover,
.wgb-sys-overlay .wgb-sys-btn.is-secondary:focus-visible,
.wgb-sys-overlay .wgb-sys-btn.is-secondary:active {
    background: #fff;
    border-color: #F2E2D0;
    color: #142451;
}
.wgb-sys-overlay .wgb-sys-btn.is-link {
    background: transparent;
    border-color: transparent;
    color: #F2E2D0;
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.wgb-sys-overlay .wgb-sys-btn.is-link:hover,
.wgb-sys-overlay .wgb-sys-btn.is-link:focus-visible,
.wgb-sys-overlay .wgb-sys-btn.is-link:active {
    background: transparent;
    color: #F0B9F0;
}
.wgb-sys-overlay .wgb-sys-btn:focus-visible {
    outline: 3px solid #F0B9F0;
    outline-offset: 3px;
}
@media (max-width: 480px) {
    .wgb-sys-overlay { padding: 16px; }
    .wgb-sys-box { padding: 30px 20px 22px; }
    .wgb-sys-title { font-size: 21px; }
}

/* ==================== RESPONSIVE 27/10 : POP-UPS SUR TÉLÉPHONE ==================== */
/* Zone de messages vide : ne doit pas créer d'écart dans le formulaire */
[id^="wgb-registration-messages"]:empty {
    display: none;
}
@media (max-width: 768px) {
    .wgb-popup-overlay .wgb-registration-modal {
        max-width: none;
        width: 100% !important;
        margin: 0 !important;
        padding: 64px 20px 32px !important;
    }
    .wgb-popup-badge {
        width: 72px;
        height: 72px;
        top: 6px;
        left: 6px;
    }
    .wgb-popup-overlay .wgb-popup-content {
        max-height: 100vh;
        max-height: 100dvh;
    }
    .wgb-popup-overlay .wgb-registration-form {
        gap: 28px;
    }
    .wgb-popup-overlay [id^="wgb-registration-messages"] + .wgb-form-section {
        padding-top: 0;
    }
    .wgb-popup-overlay .wgb-radio-group-inline {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 20px;
    }
    .wgb-popup-overlay .wgb-radio-inline {
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        min-height: 44px;
        margin: 0;
        cursor: pointer;
    }
    .wgb-popup-overlay .wgb-radio-inline input[type="radio"] {
        width: 22px;
        height: 22px;
        margin: 0;
        flex: none;
    }
}

/* 27/10 : liens dans les fenêtres système (ex. « Mot de passe oublié ? ») */
.wgb-sys-text a {
    color: #F0B9F0;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
}
.wgb-sys-text a:hover,
.wgb-sys-text a:focus-visible {
    color: #F2E2D0;
}
