﻿/* Custom Newsletter Popup - OptiMonster Replacement */

/* Overlay */
.custom-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    animation: fadeIn 0.3s ease-in-out;
}

.custom-popup-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Popup Container */
.custom-popup-container {
    position: relative;
    background: #ffffff;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease-out;
    padding: 50px 40px 40px;
}

/* Close Button */
.custom-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-popup-close:hover {
    color: #333;
}

/* Content */
.custom-popup-content {
    text-align: center;
}

.custom-popup-content h2 {
    font-size: 32px;
    line-height: 1.3;
    color: #333;
    margin: 0 0 20px 0;
    font-weight: 700;
}

.custom-popup-content h2 strong {
    text-decoration: underline;
}

.custom-popup-content p {
    font-size: 18px;
    line-height: 1.6;
    color: #555;
    margin: 0 0 30px 0;
}

/* Beehiiv Embed Styling */
.custom-popup-content .beehiiv-embed {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 300px;
}

/* Mobile pinned Beehiiv footer signup */
.custom-popup-footer-signup {
    display: none;
}

.custom-popup-footer-toggle,
.custom-popup-footer-close {
    font-family: inherit;
}

@media (max-width: 980px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden !important;
    }

    .custom-popup-footer-signup {
        display: block;
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        z-index: 2147483647 !important;
        background: #ffffff;
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.22);
    }

    body.custom-popup-footer-loaded .adthrive-footer,
    body.custom-popup-footer-loaded .adthrive-footer-message,
    body.custom-popup-footer-loaded .adthrive-sticky-outstream-mobile,
    body.custom-popup-footer-loaded .adthrive-sticky-outstream-mobile-left,
    body.custom-popup-footer-loaded .adthrive-sticky-outstream-mobile-top-left,
    body.custom-popup-footer-loaded [id^="AdThrive_Footer"],
    body.custom-popup-footer-loaded [id^="AdThrive_Video_StickyOutstream"],
    body:has(.custom-popup-footer-signup) .adthrive-footer,
    body:has(.custom-popup-footer-signup) .adthrive-footer-message,
    body:has(.custom-popup-footer-signup) .adthrive-sticky-outstream-mobile,
    body:has(.custom-popup-footer-signup) .adthrive-sticky-outstream-mobile-left,
    body:has(.custom-popup-footer-signup) .adthrive-sticky-outstream-mobile-top-left,
    body:has(.custom-popup-footer-signup) [id^="AdThrive_Footer"],
    body:has(.custom-popup-footer-signup) [id^="AdThrive_Video_StickyOutstream"] {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .custom-popup-footer-signup.is-open {
        top: 0;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .custom-popup-footer-toggle {
        position: relative;
        width: 100%;
        min-height: 58px;
        padding: 15px 48px 15px 18px;
        border: 0;
        background: #6D5B97;
        color: #ffffff;
        font-size: 17px;
        font-weight: 700;
        line-height: 1.25;
        text-align: left;
        cursor: pointer;
    }

    .custom-popup-footer-toggle:after {
        content: "+";
        position: absolute;
        right: 18px;
        bottom: 16px;
        font-size: 26px;
        line-height: 1;
        color: #ffffff;
    }

    .custom-popup-footer-signup.is-open .custom-popup-footer-toggle:after {
        content: "-";
    }

    .custom-popup-footer-panel {
        position: relative;
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        background: #ffffff;
        padding: 8px;
    }

    .custom-popup-footer-close {
        position: absolute;
        top: 6px;
        right: 8px;
        width: 36px;
        height: 36px;
        border: 0;
        background: transparent;
        color: #555555;
        font-size: 30px;
        line-height: 1;
        cursor: pointer;
        z-index: 1;
    }

    .custom-popup-footer-close:hover,
    .custom-popup-footer-close:focus {
        color: #222222;
    }

    .custom-popup-footer-form {
        overflow: hidden;
        padding-top: 18px;
        width: 100%;
        min-height: 320px;
    }

    .custom-popup-footer-embed {
        display: block;
        width: 430px !important;
        max-width: none !important;
        height: 650px;
        margin: 0;
        border: 0;
        border-radius: 0 !important;
        background-color: transparent;
        box-shadow: 0 0 #0000;
        transform: scale(var(--custom-popup-footer-scale, 1));
        transform-origin: top left;
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile Responsive */
@media (max-width: 980px) {
    #custom-popup-overlay {
        display: none !important;
    }

    .custom-popup-container {
        max-width: 95%;
        width: 95%;
        padding: 40px 25px 25px;
        max-height: 85vh;
    }

    .custom-popup-content h2 {
        font-size: 24px;
    }

    .custom-popup-content p {
        font-size: 16px;
    }

    .custom-popup-close {
        width: 35px;
        height: 35px;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .custom-popup-container {
        padding: 35px 20px 20px;
    }

    .custom-popup-content h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .custom-popup-content p {
        font-size: 14px;
        margin-bottom: 20px;
    }
}

/* Prevent body scroll when popup is open */
body.custom-popup-open {
    overflow: hidden;
}

/* API-backed signup, shared by the desktop popup and mobile footer. */
.sixm-newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 12px;
    box-sizing: border-box;
    text-align: left;
    font-family: inherit;
    color: #333;
}
.sixm-newsletter-form h2 { margin: 0; font-size: 28px; line-height: 1.25; text-align: center; }
.sixm-newsletter-form p { margin: 0; font-size: 17px; line-height: 1.5; text-align: center; }
.sixm-newsletter-form label { display: block; font-size: 16px; font-weight: 400; }
.sixm-newsletter-form input[type="email"],
.sixm-newsletter-form input[type="text"] {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin-top: 6px;
    padding: 12px 16px;
    border: 1px solid #777;
    border-radius: 10px;
    background: #fff;
    color: #111;
    font: inherit;
    font-size: 16px;
}
.sixm-newsletter-form .sixm-signup-consent { display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; }
.sixm-signup-consent input { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; }
.sixm-signup-consent a { text-decoration: underline; }
.sixm-newsletter-form button[type="submit"] { padding: 12px 20px; border: 0; border-radius: 10px; background: #a8277b; color: #fff; font: inherit; font-size: 20px; cursor: pointer; }
.sixm-newsletter-form button:disabled { opacity: 0.65; cursor: default; }
.sixm-newsletter-form :focus-visible { outline: 3px solid #6d5b97; outline-offset: 3px; }
.sixm-signup-status { font-size: 16px; line-height: 1.5; color: #17612b; }
.sixm-signup-status:empty { display: none; }
.sixm-signup-status.is-error { color: #a01616; }
@media (max-width: 980px) {
    .custom-popup-footer-panel { overflow-y: auto; }
    .custom-popup-footer-form .sixm-newsletter-form { padding: 20px 16px; }
    .sixm-newsletter-form h2 { font-size: 24px; }
    .sixm-newsletter-form p { font-size: 16px; }
}
