/**
 * Newsletter UI Styles
 * Used by: shared/newsletter-ui.js (popup modal + bottom-right toaster).
 *
 * THEMING NOTES FOR DESIGNERS
 * ---------------------------
 * This stylesheet reuses CSS custom properties from the **onboarding** app so
 * the popup matches that visual system. Each rule references the variable
 * with a hardcoded fallback, e.g.:
 *
 *     background: var(--lnn-ob-primary, #ff8217);
 *
 * Two ways to change a color/value:
 *
 *   1. Edit the **variable** site-wide (in the onboarding app) — affects this
 *      popup AND the onboarding modal.
 *
 *   2. Edit ONLY this popup — replace the `var(...)` reference with a plain
 *      value, OR scope an override on the popup's container, e.g.:
 *
 *          .newsos-nl-overlay,
 *          .newsos-nl-toaster {
 *              --lnn-ob-primary: #ff8217;
 *          }
 *
 * Class naming:
 *   .newsos-nl-overlay     — full-screen popup backdrop
 *   .newsos-nl-modal       — popup card (split layout, like onboarding)
 *   .newsos-nl-toaster     — bottom-right slide-up card
 *   .newsos-nl-content     — left column inside the modal (text + form)
 *   .newsos-nl-hero        — right column inside the modal (image)
 *   .newsos-nl-input       — email/name text inputs
 *   .newsos-nl-option      — single newsletter list as a checkbox row
 *   .newsos-nl-btn         — primary CTA button
 *   .newsos-nl-skip        — text-style "No thanks" / "Done" link
 *   .newsos-nl-dots        — step indicator (one filled, one hollow per step)
 *   .newsos-nl-msg         — inline success/error feedback
 *   .newsos-nl-close-x     — top-right ✕ on the popup modal
 *   .newsos-nl-close-btn   — top-right ✕ on the toaster
 */

/* Newsletter Popup — uses onboarding CSS custom properties */
.newsos-nl-overlay {
    position: fixed; inset: 0; z-index: 100000;
    display: flex; align-items: center; justify-content: center;
    background: var(--lnn-ob-bg-overlay, rgba(0,0,0,0.65));
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}
.newsos-nl-overlay.show { opacity: 1; visibility: visible; }

/* Modal card — split layout like onboarding */
.newsos-nl-modal {
    position: relative;
    display: flex; width: 100%; max-width: 900px; max-height: 90vh;
    background: var(--lnn-ob-bg-modal, #151719);
    border-radius: var(--lnn-ob-radius, 12px); overflow: hidden;
    color: var(--lnn-ob-text, #f4f5f6);
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    transform: translateY(20px); transition: transform 0.3s ease;
}
.newsos-nl-overlay.show .newsos-nl-modal { transform: translateY(0); }

/* Left column: content */
.newsos-nl-content {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 3rem 2.5rem; text-align: center; overflow-y: auto;
    transition: opacity 0.4s ease;
}

/* Right column: hero image */
.newsos-nl-hero { flex: 1; min-height: 420px; overflow: hidden; }
.newsos-nl-hero img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Top-right close button (popup modal only) */
.newsos-nl-close-x {
    position: absolute; top: 12px; right: 12px;
    width: 32px; height: 32px; border: 0; padding: 0;
    background: rgba(255, 255, 255, 0.08);
    color: var(--lnn-ob-text, #f4f5f6);
    border-radius: 50%; cursor: pointer;
    font-size: 18px; line-height: 1; font-family: inherit;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    z-index: 2;
}
.newsos-nl-close-x:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05);
}
.newsos-nl-close-x:focus-visible {
    outline: 2px solid var(--lnn-ob-primary, #ff8217);
    outline-offset: 2px;
}

/* Logo */
.newsos-nl-logo { width: 280px; max-width: 100%; height: auto; margin-bottom: 1.5rem; }

/* Typography */
.newsos-nl-title {
    margin: 0 0 0.5rem; font-size: 1.5rem; font-weight: 700;
    color: var(--lnn-ob-text, #f4f5f6);
}
.newsos-nl-subtitle {
    margin: 0 0 1.5rem; font-size: 0.95rem;
    color: var(--lnn-ob-text-muted, #9ca3af); line-height: 1.5;
}

/* Inputs — dark themed */
.newsos-nl-input {
    display: block; width: 100%; max-width: 340px; padding: 12px 16px;
    background: var(--lnn-ob-option-bg, #2a2d31);
    border: 2px solid transparent; border-radius: var(--lnn-ob-radius-pill, 15px);
    color: var(--lnn-ob-text, #f4f5f6); font-size: 0.95rem;
    font-family: inherit; box-sizing: border-box; margin: 0 auto 10px;
    transition: border-color 0.2s ease;
}
.newsos-nl-input::placeholder { color: var(--lnn-ob-text-muted, #9ca3af); }
.newsos-nl-input:focus {
    border-color: var(--lnn-ob-primary, #ff8217); outline: none;
}

/* Name row */
.newsos-nl-name-row {
    display: flex; gap: 8px; width: 100%; max-width: 340px; margin: 0 auto 10px;
}
.newsos-nl-name-row .newsos-nl-input { flex: 1; margin: 0; }

/* Newsletter option buttons — onboarding checkbox style */
.newsos-nl-options {
    display: flex; flex-direction: column; gap: 8px;
    width: 100%; max-width: 340px; margin-bottom: 1.5rem;
}
.newsos-nl-option {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 12px 16px;
    background: var(--lnn-ob-option-bg, #2a2d31);
    border: 1px solid transparent;
    border-radius: var(--lnn-ob-radius-pill, 15px);
    color: var(--lnn-ob-text, #f4f5f6); font-size: 0.95rem;
    font-family: inherit; cursor: pointer; text-align: left;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.newsos-nl-option:hover { background: var(--lnn-ob-option-hover, #35393e); }
.newsos-nl-option.selected {
    background: var(--lnn-ob-option-sel, rgba(255,130,23,0.3));
    border-color: var(--lnn-ob-primary, #ff8217);
}

/* Checkbox indicator */
.newsos-nl-cb-indicator {
    flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px;
    border: 2px solid var(--lnn-ob-text-muted, #9ca3af);
    position: relative;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.newsos-nl-option.selected .newsos-nl-cb-indicator {
    border-color: var(--lnn-ob-primary, #ff8217);
    background: var(--lnn-ob-primary, #ff8217);
}
.newsos-nl-option.selected .newsos-nl-cb-indicator::after {
    content: ""; position: absolute; top: 3px; left: 6px;
    width: 6px; height: 10px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Buttons — onboarding primary style */
.newsos-nl-btn {
    width: 100%; max-width: 340px; padding: 14px 24px;
    background: var(--lnn-ob-primary, #ff8217); color: #fff;
    border: none; border-radius: var(--lnn-ob-radius-pill, 15px);
    font-size: 1rem; font-weight: 700; font-family: inherit;
    text-transform: uppercase; letter-spacing: 0.05em;
    cursor: pointer; transition: background 0.2s ease, opacity 0.2s ease;
    margin: 0 auto; display: block;
}
.newsos-nl-btn:hover { background: var(--lnn-ob-primary-hover, #e67300); }
.newsos-nl-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Subscribed badge on options */
.newsos-nl-badge {
    margin-left: auto; font-size: 0.75rem; font-weight: 600;
    padding: 2px 10px; border-radius: 12px;
    /* background: rgba(74,222,128,0.15);  */
    color: #4ade80;
    letter-spacing: 0.02em;
}

/* Section labels within the options list */
.newsos-nl-section-label {
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
    color: var(--lnn-ob-text-muted, #9ca3af); letter-spacing: 0.06em;
    margin: 0 0 4px; padding: 0 4px;
}
.newsos-nl-section-label:not(:first-child) { margin-top: 16px; }

/* Skip / close link */
.newsos-nl-skip {
    background: none; border: none;
    color: var(--lnn-ob-text-muted, #9ca3af);
    font-size: 0.85rem; font-family: inherit; cursor: pointer;
    margin-top: 0.75rem; padding: 6px 12px;
    text-decoration: underline; text-underline-offset: 3px;
}
.newsos-nl-skip:hover { color: var(--lnn-ob-text, #f4f5f6); }

/* Feedback messages */
.newsos-nl-msg {
    font-size: 0.85rem; margin-top: 12px; padding: 8px 16px;
    border-radius: var(--lnn-ob-radius-pill, 15px); text-align: center;
    max-width: 340px; margin-left: auto; margin-right: auto;
}
.newsos-nl-msg.success { background: rgba(22,163,74,0.2); color: #4ade80; }
.newsos-nl-msg.error   { background: rgba(220,38,38,0.2); color: #fca5a5; }

/* Step dots */
.newsos-nl-dots {
    display: flex; justify-content: center; gap: 8px; margin-top: 1.5rem;
}
.newsos-nl-dots .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--lnn-ob-border, rgba(255,255,255,0.12));
    transition: background 0.3s ease;
}
.newsos-nl-dots .dot.active { background: var(--lnn-ob-primary, #ff8217); }

/* Steps */
.newsos-nl-step { display: none; }
.newsos-nl-step.active {
    display: flex; flex-direction: column; align-items: center; width: 100%;
}

/* Toaster (bottom-right card) */
.newsos-nl-toaster {
    position: fixed; bottom: 20px; right: 20px; z-index: 99999;
    background: var(--lnn-ob-bg-modal, #151719);
    border-radius: var(--lnn-ob-radius, 12px);
    padding: 2rem 1.5rem; max-width: 380px; width: calc(100% - 40px);
    color: var(--lnn-ob-text, #f4f5f6);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transform: translateY(120%); transition: transform 0.35s ease;
}
.newsos-nl-toaster.show { transform: translateY(0); }
.newsos-nl-toaster .newsos-nl-hero { display: none; }
.newsos-nl-toaster .newsos-nl-logo { width: 180px; }

/* X close button — toaster only */
.newsos-nl-close-btn {
    position: absolute; top: 12px; right: 12px;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--lnn-ob-option-bg, #2a2d31);
    border: none; cursor: pointer;
    color: var(--lnn-ob-text-muted, #9ca3af);
    font-size: 1rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}
.newsos-nl-close-btn:hover {
    background: var(--lnn-ob-option-hover, #35393e);
    color: var(--lnn-ob-text, #f4f5f6);
}

/* Responsive */
@media (max-width: 680px) {
    .newsos-nl-modal { flex-direction: column; max-height: 95vh; }
    .newsos-nl-hero { min-height: 0; max-height: 180px; order: -1; }
    .newsos-nl-content { padding: 2rem 1.5rem; }
    .newsos-nl-logo { width: 200px; }
    .newsos-nl-title { font-size: 1.25rem; }
    .newsos-nl-toaster {
        bottom: 0; right: 0; width: 100%; max-width: 100%;
        border-radius: 12px 12px 0 0;
    }
}
