/**
 * Exit Popup for PrestaShop 9
 *
 * @author LordsWorld
 * @license AFL-3.0
 */

:root {
    --exitpopup-accent: #00b2e2;
    --exitpopup-accent-hover: #0099c7;
    --exitpopup-text: #232323;
    --exitpopup-muted: #6f6f6f;
    --exitpopup-border: #d6d6d6;
    --exitpopup-surface: #ffffff;
    --exitpopup-error: #b42318;
    --exitpopup-success: #157347;
    --exitpopup-warning: #9a6700;
}

/* Prevent background scrolling while the dialog is open. */
body.exit-popup-active {
    overflow: hidden !important;
    overscroll-behavior: none;
}

@supports (scrollbar-gutter: stable) {
    html {
        scrollbar-gutter: stable;
    }
}

/* Overlay */
#exit-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.72);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 180ms ease,
        visibility 0s linear 180ms;
}

#exit-popup-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

@supports ((-webkit-backdrop-filter: blur(3px)) or (backdrop-filter: blur(3px))) {
    #exit-popup-overlay {
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
    }
}

/* Modal */
#exit-popup-modal {
    position: relative;
    width: min(100%, 520px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 38px 34px 32px;
    box-sizing: border-box;
    border-radius: 10px;
    background: var(--exitpopup-surface);
    color: var(--exitpopup-text);
    text-align: center;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
    transform: translateY(18px) scale(0.985);
    opacity: 0;
    transition:
        transform 220ms ease,
        opacity 180ms ease;
    -webkit-overflow-scrolling: touch;
}

#exit-popup-overlay.active #exit-popup-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

#exit-popup-modal:focus {
    outline: none;
}

/* Close control */
.exit-popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #777777;
    font: inherit;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transition:
        color 150ms ease,
        background-color 150ms ease;
}

.exit-popup-close:hover {
    color: var(--exitpopup-text);
    background: #f2f2f2;
}

.exit-popup-close:focus-visible {
    outline: 3px solid rgba(0, 178, 226, 0.28);
    outline-offset: 2px;
}

/* Content */
#exit-popup-modal h2 {
    margin: 0 36px 12px;
    color: var(--exitpopup-text);
    font-size: clamp(1.45rem, 3vw, 1.8rem);
    font-weight: 700;
    line-height: 1.25;
}

.exit-popup-description {
    margin: 0 auto 22px;
    max-width: 430px;
    color: var(--exitpopup-muted);
    font-size: 1rem;
    line-height: 1.55;
}

.exit-popup-description p {
    margin: 0 0 10px;
}

.exit-popup-description p:last-child {
    margin-bottom: 0;
}

/* Form */
#exit-popup-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    margin: 0;
}

#exit-popup-form[hidden] {
    display: none !important;
}

.exit-popup-field {
    width: 100%;
    text-align: left;
}

.exit-popup-label {
    display: block;
    margin-bottom: 6px;
    color: var(--exitpopup-text);
    font-size: 0.92rem;
    font-weight: 600;
}

#exit-popup-email {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    box-sizing: border-box;
    border: 1px solid var(--exitpopup-border);
    border-radius: 6px;
    background: #ffffff;
    color: var(--exitpopup-text);
    font: inherit;
    font-size: 1rem;
    line-height: 1.35;
    transition:
        border-color 150ms ease,
        box-shadow 150ms ease,
        background-color 150ms ease;
}

#exit-popup-email:hover {
    border-color: #b8b8b8;
}

#exit-popup-email:focus {
    border-color: var(--exitpopup-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 178, 226, 0.2);
}

#exit-popup-email[readonly] {
    background: #f5f5f5;
    color: #666666;
    cursor: default;
}

#exit-popup-email[aria-invalid="true"] {
    border-color: var(--exitpopup-error);
    box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.13);
}

#exit-popup-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 22px;
    box-sizing: border-box;
    border: 0;
    border-radius: 6px;
    background: var(--exitpopup-accent);
    color: #ffffff;
    font: inherit;
    font-size: 1.03rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition:
        background-color 150ms ease,
        transform 100ms ease,
        opacity 150ms ease;
}

#exit-popup-submit:hover:not(:disabled) {
    background: var(--exitpopup-accent-hover);
}

#exit-popup-submit:active:not(:disabled) {
    transform: translateY(1px);
}

#exit-popup-submit:focus-visible {
    outline: 3px solid rgba(0, 178, 226, 0.3);
    outline-offset: 3px;
}

#exit-popup-submit:disabled {
    cursor: wait;
    opacity: 0.62;
}

/* Consent */
.exit-popup-consent {
    margin: 2px 0 0;
    color: var(--exitpopup-muted);
    font-size: 0.78rem;
    line-height: 1.45;
    text-align: left;
}

.exit-popup-consent p {
    margin: 0;
}

.exit-popup-consent a {
    color: inherit;
    text-decoration: underline;
}

.exit-popup-consent a:hover {
    color: var(--exitpopup-text);
}

/* Response output */
#exit-popup-message {
    min-height: 0;
    margin-top: 18px;
    color: var(--exitpopup-text);
    font-size: 1rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#exit-popup-message:empty {
    display: none;
}

#exit-popup-message[data-status="success"],
#exit-popup-message.exit-popup-message-success {
    color: var(--exitpopup-success);
}

#exit-popup-message[data-status="already_claimed"],
#exit-popup-message[data-status="already_subscribed"],
#exit-popup-message.exit-popup-message-warning {
    color: var(--exitpopup-warning);
}

#exit-popup-message[data-status="error"],
#exit-popup-message[data-status="ineligible"],
#exit-popup-message.exit-popup-message-error {
    color: var(--exitpopup-error);
}

#exit-popup-message strong {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 8px auto 2px;
    padding: 6px 10px;
    border: 1px dashed currentColor;
    border-radius: 4px;
    font-size: 1rem;
    letter-spacing: 0.06em;
    overflow-wrap: anywhere;
    user-select: all;
}

#exit-popup-message small {
    display: block;
    margin-top: 6px;
    color: var(--exitpopup-muted);
    font-size: 0.8rem;
    font-weight: 400;
}

/* Eligibility disclosure */
.exit-popup-eligibility {
    width: 100%;
    margin: 18px 0 0;
    color: var(--exitpopup-muted);
    font-size: 0.78rem;
    line-height: 1.5;
    text-align: left;
}

.exit-popup-conditions-disclosure {
    width: 100%;
    margin: 0;
}

.exit-popup-conditions-summary {
    display: inline-block;
    padding: 0;
    color: var(--exitpopup-muted);
    font: inherit;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    cursor: pointer;
    list-style-position: inside;
}

.exit-popup-conditions-summary:hover {
    color: var(--exitpopup-text);
}

.exit-popup-conditions-summary:focus-visible {
    border-radius: 3px;
    outline: 3px solid rgba(0, 178, 226, 0.28);
    outline-offset: 3px;
}

.exit-popup-conditions-summary::marker {
    color: var(--exitpopup-muted);
}

.exit-popup-conditions-disclosure[open] .exit-popup-conditions-summary {
    color: var(--exitpopup-text);
}

.exit-popup-conditions {
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid var(--exitpopup-border);
    border-radius: 6px;
    background: #f7f9fa;
    color: var(--exitpopup-text);
    font-size: 0.78rem;
    line-height: 1.5;
}

.exit-popup-conditions p {
    margin: 0 0 8px;
    font-weight: 600;
}

.exit-popup-conditions ul {
    margin: 0;
    padding-left: 18px;
}

.exit-popup-conditions li {
    margin: 0;
}

.exit-popup-conditions li + li {
    margin-top: 6px;
}

/* Tablet and mobile */
@media (max-width: 600px) {
    #exit-popup-overlay {
        align-items: flex-end;
        padding: 12px;
    }

    #exit-popup-modal {
        width: 100%;
        max-height: calc(100vh - 24px);
        padding: 34px 20px 24px;
        border-radius: 12px;
    }

    #exit-popup-modal h2 {
        margin-right: 30px;
        margin-left: 30px;
    }

    .exit-popup-description {
        margin-bottom: 18px;
    }
}

@media (max-width: 380px) {
    #exit-popup-overlay {
        padding: 8px;
    }

    #exit-popup-modal {
        max-height: calc(100vh - 16px);
        padding-right: 16px;
        padding-left: 16px;
    }
}

/* High-contrast support */
@media (forced-colors: active) {
    #exit-popup-modal,
    #exit-popup-email,
    #exit-popup-submit,
    .exit-popup-close,
    .exit-popup-conditions {
        border: 1px solid CanvasText;
    }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
    #exit-popup-overlay,
    #exit-popup-modal,
    #exit-popup-email,
    #exit-popup-submit,
    .exit-popup-close {
        transition: none !important;
    }
}