@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@600;700;800&family=Sofia+Sans:wght@400;500;600;700&display=swap');

:root {
    --xcopri-purple: #5B2C86;
    --xcopri-text: #333333;
    --xcopri-gray-bar: #D0D4DA;
    --xcopri-green: #61F3C9;
    --xcopri-blue: #479EF7;
    --xcopri-error: #c0201f;
    --xcopri-border: #cfcfcf;
}

* {
    box-sizing: border-box;
}

html, body {
    /* Prevent horizontal scroll on narrow mobile viewports */
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Sofia Sans', Arial, sans-serif;
    color: var(--xcopri-text);
    margin: 0;
    padding: 0;
    font-size: 16px;
    line-height: 1.5;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--xcopri-purple);
}

.hideElement {
    display: none;
}

/* ---------- Header ---------- */
.site-header {
    position: relative;
    width: 100%;
    border-top: 18px solid var(--xcopri-gray-bar);
    background: #ffffff;
    /* Clip the blurred watermark icon that bleeds off the right edge */
    overflow: hidden;
}

/* Blurred XCOPRI icon watermark on the right side of the header */
.header-icon-watermark {
    position: absolute;
    top: 50%;
    right: -20px;
    transform: translateY(-50%);
    height: 150%;
    width: auto;
    max-width: none;
    opacity: 0.28;
    filter: blur(0.5px);
    pointer-events: none;
    z-index: 0;
}

.header-inner {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 40px;
    gap: 60px;
}

.header-logo {
    flex: 0 0 auto;
}

.header-logo img {
    max-width: 260px;
    height: auto;
}

.header-offer {
    text-align: left;
    flex: 0 1 auto;
    padding-left: 0;
    /* Push the offer group toward the right of the header so the
       "$20 per month.*" sits over the watermark, matching the PDF */
    margin-right: 40px;
}

.header-title {
    font-family: 'Big Shoulders Display', Arial, sans-serif;
    color: var(--xcopri-purple);
    font-weight: 800;
    font-size: 40px;
    margin: 0 0 8px;
    letter-spacing: 0.5px;
    line-height: 1;
}

.header-offer-text {
    margin: 0;
    color: var(--xcopri-purple);
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 16px;
}

.offer-copy {
    font-weight: 600;
    font-size: 20px;
    max-width: 300px;
    line-height: 1.15;
}

.offer-amount {
    font-weight: 800;
    font-size: 52px;
    line-height: 1;
    white-space: nowrap;
}

.offer-per {
    font-weight: 600;
    font-size: 20px;
    white-space: nowrap;
}

.header-tc {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--xcopri-purple);
}

.header-tc .tc-link,
.header-tc .tc-link:hover,
.header-tc .tc-link:focus,
.header-tc .tc-link:active,
.header-tc .tc-link:visited {
    /* Always underlined and black to match the flats, no change on hover */
    color: #000;
    text-decoration: underline;
    text-decoration-color: #000;
    cursor: pointer;
}

.header-gradient {
    height: 6px;
    width: 100%;
    background: linear-gradient(90deg, var(--xcopri-green) 0%, var(--xcopri-blue) 100%);
}

/* ---------- Layout ---------- */
/* Match the header width/padding so content left-aligns under the logo */
.crx-wl-patientform .container,
.site-footer .container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 40px;
}

.mainWrapper {
    padding: 40px 0 20px;
}

.introTxtWrap h1 {
    color: var(--xcopri-purple);
    font-weight: 700;
    font-size: 24px;
    margin: 0 0 12px;
}

.introTxtWrap p {
    margin: 0 0 24px;
}

/* ---------- Eligibility ---------- */
.eligibilityBox {
    margin: 10px 0 24px;
}

.eligibilityBadge {
    display: inline-block;
    border: 1px solid var(--xcopri-purple);
    color: var(--xcopri-purple);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.quesWrap {
    margin-bottom: 22px;
}

.quesWrap > label {
    display: block;
    margin-bottom: 8px;
}

.radioWrap {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.radioChoice {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Ensure a comfortable tap target height */
    min-height: 44px;
}

.radioChoice input[type="radio"],
.radioChoice input[type="checkbox"] {
    accent-color: var(--xcopri-purple);
    width: 20px;
    height: 20px;
    margin: 0;
    flex: 0 0 auto;
    vertical-align: middle;
}

.radioChoice label {
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 20px;
}

.checkboxChoice {
    align-items: flex-start;
}

.checkboxChoice input[type="checkbox"] {
    margin-top: 4px;
    flex: 0 0 auto;
}

.checkboxChoice label {
    font-size: 14px;
    line-height: 1.5;
}

/* Error + ineligible messaging */
.errorMsg,
.ineligibleMsg {
    display: none;
    color: var(--xcopri-error);
    font-weight: 600;
    font-size: 13px;
    margin-top: 6px;
}

.quesWrap.error > .errorMsg,
.fieldWrap.error .errorMsg {
    display: block;
}

.quesWrap.error .radioWrap,
.fieldWrap.error .form-control {
    outline: none;
}

.quesWrap.ineligible > .ineligibleMsg {
    display: block;
}

.fieldWrap.error .form-control {
    border-color: var(--xcopri-error);
}

/* ---------- Form fields ---------- */
.fieldGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 40px;
    margin: 28px 0;
}

.fieldWrap label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    /* 16px font-size prevents iOS Safari zoom-on-focus; min 44px tap height */
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid var(--xcopri-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 16px;
    color: var(--xcopri-text);
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--xcopri-purple);
}

.smallField {
    max-width: 100%;
}

.fieldNote {
    font-style: italic;
    font-size: 12px;
    margin: 6px 0 0;
    color: #666;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%235B2C86' d='M6 8L0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ---------- Consents ---------- */
.consentGroup {
    margin-top: 24px;
}

.consentBody {
    margin: 8px 0 0 26px;
    font-size: 13px;
    color: #444;
}

.consentBody p {
    margin: 0 0 10px;
}

.consentWrap em {
    font-style: italic;
    font-weight: 600;
}

/* ---------- Submit ---------- */
.submitWrap {
    text-align: center;
    margin: 30px 0 10px;
}

.btn-submit {
    background: var(--xcopri-purple);
    color: #fff;
    border: none;
    border-radius: 4px;
    min-height: 44px;
    padding: 12px 44px;
    font-family: inherit;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.btn-submit:hover {
    background: #4a2270;
}

.btn-submit:disabled,
.btn-submit[disabled] {
    background: #b7a9c7;
    cursor: not-allowed;
    opacity: 0.7;
}

.tc-link {
    display: inline-block;
    padding: 2px 0;
    min-height: 24px;
}

/* T&C links underlined and black to match the flats (covers the acceptance-label link) */
.tc-link,
.tc-link:hover,
.tc-link:focus,
.tc-link:active,
.tc-link:visited {
    color: #000;
    text-decoration: underline;
    text-decoration-color: #000;
}
/* The acceptance link wraps its text in <strong>; keep that black + underlined too */
.tc-link strong {
    color: #000;
    text-decoration: underline;
}

/* ---------- Footer ---------- */
.site-footer {
    background: #fff;
    padding: 30px 0 40px;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

.footerWrap {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.footer-logo {
    max-width: 120px;
    height: auto;
}

.footerText p {
    margin: 0 0 4px;
    font-size: 12px;
    color: #555;
}

/* ---------- Modals ---------- */
.crx-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(80, 80, 80, 0.6);
    z-index: 1000;
    overflow-y: auto;
}

.crx-modal.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
}

body.modal-open {
    overflow: hidden;
}

.crx-modal-dialog {
    width: 100%;
    margin: auto;
}

.crx-modal-lg {
    max-width: 640px;
}

.crx-modal-sm {
    max-width: 480px;
}

.crx-modal-content {
    position: relative;
    background: #fff;
    border-radius: 4px;
    padding: 40px 40px 32px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.3);
}

.crx-modal-content.text-center {
    text-align: center;
}

.crx-modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 20px;
    font-weight: 700;
    color: var(--xcopri-text);
    cursor: pointer;
}

.tc-title {
    color: var(--xcopri-purple);
    font-weight: 700;
    font-size: 22px;
    margin: 0 0 16px;
}

.tc-list {
    padding-left: 18px;
    margin: 0;
}

.tc-list li {
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.4;
    /* Stronger, near-black text to match the PDF */
    color: #1a1a1a;
    font-weight: 500;
}

.modal-shield {
    max-width: 90px;
    margin: 0 auto 16px;
    display: block;
}

.modal-heading {
    color: var(--xcopri-purple);
    font-weight: 700;
    font-size: 26px;
    margin: 0 0 12px;
}

.modal-detail {
    margin: 6px 0;
}

.crx-modal-sm .btn-submit {
    margin-top: 20px;
}

/* ---------- Loader ---------- */
.crx-gray-out {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    z-index: 900;
}

.crx-loader {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    border: 5px solid var(--xcopri-gray-bar);
    border-top-color: var(--xcopri-purple);
    border-radius: 50%;
    z-index: 901;
    animation: crx-spin 0.8s linear infinite;
}

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

/* ---------- Responsive ---------- */

/* Tablet (<= 1024px): keep two-column form but tighten spacing */
@media (max-width: 1024px) {
    .header-inner,
    .crx-wl-patientform .container,
    .site-footer .container {
        padding-left: 24px;
        padding-right: 24px;
    }

    .header-inner {
        gap: 40px;
    }

    .header-logo img {
        max-width: 220px;
    }

    .header-title {
        font-size: 32px;
    }

    .offer-copy,
    .offer-per {
        font-size: 18px;
    }

    .offer-amount {
        font-size: 44px;
    }
}

/* Tablet portrait / large phone (<= 768px): stack header, single-column form */
@media (max-width: 768px) {
    /* Hide the decorative watermark when the header stacks so it doesn't overlap content */
    .header-icon-watermark {
        display: none;
    }

    .header-inner {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .header-offer {
        padding-left: 0;
        text-align: center;
    }

    .header-offer-text {
        justify-content: center;
        /* allow wrapping so the large $20 never forces horizontal scroll */
        flex-wrap: wrap;
    }

    .offer-copy {
        max-width: 100%;
    }

    .header-title {
        font-size: 26px;
    }

    .fieldGrid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .footerWrap {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .crx-modal-content {
        padding: 36px 22px 26px;
    }

    .btn-submit {
        width: 100%;
        padding: 14px 20px;
    }

    .cardActions .btn-submit {
        width: auto;
        min-width: 160px;
    }
}

/* Phones (<= 480px) */
@media (max-width: 480px) {
    .header-logo img {
        max-width: 180px;
    }

    .header-title {
        font-size: 22px;
    }

    .offer-copy,
    .offer-per {
        font-size: 16px;
    }

    .offer-amount {
        font-size: 34px;
    }

    .introTxtWrap h1 {
        font-size: 20px;
    }

    .radioWrap {
        gap: 16px;
    }

    .tc-list li,
    .checkboxChoice label,
    .consentBody {
        font-size: 13px;
    }
}

/* Small phones (<= 360px, e.g. 320px viewports) */
@media (max-width: 360px) {
    .header-inner,
    .crx-wl-patientform .container,
    .site-footer .container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .header-title {
        font-size: 20px;
    }

    .offer-amount {
        font-size: 30px;
    }

    .btn-submit {
        padding: 14px 16px;
        letter-spacing: 0;
    }

    .cardActions {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .cardActions .btn-submit {
        width: 100%;
    }
}
