/**
 * Newsletter Popup Overlay
 * Figma: 441:8985 — Form (890x490)
 * Dark overlay + centered white card with HubSpot form
 */

/* Overlay — full screen, dark bg */
.newsletter-popup {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.newsletter-popup.is-open {
    opacity: 1;
    visibility: visible;
}

.newsletter-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

/* Card — Figma: 890x490, pad 48/40, radius 16, border #E6E3EB, gap 24 */
.newsletter-popup__card {
    position: relative;
    width: 890px;
    max-width: calc(100vw - 40px);
    padding: 48px 40px;
    border-radius: 16px;
    background: #FFFFFF;
    border: 1px solid #E6E3EB;
    display: flex;
    flex-direction: column;
    gap: 24px;
    transform: translateY(20px);
    transition: transform 0.25s ease;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.newsletter-popup.is-open .newsletter-popup__card {
    transform: translateY(0);
}

/* Close button — top-right, 32px hit area */
.newsletter-popup__close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    transition: background 0.15s ease;
}

.newsletter-popup__close:hover {
    background: #F5F5F6;
}

.newsletter-popup__close svg {
    display: block;
}

/* Title — Figma: 28/600/120%, #1D004B, centered */
.newsletter-popup__title {
    font-family: "Funnel Sans", sans-serif;
    font-size: 28px;
    font-weight: 600;
    line-height: 120%;
    text-align: center;
    color: #1D004B;
    margin: 0;
}

/* Form container */
.newsletter-popup__form {
    width: 100%;
}

/* ===== HubSpot Form Overrides ===== */
/* Reuse contact page patterns, scoped to popup */

.newsletter-popup__form .hs-form,
.newsletter-popup__form .hbspt-form form {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.newsletter-popup__form .hs-form-field {
    margin-bottom: 22px !important;
}

/* Labels — 16px/600, #4E4C56 */
.newsletter-popup__form .hs-form-field > label {
    font-family: "Funnel Sans", sans-serif !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 18px !important;
    color: #4E4C56 !important;
    margin-bottom: 8px !important;
    display: block !important;
}

.newsletter-popup__form .hs-form-field label .hs-form-required {
    color: #7336E3 !important;
}

/* Input fields — h 56px, pad 16, radius 8, border #AAA5BA */
.newsletter-popup__form .hs-input,
.newsletter-popup__form input[type="text"],
.newsletter-popup__form input[type="email"],
.newsletter-popup__form input[type="tel"],
.newsletter-popup__form input[type="number"],
.newsletter-popup__form input[type="url"],
.newsletter-popup__form select {
    width: 100% !important;
    height: 56px !important;
    padding: 16px !important;
    border-radius: 8px !important;
    border: 1px solid #AAA5BA !important;
    background: #FFFFFF !important;
    font-family: "Funnel Sans", sans-serif !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 150% !important;
    color: #1D004B !important;
    outline: none !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    transition: border-color 0.15s ease !important;
}

/* Placeholder — #7C7B81 */
.newsletter-popup__form input::placeholder,
.newsletter-popup__form textarea::placeholder,
.newsletter-popup__form select::placeholder {
    color: #7C7B81 !important;
    opacity: 1 !important;
    font-weight: 400 !important;
}

/* Focus — purple border */
.newsletter-popup__form .hs-input:focus,
.newsletter-popup__form input:focus,
.newsletter-popup__form select:focus,
.newsletter-popup__form textarea:focus {
    border-color: #7336E3 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Select dropdown arrow */
.newsletter-popup__form select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%234E4C56' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 16px center !important;
    padding-right: 40px !important;
}

/* Textarea */
.newsletter-popup__form textarea,
.newsletter-popup__form textarea.hs-input {
    width: 100% !important;
    height: auto !important;
    min-height: 80px !important;
    padding: 16px !important;
    border-radius: 8px !important;
    border: 1px solid #AAA5BA !important;
    background: #FFFFFF !important;
    font-family: "Funnel Sans", sans-serif !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 150% !important;
    color: #1D004B !important;
    resize: vertical !important;
    outline: none !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
}

/* Two-column rows — flex-row, gap 24px (Figma) */
.newsletter-popup__form fieldset {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.newsletter-popup__form fieldset.form-columns-1 .hs-form-field,
.newsletter-popup__form fieldset.form-columns-1 .input {
    margin-right: 0 !important;
}

.newsletter-popup__form fieldset.form-columns-2 {
    display: flex !important;
    gap: 24px !important;
}

.newsletter-popup__form fieldset.form-columns-2 .hs-form-field {
    flex: 1 !important;
    float: none !important;
    width: auto !important;
}

.newsletter-popup__form .input {
    margin-right: 0 !important;
}

/* Privacy / legal text — 12px/400/140%, #4E4C56 */
.newsletter-popup__form .legal-consent-container,
.newsletter-popup__form .hs-richtext {
    font-family: "Funnel Sans", sans-serif !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    line-height: 140% !important;
    color: #4E4C56 !important;
    margin-bottom: 20px !important;
}

.newsletter-popup__form .legal-consent-container a {
    color: #7336E3 !important;
    text-decoration: underline !important;
}

/* Checkbox overrides */
.newsletter-popup__form .hs-form-booleancheckbox-display {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
}

.newsletter-popup__form .hs-form-booleancheckbox-display input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    margin: 2px 0 0 0 !important;
    accent-color: #7336E3 !important;
}

.newsletter-popup__form .hs-form-booleancheckbox-display span {
    font-family: "Funnel Sans", sans-serif !important;
    font-size: 12px !important;
    line-height: 140% !important;
    color: #4E4C56 !important;
}

/* Submit button — full width, pad 12/56, radius 4, bg #7336E3 */
.newsletter-popup__form .hs-submit {
    margin-top: 24px !important;
}

.newsletter-popup__form .hs-submit .actions {
    margin: 0 !important;
    padding: 0 !important;
}

.newsletter-popup__form .hs-button,
.newsletter-popup__form input[type="submit"] {
    width: 100% !important;
    padding: 12px 56px !important;
    border-radius: 4px !important;
    background: #7336E3 !important;
    color: #FFFFFF !important;
    font-family: "Funnel Sans", sans-serif !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 140% !important;
    border: none !important;
    cursor: pointer !important;
    transition: background 0.15s ease !important;
    -webkit-appearance: none !important;
}

.newsletter-popup__form .hs-button:hover,
.newsletter-popup__form input[type="submit"]:hover {
    background: #5f28c4 !important;
}

/* Error messages */
.newsletter-popup__form .hs-error-msgs {
    font-family: "Funnel Sans", sans-serif !important;
    font-size: 12px !important;
    color: #e74c3c !important;
    margin-top: 4px !important;
    list-style: none !important;
    padding: 0 !important;
}

.newsletter-popup__form .hs-error-msgs li label {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: #e74c3c !important;
}

/* iframe fallback — when HubSpot renders inside iframe */
.newsletter-popup__form iframe {
    width: 100% !important;
    min-height: 400px;
    border: none !important;
}

/* Hide HubSpot branding */
.newsletter-popup__form .hbspt-form .hs-form__virality-link {
    display: none !important;
}

/* Body scroll lock when popup open */
body.newsletter-popup-open {
    overflow: hidden;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .newsletter-popup__card {
        padding: 32px 20px;
        border-radius: 12px;
    }

    .newsletter-popup__title {
        font-size: 22px;
        padding-right: 24px;
    }

    .newsletter-popup__close {
        top: 16px;
        right: 16px;
    }

    .newsletter-popup__form fieldset.form-columns-2 {
        flex-direction: column !important;
        gap: 0 !important;
    }

    .newsletter-popup__form .hs-input,
    .newsletter-popup__form input[type="text"],
    .newsletter-popup__form input[type="email"],
    .newsletter-popup__form input[type="tel"],
    .newsletter-popup__form select {
        height: 48px !important;
        font-size: 15px !important;
    }

    .newsletter-popup__form .hs-button,
    .newsletter-popup__form input[type="submit"] {
        padding: 14px 20px !important;
        font-size: 16px !important;
    }
}
