/*
 * PostalAnnex simplified stamp form — beta4.
 * Gravity Forms and Avada control all field widths, columns, spacing, upload
 * fields, and responsive layout. These rules are intentionally limited to the
 * custom product selectors, B/I/U buttons, alignment buttons, and preview.
 */

/* Gravity Forms normally removes its temporary inline display:none after its
 * post-render lifecycle completes. On this Avada page the full form markup can
 * be present while that reveal step does not complete. Scope the recovery only
 * to the custom stamp form wrapper; field/page conditional logic is untouched. */
.gform_wrapper.mpa-stamp-v3-form_wrapper {
    display: block !important;
}

/* The combined product field remains the server-submitted internal value.
 * Model and Color are now real Gravity Forms fields arranged with the layout builder. */
.mpa-stamp-v3-form .mpa-stamp-v3-product {
    display: none !important;
}

/* Compact B / I / U buttons only. No field placement or width rules. */
.mpa-stamp-v3-form [class*="mpa-stamp-v3-style-"] .gfield_checkbox {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.mpa-stamp-v3-form [class*="mpa-stamp-v3-style-"] .gchoice {
    margin: 0;
}
.mpa-stamp-v3-form [class*="mpa-stamp-v3-style-"] input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.mpa-stamp-v3-form [class*="mpa-stamp-v3-style-"] label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    margin: 0;
    padding: .4rem .65rem;
    border: 1px solid currentColor;
    border-radius: 5px;
    font-weight: 700;
    cursor: pointer;
}
.mpa-stamp-v3-form [class*="mpa-stamp-v3-style-"] input:checked + label {
    border-color: #2457e6;
    background: #2457e6;
    color: #fff;
}
.mpa-stamp-v3-form [class*="mpa-stamp-v3-style-"] input[value="italic"] + label {
    font-style: italic;
}
.mpa-stamp-v3-form [class*="mpa-stamp-v3-style-"] input[value="underline"] + label {
    text-decoration: underline;
}

/* Alignment buttons only. Gravity Forms controls the field's placement. */
.mpa-stamp-v3-form .mpa-stamp-v3-alignment .gfield_radio {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.mpa-stamp-v3-form .mpa-stamp-v3-alignment .gchoice {
    margin: 0;
}
.mpa-stamp-v3-form .mpa-stamp-v3-alignment input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.mpa-stamp-v3-form .mpa-stamp-v3-alignment label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5rem;
    margin: 0;
    padding: .5rem .8rem;
    border: 1px solid currentColor;
    border-radius: 5px;
    cursor: pointer;
}
.mpa-stamp-v3-form .mpa-stamp-v3-alignment input:checked + label {
    border-color: #2457e6;
    background: #2457e6;
    color: #fff;
}

/* Alignment icons only. Gravity Forms remains responsible for the three-column
 * choice layout, widths, gaps, and responsive behavior. */
.mpa-stamp-v3-form .mpa-stamp-v3-alignment label::before {
    content: "";
    display: inline-block;
    width: 1.15rem;
    height: .85rem;
    flex: 0 0 1.15rem;
    margin-right: .45rem;
    background-repeat: no-repeat;
}
.mpa-stamp-v3-form .mpa-stamp-v3-alignment input[value="left"] + label::before {
    background-image:
        linear-gradient(currentColor, currentColor),
        linear-gradient(currentColor, currentColor),
        linear-gradient(currentColor, currentColor);
    background-size: 100% 2px, 68% 2px, 86% 2px;
    background-position: left top, left center, left bottom;
}
.mpa-stamp-v3-form .mpa-stamp-v3-alignment input[value="center"] + label::before {
    background-image:
        linear-gradient(currentColor, currentColor),
        linear-gradient(currentColor, currentColor),
        linear-gradient(currentColor, currentColor);
    background-size: 100% 2px, 68% 2px, 86% 2px;
    background-position: center top, center center, center bottom;
}
.mpa-stamp-v3-form .mpa-stamp-v3-alignment input[value="right"] + label::before {
    background-image:
        linear-gradient(currentColor, currentColor),
        linear-gradient(currentColor, currentColor),
        linear-gradient(currentColor, currentColor);
    background-size: 100% 2px, 68% 2px, 86% 2px;
    background-position: right top, right center, right bottom;
}

/* Live preview. Place an Avada element with CSS ID: mpa-stamp-preview-target.
 * The Avada element itself is intentionally untouched so its column width,
 * flex/grid behavior, and responsive placement remain under Avada control. */
.mpa-stamp-v3-preview-mount {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-width: 0;
    flex: 0 0 100%;
    align-self: stretch;
    position: sticky;
    top: 2rem;
}
.mpa-stamp-v3-preview-card {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: .85rem;
    border: 1px solid #d8e2ee;
    border-radius: 10px;
    background: #f3f7fb;
    box-shadow: 0 4px 16px rgba(23, 43, 77, .07);
}
.mpa-stamp-v3-preview-heading {
    display: block;
    width: 100%;
    margin: 0 0 .85rem;
    font-size: clamp(1.25rem, 2vw, 1.8rem);
    line-height: 1.15;
    white-space: nowrap;
}
.mpa-stamp-v3-preview-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 10rem;
    box-sizing: border-box;
    padding: .85rem;
    overflow: hidden;
    border: 1px solid #e1e7ef;
    border-radius: 8px;
    background: #eaf1f8;
}
.mpa-stamp-v3-preview-box {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    justify-content: center;
    gap: .2rem;
    width: min(var(--mpa-stamp-preview-natural-width, 380px), 100%);
    max-width: 100%;
    box-sizing: border-box;
    padding: clamp(.55rem, 3%, 1.25rem);
    overflow: hidden;
    border: 2px solid #111;
    background: #fff;
    font-size: clamp(12px, 2vw, 28px);
    line-height: 1.08;
}
.mpa-stamp-v3-preview-line {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1.06;
    transition: font-size .12s ease-out;
}
.mpa-stamp-v3-preview-line-too-long {
    text-decoration-color: currentColor;
}
.mpa-stamp-v3-preview-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.mpa-stamp-v3-preview-empty,
.mpa-stamp-v3-upload-placeholder {
    display: flex;
    min-height: 10rem;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.mpa-stamp-v3-preview-meta {
    display: block;
    width: 100%;
    margin-top: .9rem;
}
.mpa-stamp-v3-preview-meta p {
    margin: 0;
}
.mpa-stamp-v3-preview-size {
    padding: .7rem .8rem;
    border-radius: 6px;
    background: #fff;
    line-height: 1.45;
}
.mpa-stamp-v3-preview-disclaimer {
    margin-top: .65rem !important;
    color: #536273;
    font-size: .9em;
    line-height: 1.45;
}
.mpa-stamp-v3-preview-card > .description {
    margin: .7rem 0 0;
}


/* Free shipping-address consistency check. This card does not alter Gravity
 * Forms' address grid and appears only inside the Shipping Address field.
 * Beta8.17 is presentation-only: no validation or address data behavior changes. */
.mpa-stamp-v3-address-check {
    box-sizing: border-box;
    width: 100%;
    margin-top: 1rem;
    padding: 18px 20px;
    border: 1px solid #d9e2ec;
    border-left: 4px solid #73859a;
    border-radius: 10px;
    background: #f8fafc;
    color: #26384a;
    font-size: 15px;
    line-height: 1.45;
    box-shadow: 0 4px 14px rgba(26, 45, 66, .06);
}
.mpa-stamp-v3-address-check:empty {
    display: none;
}
.mpa-stamp-v3-address-check.is-success {
    border-color: #b9dec8;
    border-left-color: #278653;
    background: #f2fbf5;
    color: #214f36;
}
.mpa-stamp-v3-address-check.is-warning {
    border-color: #ead9a2;
    border-left-color: #c98000;
    background: #fff9eb;
    color: #2f2f2f;
}
.mpa-stamp-v3-address-check.is-error {
    border-color: #efc5c1;
    border-left-color: #c7372f;
    background: #fff4f3;
    color: #652820;
}
.mpa-stamp-v3-address-check.is-checking {
    border-color: #cbd8fa;
    border-left-color: #2b5ce6;
    background: #f4f7ff;
    color: #263f78;
}
.mpa-stamp-v3-address-check-title {
    display: block;
    margin: 0 0 7px;
    color: inherit;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}
.mpa-stamp-v3-address-check.is-warning .mpa-stamp-v3-address-check-title {
    color: #714c00;
}
.mpa-stamp-v3-address-check p {
    margin: 0;
    color: inherit;
    font-size: 15px;
    line-height: 1.45;
}
.mpa-stamp-v3-address-check-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 16px 0 0;
}
.mpa-stamp-v3-address-check-actions .button {
    box-sizing: border-box;
    width: auto !important;
    min-width: 0;
    min-height: 42px;
    margin: 0 !important;
    padding: 9px 16px !important;
    border-radius: 7px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    text-align: center;
    white-space: normal;
    box-shadow: none !important;
}
.mpa-stamp-v3-address-check-actions .mpa-stamp-v3-use-address {
    border: 1px solid #2f55e7 !important;
    background: #2f55e7 !important;
    color: #fff !important;
}
.mpa-stamp-v3-address-check-actions .mpa-stamp-v3-use-address:hover,
.mpa-stamp-v3-address-check-actions .mpa-stamp-v3-use-address:focus-visible {
    border-color: #1f43c9 !important;
    background: #1f43c9 !important;
    color: #fff !important;
}
.mpa-stamp-v3-address-check-actions .mpa-stamp-v3-keep-address {
    border: 1px solid #aebdf2 !important;
    background: #fff !important;
    color: #2347c9 !important;
}
.mpa-stamp-v3-address-check-actions .mpa-stamp-v3-keep-address:hover,
.mpa-stamp-v3-address-check-actions .mpa-stamp-v3-keep-address:focus-visible {
    border-color: #2f55e7 !important;
    background: #f3f6ff !important;
    color: #1739b4 !important;
}
.mpa-stamp-v3-address-check-actions .button:focus-visible {
    outline: 3px solid rgba(47, 85, 231, .22);
    outline-offset: 2px;
}
.mpa-stamp-v3-address-check-disclaimer {
    margin: 15px 0 0 !important;
    padding: 12px 0 0;
    border-top: 1px solid rgba(38, 56, 74, .13);
    color: #626d78 !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    opacity: 1;
}

@media (max-width: 600px) {
    .mpa-stamp-v3-address-check {
        padding: 15px 16px;
    }
    .mpa-stamp-v3-address-check-title {
        font-size: 17px;
    }
    .mpa-stamp-v3-address-check-actions {
        align-items: stretch;
    }
    .mpa-stamp-v3-address-check-actions .button {
        flex: 1 1 100%;
        width: 100% !important;
    }
}

@media (max-width: 767px) {
    .mpa-stamp-v3-preview-mount {
        position: static;
    }
    .mpa-stamp-v3-preview-card {
        padding: .8rem;
    }
    .mpa-stamp-v3-preview-stage {
        padding: .8rem;
    }
}

/* Progressive line controls only. Gravity Forms continues to control all line,
 * font, style, upload, and page layouts. */
.mpa-stamp-v3-form .mpa-stamp-v3-line-controls {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
    margin-top: .15rem;
}
.mpa-stamp-v3-form .mpa-stamp-v3-line-controls .button {
    min-height: 2.5rem;
    padding: .45rem .8rem;
    border: 1px solid #2457e6;
    border-radius: 5px;
    background: #fff;
    color: #17335c;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.mpa-stamp-v3-form .mpa-stamp-v3-line-controls .button:hover,
.mpa-stamp-v3-form .mpa-stamp-v3-line-controls .button:focus {
    background: #eef3ff;
}
.mpa-stamp-v3-form .mpa-stamp-v3-line-limit {
    color: #536273;
    font-size: .9em;
}
.mpa-stamp-v3-form .mpa-stamp-v3-line-limit.is-warning {
    color: #b42318;
    font-weight: 600;
}

/* Artwork conversion messaging lives only in the preview. Gravity Forms owns
 * the upload-field layout, restrictions, and required consent field. */
.mpa-stamp-v3-converted-preview-note {
    margin: .75rem 0 0;
    padding: .65rem .75rem;
    border-radius: 6px;
    background: #fff7e6;
    color: #65420c;
    font-size: .9em;
    line-height: 1.45;
}
.mpa-stamp-v3-upload-placeholder.is-error {
    color: #b42318;
    font-weight: 700;
}

/* Pickup details are appended inside the native Gravity Forms pickup-location
 * field. These rules do not control the field's grid width or placement. */
.mpa-stamp-v3-form .mpa-stamp-v3-pickup-info {
    margin-top: .8rem;
    padding: .9rem 1rem;
    border: 1px solid #d8e2ee;
    border-left: 4px solid #2457e6;
    border-radius: 7px;
    background: #f7faff;
    color: #23364d;
}
.mpa-stamp-v3-form .mpa-stamp-v3-pickup-info h4 {
    margin: 0 0 .45rem;
    font-size: 1.05rem;
}
.mpa-stamp-v3-form .mpa-stamp-v3-pickup-info p {
    margin: .25rem 0;
}
.mpa-stamp-v3-form .mpa-stamp-v3-pickup-hours {
    display: grid;
    grid-template-columns: minmax(7rem, auto) 1fr;
    gap: .15rem .75rem;
    margin: .35rem 0;
}
.mpa-stamp-v3-form .mpa-stamp-v3-pickup-hours dt,
.mpa-stamp-v3-form .mpa-stamp-v3-pickup-hours dd {
    margin: 0;
}
.mpa-stamp-v3-form .mpa-stamp-v3-pickup-hours dt {
    font-weight: 600;
}
.mpa-stamp-v3-form .mpa-stamp-v3-pickup-note {
    color: #5d6b7a;
    font-size: .88em;
}
.mpa-stamp-v3-form .mpa-stamp-v3-pickup-link {
    display: inline-block;
    margin-top: .35rem;
    font-weight: 600;
}

/* Custom Stamp is intentionally text-only. This legacy field may remain in an
 * older Gravity Form until it is deleted in the form editor. */
.mpa-stamp-v3-form .mpa-stamp-v3-custom-upload {
    display: none !important;
}


/* Checkout estimate: the custom summary is the single customer-facing pricing
 * display. Native Gravity Forms Product and Total fields remain fully present
 * for calculation and PayPal, but are moved offscreen to avoid duplicate $0.00
 * boxes and checkout clutter. Their field types are not changed. */
.mpa-stamp-v3-form .mpa-stamp-v3-product-field,
.mpa-stamp-v3-form .gfield_total {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.mpa-stamp-v3-form .mpa-stamp-v3-quote-summary {
    width: 100%;
}
.mpa-stamp-v3-estimate-card {
    overflow: hidden;
    border: 1px solid #d8e2ee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(23, 43, 77, .08);
}
.mpa-stamp-v3-estimate-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(12rem, .75fr);
    gap: 1rem;
    align-items: center;
    padding: 1.1rem 1.2rem;
    background: linear-gradient(135deg, #f3f7ff 0%, #eef8f4 100%);
}
.mpa-stamp-v3-estimate-kicker,
.mpa-stamp-v3-estimate-production span {
    display: block;
    margin-bottom: .2rem;
    color: #536273;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .045em;
    text-transform: uppercase;
}
.mpa-stamp-v3-estimate-total {
    display: block;
    color: #163c9f;
    font-size: clamp(2rem, 5vw, 3.15rem);
    line-height: 1;
    letter-spacing: -.035em;
}
.mpa-stamp-v3-estimate-production {
    padding: .75rem .85rem;
    border: 1px solid rgba(36, 87, 230, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .82);
}
.mpa-stamp-v3-estimate-production strong {
    display: block;
    color: #17335c;
    line-height: 1.35;
}
.mpa-stamp-v3-estimate-lines {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: .3rem 1.2rem .8rem;
}
.mpa-stamp-v3-estimate-lines > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .72rem 0;
    border-bottom: 1px solid #edf1f5;
}
.mpa-stamp-v3-estimate-lines > div:nth-child(odd) {
    margin-right: 1rem;
}
.mpa-stamp-v3-estimate-lines dt,
.mpa-stamp-v3-estimate-lines dd {
    margin: 0;
}
.mpa-stamp-v3-estimate-lines dt {
    color: #536273;
}
.mpa-stamp-v3-estimate-lines dd {
    color: #172b45;
    font-weight: 700;
    text-align: right;
}
.mpa-stamp-v3-estimate-availability {
    margin: 0;
    padding: .75rem 1.2rem;
    border-top: 1px solid #edf1f5;
    background: #fff8e8;
    color: #65420c;
}
.mpa-stamp-v3-estimate-empty {
    padding: 1rem 1.1rem;
    border: 1px dashed #c7d3df;
    border-radius: 9px;
    background: #f8fafc;
    color: #536273;
}

/* Keep native Gravity Forms Consent fields. They store the exact agreement
 * text/revision with the entry; these rules only improve checkout readability. */
.mpa-stamp-v3-form .gfield--type-consent {
    padding: .85rem 1rem !important;
    border: 1px solid #e1e7ef;
    border-radius: 9px;
    background: #fbfcfe;
}
.mpa-stamp-v3-form .gfield--type-consent .gfield_label {
    margin-bottom: .45rem;
    color: #172b45;
    font-size: 1rem;
}
.mpa-stamp-v3-form .gfield--type-consent .ginput_container_consent {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .65rem;
    align-items: start;
}
.mpa-stamp-v3-form .gfield--type-consent input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin: .12rem 0 0;
}
.mpa-stamp-v3-form .gfield--type-consent .gfield_consent_label {
    line-height: 1.45;
}

/* Inactivity protection. Active editing resets the timer. */
.mpa-stamp-v3-session-notice {
    margin: 0 0 1rem;
    padding: .8rem 1rem;
    border: 1px solid #d8e2ee;
    border-left-width: 4px;
    border-radius: 8px;
    line-height: 1.45;
}
.mpa-stamp-v3-session-notice.is-warning {
    border-left-color: #d68a00;
    background: #fff8e8;
    color: #65420c;
}
.mpa-stamp-v3-session-notice.is-expired {
    border-left-color: #c7372f;
    background: #fff1f0;
    color: #7a271a;
}

@media (max-width: 767px) {
    .mpa-stamp-v3-estimate-hero,
    .mpa-stamp-v3-estimate-lines {
        grid-template-columns: 1fr;
    }
    .mpa-stamp-v3-estimate-lines > div:nth-child(odd) {
        margin-right: 0;
    }
}
