/* =============================================
   Customer Redirect Modal
   ============================================= */

.rtx-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.55);
    overflow-y: auto;
    padding: 1.5rem 1rem;
    align-items: center;
    justify-content: center;
}

.rtx-modal-overlay.is-open {
    display: flex;
    animation: rtxModalFadeIn 0.2s ease;
}

@keyframes rtxModalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Panel */
.rtx-modal-inner {
    position: relative;
    background: #fff;
    max-width: 1020px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
}

/* Header bar — left 60% white, right 40% matches the contact panel colour.
   --rtx-panel-bg is set inline from the editable panel background so the
   header accent always follows whatever colour is chosen in Gutenberg. */
.rtx-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(to right, #fff 60%, var(--rtx-panel-bg, #1e2d4f) 60%);
}

/* !important on colour/box props — themes and page builders style bare
   <button> elements aggressively and the modal chrome must not inherit it */
.rtx-modal-back {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    color: #2d8f6f !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0 !important;
    line-height: 1.5;
    text-decoration: none;
}

.rtx-modal-back:hover { text-decoration: underline; }

.rtx-modal-close {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0 !important;
    color: #fff !important;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.15s;
}

.rtx-modal-close:hover { background: rgba(255, 255, 255, 0.15) !important; }

/* Content area */
.rtx-modal-content {
    padding: 0;
}

/* -----------------------------------------------
   Core block-layout fallback
   The modal must not depend on WordPress's block-library stylesheet —
   page-builder sites (Elementor/WPBakery) with perf plugins often dequeue
   it, which leaves .wp-block-columns without display:flex and the modal
   renders stacked. Recreate the minimal core layout rules here, scoped
   to the modal.
----------------------------------------------- */
.rtx-modal-inner,
.rtx-modal-inner * {
    box-sizing: border-box;
}

.rtx-modal-content .wp-block-column {
    flex-grow: 1;
    flex-basis: 0;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Columns with an explicit width keep their inline flex-basis */
.rtx-modal-content .wp-block-column[style*="flex-basis"] {
    flex-grow: 0;
}

.rtx-modal-content .wp-block-image {
    margin: 0;
}

/* Sites running the full the_content filter stack (wpautop + page-builder
   filters) can inject stray empty paragraphs around the block markup; their
   margin shows as a white stripe between the header and the panels. */
.rtx-modal-content > p:empty {
    display: none !important;
}

/* -----------------------------------------------
   Outer columns (the two-panel split)
----------------------------------------------- */
.rtx-modal-content .wp-block-columns {
    display: flex !important;
    column-gap: 0 !important;
    /* Zero the top margin too — the theme's default block spacing otherwise
       leaves a white gap between the header bar and the columns, which shows
       as a stripe across the coloured contact panel. */
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
}

.rtx-modal-content .wp-block-column {
    padding: 2rem 2.5rem !important;
    margin: 0 !important;
}

/* -----------------------------------------------
   Feature items  (core/group + core/image + core/group)
----------------------------------------------- */
.rtx-modal-content .rtx-feature-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
}

.rtx-modal-content .rtx-feature-item:last-child {
    margin-bottom: 0;
}

/* Keep the icon a fixed size regardless of theme resets */
.rtx-modal-content .rtx-feature-item > .wp-block-image {
    flex-shrink: 0;
}

.rtx-modal-content .rtx-feature-item > .wp-block-image img {
    width: 44px !important;
    height: 44px !important;
    object-fit: contain;
    display: block;
    filter: brightness(0);
}

/* Feature title (h4) */
.rtx-modal-content .rtx-feature-item h4 {
    color: #000;
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 1.3;
    margin: 0 0 0.25rem !important;
}

/* Feature description */
.rtx-modal-content .rtx-feature-item p {
    font-size: 0.8125rem;
    color: #555;
    line-height: 1.45;
    margin: 0 !important;
}

/* Inner feature-grid columns — reset outer column padding.
   The column gap is normally emitted by core layout-support CSS from the
   template's blockGap setting; set it here too so it survives on sites
   where that CSS never loads. */
.rtx-modal-content .wp-block-column .wp-block-columns {
    margin: 1.25rem 0 1.75rem !important;
    column-gap: 1.5rem !important;
}

.rtx-modal-content .wp-block-column .wp-block-columns .wp-block-column {
    padding: 0 !important;
}

/* -----------------------------------------------
   Left-column CTA buttons (Register now / Sign in)
----------------------------------------------- */

/* Force the buttons wrapper to flex so flex: 1 on children works */
.rtx-modal-content .wp-block-buttons:has(.rtx-btn-register) {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 0.75rem;
}

/* Equal-width: each button div grows to fill half the row */
.rtx-modal-content .rtx-btn-register,
.rtx-modal-content .rtx-btn-signin {
    flex: 1 !important;
    min-width: 0;
}

/* The <a> tag defaults to inline-flex — switch to flex so width: 100% applies.
   Padding/decoration normally come from core button CSS — provide them here
   too so the pills keep their shape when that stylesheet is dequeued. */
.rtx-modal-content .rtx-btn-register .wp-block-button__link,
.rtx-modal-content .rtx-btn-signin .wp-block-button__link {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;
}

/* Colours below are defaults only (no !important) so they can be overridden
   per-site from the Gutenberg colour controls. Shape/layout stays locked. */
.rtx-modal-content .rtx-btn-register .wp-block-button__link {
    border-radius: 100px !important;
    background: transparent;
    border: 2px solid #000;
    color: #000;
}

.rtx-modal-content .rtx-btn-signin .wp-block-button__link {
    border-radius: 100px !important;
    background-color: #000;
    color: #fff;
}

/* Disclaimer below buttons */
.rtx-modal-content .rtx-disclaimer {
    font-size: 0.75rem !important;
    color: #888 !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0 !important;
}

/* -----------------------------------------------
   Contact buttons  (core/group pill + core/image + core/button)
----------------------------------------------- */
.rtx-modal-content .rtx-contact-btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    border: none !important;
    border-radius: 100px !important;
    padding: 0.875rem 1.5rem !important;
    gap: 0.875rem !important;
    transition: filter 0.15s, box-shadow 0.15s;
    margin-bottom: 0.75rem;
    /* Default pill colour — overridable from the Gutenberg group colour controls */
    background: #fff;
}

/* Hover cue that works regardless of the chosen pill colour */
.rtx-modal-content .rtx-contact-btn:hover {
    filter: brightness(0.96);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Icon — keep dark against the white pill background */
.rtx-modal-content .rtx-contact-icon {
    flex-shrink: 0;
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    line-height: 0;
}

.rtx-modal-content .rtx-contact-icon img {
    width: 22px !important;
    height: 22px !important;
    object-fit: contain;
    display: block;
    filter: brightness(0);
}

/* The button inside the contact group — strip all button styling */
.rtx-modal-content .rtx-contact-btn .wp-block-buttons {
    margin: 0 !important;
}

.rtx-modal-content .rtx-contact-btn .wp-block-button__link {
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    text-decoration: none !important;
    /* Colours are defaults only so they stay editable in Gutenberg */
    background: transparent;
    color: #000;
}

/* -----------------------------------------------
   Responsive
----------------------------------------------- */
@media (max-width: 720px) {
    .rtx-modal-overlay {
        padding: 0;
        align-items: flex-start;
    }

    .rtx-modal-inner {
        border-radius: 0;
        max-height: 100dvh;
        overflow-y: auto;
    }

    .rtx-modal-content .wp-block-columns {
        flex-wrap: wrap !important;
    }

    .rtx-modal-content .wp-block-column {
        flex-basis: 100% !important;
        max-width: 100% !important;
        padding: 1.5rem !important;
    }
}
