/* =========================================================
   AZORLEARN — POPUP PROMOTIONNEL (v3)
   - Toujours entièrement visible : la fenêtre se centre quand elle
     tient dans l'écran, sinon elle commence en haut et on peut défiler
     (le haut et le bas ne sont jamais coupés, PC comme mobile).
   - Version courte sur mobile.
   - Police : celle du site (Sora, via assets/css/police.css).
   ========================================================= */

.azorlearn-popup {
    --pz-navy: #0a1a3a;
    --pz-blue: #0b5fe0;
    --pz-blue-2: #2f86f5;
    --pz-amber: #f5a524;
    --pz-text: #3d4c69;

    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: flex-start;      /* + margin:auto sur la fenêtre = centrage sans coupure */
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease, visibility .35s ease;
}

.azorlearn-popup, .azorlearn-popup * { box-sizing: border-box; }

.azorlearn-popup.is-open { visibility: visible; opacity: 1; pointer-events: auto; }

/* ---------- Fond ---------- */

.popup-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 40%, rgba(11, 60, 150, .35), rgba(5, 14, 36, .72));
    -webkit-backdrop-filter: blur(6px);
            backdrop-filter: blur(6px);
    cursor: pointer;
}

/* ---------- Fenêtre ---------- */

.popup-container {
    position: relative;
    z-index: 2;
    width: min(820px, 100%);
    margin: auto;                 /* centré verticalement s'il y a la place */
    display: grid;
    grid-template-columns: 40% 60%;
    overflow: hidden;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 40px 100px rgba(3, 12, 35, .45), 0 0 0 1px rgba(255, 255, 255, .6) inset;
    transform: translateY(24px) scale(.95);
    opacity: 0;
    transition: transform .55s cubic-bezier(.2, .9, .25, 1.15), opacity .4s ease;
}

.azorlearn-popup.is-open .popup-container { transform: none; opacity: 1; }

/* ---------- Visuel ---------- */

.popup-image {
    position: relative;
    overflow: hidden;
    min-height: 100%;
    background: #0a1a3a;
}

.popup-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.08);
    transition: transform 6s ease;
}
.azorlearn-popup.is-open .popup-image img { transform: scale(1); }

.popup-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(200deg, transparent 40%, rgba(5, 18, 50, .75) 100%);
}

.popup-ribbon {
    position: absolute;
    top: 22px;
    left: -46px;
    z-index: 2;
    width: 200px;
    padding: 8px 0;
    background: var(--pz-amber);
    color: #1a1300;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
    text-align: center;
    transform: rotate(-40deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
}

.popup-floating {
    position: absolute;
    left: 18px;
    bottom: 18px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 15px 11px 11px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .25);
    animation: pz-float 4s ease-in-out infinite;
}
.popup-floating strong { display: block; color: var(--pz-navy); font-size: 14.5px; font-weight: 800; line-height: 1.2; }
.popup-floating small { display: block; color: var(--pz-text); font-size: 12.5px; font-weight: 500; }

.popup-floating__icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #ffe8d3;
    color: #ea6a0a;
}
.popup-floating__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

@keyframes pz-float { 50% { transform: translateY(-6px); } }

/* ---------- Contenu ---------- */

.popup-content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 34px 36px 26px;
    background:
        radial-gradient(circle at 100% 0%, rgba(47, 134, 245, .12), transparent 45%),
        #fff;
}

.popup-content > * {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .5s ease, transform .5s ease;
}
.azorlearn-popup.is-open .popup-content > * { opacity: 1; transform: none; }
.azorlearn-popup.is-open .popup-content > *:nth-child(1) { transition-delay: .15s; }
.azorlearn-popup.is-open .popup-content > *:nth-child(2) { transition-delay: .2s; }
.azorlearn-popup.is-open .popup-content > *:nth-child(3) { transition-delay: .25s; }
.azorlearn-popup.is-open .popup-content > *:nth-child(4) { transition-delay: .3s; }
.azorlearn-popup.is-open .popup-content > *:nth-child(5) { transition-delay: .35s; }
.azorlearn-popup.is-open .popup-content > *:nth-child(6) { transition-delay: .4s; }
.azorlearn-popup.is-open .popup-content > *:nth-child(7) { transition-delay: .45s; }
.azorlearn-popup.is-open .popup-content > *:nth-child(8) { transition-delay: .5s; }

.popup-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    margin-bottom: 12px;
    padding: 6px 13px;
    border-radius: 999px;
    background: #e8f1ff;
    color: var(--pz-blue);
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.popup-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pz-blue);
    animation: pz-ping 1.8s infinite;
}
@keyframes pz-ping {
    0% { box-shadow: 0 0 0 0 rgba(11, 95, 224, .5); }
    80%, 100% { box-shadow: 0 0 0 8px rgba(11, 95, 224, 0); }
}

.popup-content h2 {
    margin: 0 0 10px;
    padding-right: 40px;
    color: var(--pz-navy);
    font-size: clamp(28px, 3.3vw, 38px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -1px;
}
.popup-content h2 span {
    background: linear-gradient(90deg, var(--pz-blue), #43b9f2);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}

.popup-subtitle { margin: 0 0 12px; color: var(--pz-text); font-size: 16px; font-weight: 500; line-height: 1.5; }
.popup-subtitle strong { color: var(--pz-navy); font-weight: 800; }

.popup-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 10px; padding: 11px 15px; border-radius: 16px; background: linear-gradient(120deg, #fff6e6, #eef5ff); border: 1px dashed #f5b14a; }
.popup-price del { color: #7d8aa1; font-size: 15px; font-weight: 600; }
.popup-price strong { color: #0b5fe0; font-size: 29px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.popup-price span { padding: 3px 10px; border-radius: 999px; background: #f5a524; color: #2a1b00; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* Date limite */
.popup-deadline {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 14px;
    padding: 9px 12px;
    border-radius: 12px;
    background: #fff1f1;
    border: 1px solid #ffd2d2;
    color: #8f1d22;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}
.popup-deadline svg { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: #e5484d; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.popup-deadline b { color: #c0262d; font-weight: 800; }

.popup-list { display: grid; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.popup-list li { display: flex; align-items: flex-start; gap: 10px; color: var(--pz-navy); font-size: 14.5px; font-weight: 500; line-height: 1.45; }
.popup-list li b { font-weight: 700; }
.popup-list svg {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    padding: 4px;
    border-radius: 50%;
    background: #d9f5e6;
    fill: none;
    stroke: #0f8a4f;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Bouton ---------- */

.popup-button {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 54px;
    padding: 12px 22px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--pz-blue), var(--pz-blue-2));
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .04em;
    text-decoration: none;
    box-shadow: 0 14px 30px rgba(11, 95, 224, .35);
    transition: transform .25s, box-shadow .25s;
}
.popup-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(110deg, transparent, rgba(255, 255, 255, .45), transparent);
    transform: skewX(-20deg);
    animation: pz-shine 3.5s infinite;
}
@keyframes pz-shine { 0%, 60% { left: -80%; } 100% { left: 130%; } }

.popup-button:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(11, 95, 224, .45); }
.popup-arrow { font-size: 22px; line-height: 1; transition: transform .25s; }
.popup-button:hover .popup-arrow { transform: translateX(5px); }

/* ---------- Pied ---------- */

.popup-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.popup-no-show { position: relative; display: inline-flex; align-items: center; cursor: pointer; user-select: none; }
.popup-no-show input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.popup-checkbox {
    position: relative;
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    margin-right: 9px;
    border: 2px solid #b8c6dd;
    border-radius: 6px;
    background: #fff;
    transition: background .2s, border-color .2s;
}
.popup-no-show input:checked + .popup-checkbox { background: var(--pz-blue); border-color: var(--pz-blue); }
.popup-no-show input:checked + .popup-checkbox::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
}
.popup-no-show input:focus-visible + .popup-checkbox { outline: 3px solid rgba(11, 95, 224, .3); outline-offset: 2px; }

.popup-no-show-text { color: var(--pz-text); font-size: 13.5px; font-weight: 500; }

.popup-later {
    padding: 6px 4px;
    border: 0;
    background: none;
    color: var(--pz-text);
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.popup-later:hover { color: var(--pz-navy); }

/* ---------- Bouton X ---------- */

.popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f5fc;
    cursor: pointer;
    transition: transform .3s, background .3s;
}
.popup-close:hover { transform: rotate(90deg); background: #e2eafa; }
.popup-close span { position: absolute; width: 18px; height: 2.4px; border-radius: 2px; background: var(--pz-navy); }
.popup-close span:first-child { transform: rotate(45deg); }
.popup-close span:last-child { transform: rotate(-45deg); }

.popup-close:focus-visible,
.popup-button:focus-visible,
.popup-later:focus-visible { outline: 3px solid rgba(11, 95, 224, .35); outline-offset: 3px; }

/* =========================================================
   PC : écrans peu hauts (portables 768 px, zoom 125 %…)
   La fenêtre se resserre pour tenir en entier.
   ========================================================= */

@media (min-width: 801px) and (max-height: 760px) {
    .popup-content { padding: 24px 30px 18px; }
    .popup-badge { margin-bottom: 8px; }
    .popup-content h2 { font-size: 30px; margin-bottom: 6px; }
    .popup-subtitle { font-size: 15px; margin-bottom: 8px; }
    .popup-price { padding: 8px 12px; margin-bottom: 8px; }
    .popup-price strong { font-size: 25px; }
    .popup-deadline { padding: 7px 10px; margin-bottom: 10px; font-size: 13.5px; }
    .popup-list { gap: 5px; margin-bottom: 12px; }
    .popup-list li { font-size: 13.5px; }
    .popup-button { min-height: 48px; }
    .popup-foot { margin-top: 10px; }
}

@media (min-width: 801px) and (max-height: 620px) {
    .popup-list li:nth-child(-n+2) { display: none; }
    .popup-subtitle { display: none; }
}

/* =========================================================
   MOBILE : version courte, tout est visible du haut en bas
   ========================================================= */

@media (max-width: 800px) {
    .azorlearn-popup { padding: 12px; }

    .popup-container {
        width: min(440px, 100%);
        display: flex;
        flex-direction: column;
        border-radius: 22px;
    }

    .popup-image { min-height: 0; height: 128px; flex-shrink: 0; }
    .popup-image img { object-position: center 30%; }
    .popup-floating { display: none; }
    .popup-ribbon { top: 16px; left: -52px; font-size: 11.5px; padding: 6px 0; }

    .popup-content { padding: 18px 18px 16px; }
    .popup-badge { margin-bottom: 8px; padding: 5px 11px; font-size: 11px; }
    .popup-content h2 { padding-right: 0; font-size: 27px; margin-bottom: 6px; }
    .popup-subtitle { font-size: 14.5px; margin-bottom: 10px; }
    .popup-price { padding: 8px 12px; margin-bottom: 8px; gap: 2px 10px; }
    .popup-price del { font-size: 13.5px; }
    .popup-price strong { font-size: 24px; }
    .popup-price span { font-size: 10.5px; padding: 3px 8px; }
    .popup-deadline { padding: 7px 10px; margin-bottom: 10px; font-size: 13px; }

    /* Sur mobile : on garde seulement le cadeau (livre) */
    .popup-list { margin-bottom: 12px; }
    .popup-list li:nth-child(-n+2) { display: none; }
    .popup-list li { font-size: 13.5px; }

    .popup-button { min-height: 50px; font-size: 15px; }
    .popup-foot { margin-top: 10px; }
    .popup-no-show-text, .popup-later { font-size: 12.5px; }

    .popup-close { top: 10px; right: 10px; width: 38px; height: 38px; background: rgba(255, 255, 255, .95); box-shadow: 0 6px 16px rgba(0, 0, 0, .2); }
}

@media (max-width: 800px) and (max-height: 640px) {
    .popup-image { height: 90px; }
    .popup-subtitle { display: none; }
    .popup-list { display: none; }
}

@media (max-width: 360px) {
    .popup-content h2 { font-size: 24px; }
    .popup-foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
    .azorlearn-popup *, .azorlearn-popup { animation: none !important; transition: none !important; }
}
