/* =========================================================================
   MODULAR PRIVACY POPUP (OS26 - LES PRÉS ADAPTATION)
   ========================================================================= */

:root {
    /* Couleur de fond du site Les Prés pour l'overlay */
    --privacy-bg-color: #EDE5D9; 
    --privacy-app-icon: url('app-icon.png');
    --os-blue: #007AFF;
    --os-radius-desk: 26px;
    --os-radius-mob: 35px;
}

/* --- VIEWPORT & OVERLAY --- */
#optout-popup {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    position: fixed;
    z-index: 99999;
    top: 0; left: 0; width: 100vw; height: 100vh;
}

#optout-popup.active {
    opacity: 1;
    pointer-events: auto;
}

.c-popup-viewport {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%; height: 100%;
    /* SF Pro Priority */
    font-family: "SF Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.c-popup-viewport::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    
    /* LIGHT MODE (Défaut) */
    background-color: rgba(33, 33, 33, 0.23);
    
    opacity: 0.5;
    z-index: -1;
}

.c-popup-before { flex-grow: 0.8; }
.c-popup-after { flex-grow: 1.2; }


/* =========================================
   DESKTOP STYLES (Défaut)
   ========================================= */

.c-popup {
    position: relative;
    width: 260px;
    height: auto;
    min-height: 256px;
    
    /* DESK LIGHT */
    background-color: rgba(255,255,255,0.74);
    border: 1px solid rgba(255,255,255,0.20);
    box-shadow: 
        inset 0 0.5px 0.5px 0 rgba(255,255,255,0.45), 
        0 0 1px 0 rgba(0,0,0,0.60), 
        0 10px 30px 0 rgba(0,0,0,0.15), 
        0 20px 50px 0 rgba(0,0,0,0.30);
    border-radius: var(--os-radius-desk);
    
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    overflow: hidden;
    transform: scale(1.1);
    opacity: 0;
}

#optout-popup.active .c-popup {
    animation: popup-appear-desk 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

@keyframes popup-appear-desk {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.c-popup-content {
    padding: 20px 16px 16px 16px;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.inside-popup {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- ICONE --- */
.app-icon {
    width: 64px; height: 64px;
    margin: 0 auto 16px 0;
    background-image: var(--privacy-app-icon);
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

/* --- TEXTE --- */
p.c-message {
    font-size: 13px;
    font-weight: 700;
    line-height: 16px;
    color: #000;
    margin: 0 0 22px 0;
    text-align: left;
    letter-spacing: 0;
}

/* --- CHECKBOX ROW --- */
.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    cursor: default !important;
}

.checkbox-label {
    font-size: 13px;
    font-weight: 510;
    line-height: 16px;
    text-align: left;
    color: #000;
    opacity: 0.8;
    letter-spacing: -0.2px;
}

/* CUSTOM NATIVE CHECKBOX */
.checkbox-container input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    
    /* Couleur par défaut (Unchecked) : On garde le style "Bouton" */
    background-color: rgba(0,0,0,0.07);
    
    margin: 0;
    font: inherit;
    
    /* Dimensions */
    width: 16px;
    height: 16px;
    
    border-radius: 4px; /* Standard macOS checkbox radius */
    border: none;
    
    display: grid;
    place-content: center;
    flex-shrink: 0;
    
    cursor: default !important;
    margin-top: 1px;
    
    /* Transition douce pour le fond */
    transition: background-color 0.2s ease;
}

/* État Checked (Bleu + Icône SVG) */
.checkbox-container input[type="checkbox"]:checked {
    background-color: var(--os-blue);
    
    /* Checkbox SVG */
    background-image: url('checkbox-a.svg');
    background-size: 16px; /* Taille de la coche à l'intérieur de la case de 16px */
    background-repeat: no-repeat;
    background-position: center;
}

/* On supprime définitivement l'ancien dessin CSS */
.checkbox-container input[type="checkbox"]::before {
    display: none;
}

/* --- BUTTON --- */
.inside-popup button.leave-button {
    width: 100%;
    height: 29px;
    background-color: rgba(0,0,0,0.07);
    color: #000;
    border: none;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 510;
    letter-spacing: -0.2px;
    cursor: default !important;
    margin-top: auto;
    transition: background-color 0.1s;
}

.inside-popup button.leave-button:active {
    background-color: rgba(0,0,0,0.15);
}


/* =========================================
   DARK MODE
   ========================================= */
@media (prefers-color-scheme: dark) {

    /* AJOUT : Overlay Dark Mode */
    .c-popup-viewport::after {
        background-color: rgba(0, 0, 0, 0.52);
    }

    .c-popup {
        background-color: rgba(32,32,32,0.57);
        border: 1px solid rgba(255,255,255,0.20);
        box-shadow: inset 0 0.5px 0.5px 0 rgba(255,255,255,0.45), 0 0 1px 0 rgba(0,0,0,0.60), 0 10px 30px 0 rgba(0,0,0,0.15), 0 20px 50px 0 rgba(0,0,0,0.30);
    }

    p.c-message { color: #fff; }
    .checkbox-label { color: #fff; opacity: 1; font-weight: 400; }
    
    .checkbox-container input[type="checkbox"] {
        background-color: rgba(255,255,255,0.08);
    }
    
    .inside-popup button.leave-button {
        background-color: rgba(255,255,255,0.08);
        color: #fff;
    }
    .inside-popup button.leave-button:active {
        background-color: rgba(255,255,255,0.15);
    }

    .inside-popup button,
    .inside-popup button.leave-button,
    .inside-popup button.leave-button:hover,
    .inside-popup button.leave-button:active {
        box-shadow: none !important;
    }
}

#matomo-opt-out { padding: 0 6px; }


/* =========================================
   MOBILE RESPONSIVE
   ========================================= */
@media (max-width: 600px) {
    
    #matomo-opt-out { padding: 0 14px; }

    .c-popup {
        width: auto;
        max-width: 320px;
        margin: 0 36px;
        height: auto;
        min-height: auto;
        border-radius: var(--os-radius-mob);
        
        /* Mobile Light Shadow override */
        box-shadow: inset 0 0 1px 1px #FFFFFF, 0 10px 60px 0 rgba(0,0,0,0.15), 0 20px 200px 0 rgba(0,0,0,0.15);
    }

    .c-popup-content {
        padding: 21px 16px 16px 16px;
    }

    #optout-popup.active .c-popup {
        animation: popup-appear-mobile 0.3s ease forwards;
    }
    @keyframes popup-appear-mobile {
        from { transform: scale(1.2); opacity: 0; }
        to   { transform: scale(1); opacity: 1; }
    }

    .app-icon { display: none; }

    p.c-message {
        font-size: 17px;
        font-weight: 600;
        line-height: 22px;
        margin-bottom: 30px;
    }

    .checkbox-container { margin-bottom: 30px; }
    .checkbox-label {
        font-size: 15px;
        font-weight: 400;
        line-height: 20px;
        letter-spacing: 0;
    }
    .checkbox-container input[type="checkbox"] {
        width: 18px;
        height: 18px;
        background-color: rgba(0,0,0,0.10);
    }


    .checkbox-container input[type="checkbox"]:checked {
        background-color: var(--os-blue);
        
        /* Checkbox SVG */
        background-size: 18px; /* Taille de la coche à l'intérieur de la case de 18px */
    }

    .inside-popup button.leave-button {
        height: 48px;
        font-size: 17px;
        line-height: 16px;
        font-weight: 510;
        letter-spacing: -0.06px;
        background-color: rgba(0,0,0,0.10);
    }
}

/* DARK MODE MOBILE OVERRIDES */
@media (max-width: 600px) and (prefers-color-scheme: dark) {
    .c-popup {
        /* Mobile Dark Shadow override */
        box-shadow: 0 10px 60px 0 rgba(0,0,0,0.15), 0 20px 200px 0 rgba(0,0,0,0.15);
    }
    .checkbox-container input[type="checkbox"] { background-color: rgba(255,255,255,0.12); }
    .inside-popup button.leave-button { background-color: rgba(255,255,255,0.12); }
}







.c-popup-viewport button:hover,
.c-popup-viewport button:focus,
.c-popup-viewport button:active,
.c-popup-viewport .button:hover,
.c-popup-viewport .button:focus,
.c-popup-viewport .button:active,
.c-popup-viewport .wp-block-button__link:hover,
.c-popup-viewport .wp-block-button__link:focus,
.c-popup-viewport .wp-block-button__link:active,
.c-popup-viewport input[type="button"]:hover,
.c-popup-viewport input[type="button"]:focus,
.c-popup-viewport input[type="button"]:active,
.c-popup-viewport input[type="reset"]:hover,
.c-popup-viewport input[type="reset"]:focus,
.c-popup-viewport input[type="reset"]:active,
.c-popup-viewport input[type="submit"]:hover,
.c-popup-viewport input[type="submit"]:focus,
.c-popup-viewport input[type="submit"]:active,
.c-popup-viewport .elementor-button-wrapper .elementor-button:hover,
.c-popup-viewport .elementor-button-wrapper .elementor-button:focus,
.c-popup-viewport .elementor-button-wrapper .elementor-button:active {
    box-shadow: none !important;
}

.c-popup-viewport ::selection {
    background: transparent !important;
}

    .c-popup-viewport ::-moz-selection { /* Firefox */
        background: transparent !important;
    }

.c-popup-viewport {
    cursor: default !important;
}