/* ── Overlay ──────────────────────────────────────────────────────────────── */

#lr-exit-survey-overlay {
    display: none;          /* Hidden by default — never relies on [hidden] attr */
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;   /* Never block clicks while invisible                */
    transition: opacity 0.25s ease;
}

/* Step 1: switch to flex (still invisible) so the popup can begin its transition */
#lr-exit-survey-overlay.lr-active {
    display: flex;
}

/* Step 2: fade in and restore pointer events */
#lr-exit-survey-overlay.lr-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Popup card ───────────────────────────────────────────────────────────── */

#lr-exit-survey-popup {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    padding: 36px 40px 32px;
    max-width: 480px;
    width: 100%;
    position: relative;
    transform: translateY(24px);
    transition: transform 0.25s ease;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

#lr-exit-survey-overlay.lr-visible #lr-exit-survey-popup {
    transform: translateY(0);
}

/* ── Close × button ───────────────────────────────────────────────────────── */

#lr-exit-survey-close-x {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s;
}

#lr-exit-survey-close-x:hover,
#lr-exit-survey-close-x:focus {
    color: #333;
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ── Headings & text ──────────────────────────────────────────────────────── */

#lr-exit-survey-popup h2 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

#lr-exit-survey-form-wrap > p,
#lr-exit-survey-thanks > p {
    margin: 0 0 20px;
    font-size: 15px;
    color: #555;
}

/* ── Fieldset ─────────────────────────────────────────────────────────────── */

#lr-exit-survey-form fieldset {
    border: none;
    margin: 0 0 16px;
    padding: 0;
}

/* ── Checkbox labels ──────────────────────────────────────────────────────── */

.lr-checkbox-label {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    color: #222;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.4;
    border: 2px solid #d0d5dd;
    background: #fff;
    user-select: none;
}

.lr-checkbox-label:hover {
    border-color: #0073aa;
    background: #f0f7fb;
}

/* Hide the native checkbox — replaced by the custom ::before box */
.lr-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Custom checkbox box */
.lr-checkbox-label::before {
    content: '';
    flex-shrink: 0;
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2.5px solid #aab0bb;
    background: #fff;
    transition: background 0.15s, border-color 0.15s;
    box-sizing: border-box;
}

.lr-checkbox-label:hover::before {
    border-color: #0073aa;
}

/* Checked: filled blue box with SVG tick */
.lr-checkbox-label:has(input:checked)::before {
    background-color: #0073aa;
    border-color: #0073aa;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8l3.5 3.5L13 4.5' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px 14px;
}

/* Checked row highlight */
.lr-checkbox-label:has(input:checked) {
    border-color: #0073aa;
    background: #e8f3fa;
    color: #004f7a;
}

/* ── "Other" textarea ─────────────────────────────────────────────────────── */

#lr-other-wrap {
    display: none;
    padding: 4px 12px 12px 40px;
}

#lr-other-wrap.lr-visible {
    display: block;
}

#lr-other-text {
    width: 100%;
    border: 1.5px solid #ccc;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.15s;
    min-height: 80px;
}

#lr-other-text:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.12);
}

/* ── "Call me back" phone field ──────────────────────────────────────────────────── */

#lr-phone-wrap {
    display: none;
    padding: 4px 12px 12px 40px;
}

#lr-phone-wrap.lr-visible {
    display: block;
}

#lr-phone-text {
    width: 100%;
    border: 1.5px solid #ccc;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

#lr-phone-text:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.12);
}

/* ── Error message ────────────────────────────────────────────────────────── */

#lr-survey-error {
    display: none;
    color: #cc0000;
    font-size: 13px;
    margin: 0 0 12px;
    padding: 8px 12px;
    background: #fff5f5;
    border-radius: 6px;
    border-left: 3px solid #cc0000;
}

#lr-survey-error.lr-visible {
    display: block;
}

/* ── Submit button ────────────────────────────────────────────────────────── */

#lr-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s, transform 0.1s;
}

#lr-submit-btn:hover:not(:disabled) {
    background: #005f8d;
}

#lr-submit-btn:active:not(:disabled) {
    transform: scale(0.98);
}

#lr-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */

#lr-submit-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lr-spin 0.7s linear infinite;
}

#lr-submit-spinner.lr-visible {
    display: inline-block;
}

@keyframes lr-spin {
    to { transform: rotate(360deg); }
}

/* ── Thank-you state ──────────────────────────────────────────────────────── */

#lr-exit-survey-thanks {
    display: none;
    text-align: center;
    padding: 12px 0 4px;
}

#lr-exit-survey-thanks.lr-visible {
    display: block;
}

.lr-thanks-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e6f4ea;
    color: #2e7d32;
    font-size: 26px;
    margin: 0 auto 16px;
}

#lr-exit-survey-thanks h2 {
    margin-bottom: 8px;
}

#lr-exit-survey-close-thanks {
    display: inline-block;
    margin-top: 20px;
    background: none;
    border: 1.5px solid #ccc;
    border-radius: 8px;
    padding: 10px 28px;
    font-size: 15px;
    font-family: inherit;
    color: #555;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

#lr-exit-survey-close-thanks:hover {
    border-color: #0073aa;
    color: #0073aa;
}

/* ── Screen-reader only utility ───────────────────────────────────────────── */

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media ( max-width: 520px ) {
    #lr-exit-survey-popup {
        padding: 28px 20px 24px;
    }

    #lr-exit-survey-popup h2 {
        font-size: 18px;
    }

    .lr-checkbox-label {
        font-size: 14px;
    }
}
