/* ================================================================
   Womenmatic — Single Product (Subscription UX)
   ================================================================
   - wm-styled add-to-cart button ("Jetzt abschliessen")
   - "Bereits Mitglied" card for active subscribers (replaces button)
   - Trust strip for non-subscribers (under add-to-cart)
   - Order-received post-purchase next-step card
   ================================================================ */

/* ── 1. Add-to-cart button → wm-btn--primary style ──────────── */

body.single-product .single_add_to_cart_button,
body.single-product button.single_add_to_cart_button,
body.single-product .woocommerce div.product form.cart .button,
body.single-product .cart .button {
    /* Layout normalization — Kadence parent theme sets `display:block;float:left`    */
    /* on single-product buttons which causes the CTA to drift / break adjacent flow. */
    /* We force inline-flex + float:none so the button behaves like a regular CTA.    */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    float: none !important;
    vertical-align: top !important;
    width: auto !important;
    /* Visual                                                                          */
    background: var(--wm-primary, #4685A5) !important;
    background-color: var(--wm-primary, #4685A5) !important;
    color: #fff !important;
    border: none !important;
    padding: 14px 28px !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    font-family: 'Lato', sans-serif !important;
    letter-spacing: 0.3px !important;
    text-transform: none !important;
    cursor: pointer !important;
    transition: background 0.2s ease, transform 0.15s ease !important;
    box-shadow: 0 1px 3px rgba(70, 133, 165, 0.25) !important;
    min-height: 48px !important; /* WCAG touch target */
    line-height: 1.4 !important;
    text-decoration: none !important;
}

/* Cart form wrapper — ensure no stale float chain pushes siblings around */
body.single-product form.cart {
    overflow: visible !important;
}

body.single-product form.cart::after {
    content: '';
    display: table;
    clear: both;
}

body.single-product .single_add_to_cart_button:hover,
body.single-product .single_add_to_cart_button:focus-visible {
    background: #3A6E88 !important;
    transform: translateY(-1px);
    outline: none !important;
    box-shadow: 0 4px 12px rgba(70, 133, 165, 0.35) !important;
}

body.single-product .single_add_to_cart_button:active {
    transform: translateY(0);
}

/* Price row: give breathing room + brand color emphasis */

body.single-product .product_title {
    font-family: 'Lato', sans-serif !important;
    color: var(--wm-text, #4C4842);
    font-weight: 700;
    letter-spacing: -0.5px;
}

body.single-product .price {
    color: var(--wm-text, #4C4842) !important;
    font-family: 'Lato', sans-serif !important;
}

body.single-product .price ins {
    text-decoration: none !important;
    background: transparent !important;
}

body.single-product .tax_label,
body.single-product small {
    color: var(--wm-text-muted, #7A7470) !important;
    font-size: 13px !important;
}

/* ── CSS fallback: hide cart form when user is already subscribed ─── */
/* Backs up the `woocommerce_is_purchasable` filter in functions.php —   */
/* ensures the Jetzt-abschliessen button physically disappears even if a */
/* plugin/Elementor widget re-renders it outside the filter's scope.     */
/* Trigger: body.wm-is-subscribed-to-product (added via body_class filter)*/

body.wm-is-subscribed-to-product.single-product form.cart,
body.wm-is-subscribed-to-product.single-product .single_add_to_cart_button,
body.wm-is-subscribed-to-product.single-product .quantity,
body.wm-is-subscribed-to-product.single-product .first-payment-date,
body.wm-is-subscribed-to-product.single-product .wc-subscriptions-cart-buttons,
body.wm-is-subscribed-to-product.single-product .yith-wcwl-add-to-wishlist,
body.wm-is-subscribed-to-product.single-product .woocommerce-variation-add-to-cart,
body.wm-is-subscribed-to-product.single-product form.variations_form {
    display: none !important;
    visibility: hidden !important;
}

/* ── 2. "Bereits Mitglied" card — premium enhanced ──────────── */

body.single-product .wm-already-member {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, rgba(193, 174, 142, 0.08) 50%, rgba(70, 133, 165, 0.08) 100%);
    border: 1px solid rgba(80, 112, 90, 0.22);
    border-radius: 16px;
    padding: 24px 26px;
    margin: 20px 0 24px 0;
    font-family: 'Lato', sans-serif;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    overflow: hidden;
}

/* Subtle brand accent line along the top */
body.single-product .wm-already-member::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #50705A 0%, #C1AE8E 50%, #4685A5 100%);
    border-radius: 16px 16px 0 0;
}

body.single-product .wm-already-member__top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

body.single-product .wm-already-member__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fff;
    color: #50705A;
    box-shadow: 0 1px 4px rgba(80, 112, 90, 0.18), 0 0 0 1px rgba(80, 112, 90, 0.1);
}

body.single-product .wm-already-member__icon i,
body.single-product .wm-already-member__icon svg {
    width: 26px;
    height: 26px;
    stroke-width: 2.2;
}

body.single-product .wm-already-member__heading {
    flex: 1;
    min-width: 0;
}

body.single-product .wm-already-member__eyebrow {
    margin: 0 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #50705A !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1.2;
}

body.single-product .wm-already-member__title {
    margin: 2px 0 0 0 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    color: var(--wm-text, #4C4842) !important;
    line-height: 1.25 !important;
    letter-spacing: -0.3px;
}

/* Plan detail rows (grid-like key/value pairs) */
body.single-product .wm-already-member__plan {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    backdrop-filter: blur(4px);
}

body.single-product .wm-already-member__plan-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

body.single-product .wm-already-member__plan-row:first-child {
    padding-top: 2px;
}

body.single-product .wm-already-member__plan-row:last-child {
    padding-bottom: 2px;
    border-bottom: none;
}

body.single-product .wm-already-member__plan-label {
    font-size: 13px;
    color: var(--wm-text-muted, #7A7470);
    font-weight: 500;
    flex-shrink: 0;
}

body.single-product .wm-already-member__plan-value {
    font-size: 14px;
    color: var(--wm-text, #4C4842);
    font-weight: 600;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

body.single-product .wm-already-member__plan-value .woocommerce-Price-amount {
    font-weight: 600;
    color: inherit;
}

/* Status pill (reuses coloring from wm-subscription-status) */
body.single-product .wm-already-member__status {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 3px 9px !important;
    border-radius: 999px;
    background: rgba(80, 112, 90, 0.12);
    color: #50705A !important;
    text-align: center !important;
    max-width: none !important;
}

body.single-product .wm-already-member__status--pending-cancel {
    background: rgba(193, 174, 142, 0.2);
    color: #8F7B5C !important;
}

body.single-product .wm-already-member__status--on-hold {
    background: rgba(70, 133, 165, 0.14);
    color: var(--wm-primary, #4685A5) !important;
}

body.single-product .wm-already-member__text {
    margin: 0 0 16px 0 !important;
    font-size: 14px !important;
    color: var(--wm-text-muted, #7A7470) !important;
    line-height: 1.55 !important;
}

/* Action buttons row */
body.single-product .wm-already-member__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

body.single-product .wm-already-member .wm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    min-height: 42px;
    text-decoration: none !important;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    line-height: 1.2;
    white-space: nowrap;
}

body.single-product .wm-already-member .wm-btn--primary {
    background: var(--wm-primary, #4685A5);
    color: #fff !important;
    box-shadow: 0 1px 3px rgba(70, 133, 165, 0.3);
}

body.single-product .wm-already-member .wm-btn--primary:hover {
    background: #3A6E88;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(70, 133, 165, 0.35);
}

body.single-product .wm-already-member .wm-btn--ghost {
    background: transparent;
    color: var(--wm-text, #4C4842) !important;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

body.single-product .wm-already-member .wm-btn--ghost:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.2);
}

body.single-product .wm-already-member .wm-btn i,
body.single-product .wm-already-member .wm-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* Mobile */
@media (max-width: 640px) {
    body.single-product .wm-already-member {
        padding: 20px 18px;
    }

    body.single-product .wm-already-member__top {
        gap: 12px;
    }

    body.single-product .wm-already-member__title {
        font-size: 20px !important;
    }

    body.single-product .wm-already-member__plan {
        padding: 12px 14px;
    }

    body.single-product .wm-already-member__plan-value {
        max-width: 55%;
        font-size: 13px;
    }

    body.single-product .wm-already-member__actions {
        flex-direction: column;
    }

    body.single-product .wm-already-member .wm-btn {
        width: 100%;
    }
}

/* ── 3. Trust strip (non-subscribers) ────────────────────────── */

body.single-product .wm-product-trust-strip {
    list-style: none;
    padding: 14px 0 0 0;
    margin: 14px 0 0 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-family: 'Lato', sans-serif;
}

body.single-product .wm-product-trust-strip li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--wm-text-muted, #7A7470);
    line-height: 1.4;
    margin: 0;
}

body.single-product .wm-product-trust-strip i,
body.single-product .wm-product-trust-strip svg {
    width: 16px;
    height: 16px;
    color: #50705A;
    flex-shrink: 0;
}

/* ── 4. Thank-you page next-step card ────────────────────────── */

.woocommerce-order .wm-thankyou-next-steps {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    background: linear-gradient(135deg, rgba(70, 133, 165, 0.06), rgba(193, 174, 142, 0.08));
    border: 1px solid rgba(70, 133, 165, 0.18);
    border-radius: 16px;
    padding: 28px 32px;
    margin: 0 0 32px 0;
    font-family: 'Lato', sans-serif;
}

.woocommerce-order .wm-thankyou-next-steps__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fff;
    color: #C1AE8E;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.woocommerce-order .wm-thankyou-next-steps__icon i,
.woocommerce-order .wm-thankyou-next-steps__icon svg {
    width: 28px;
    height: 28px;
}

.woocommerce-order .wm-thankyou-next-steps__body {
    flex: 1;
    min-width: 0;
}

.woocommerce-order .wm-thankyou-next-steps h2 {
    margin: 0 0 8px 0 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    color: var(--wm-text, #4C4842) !important;
    line-height: 1.25 !important;
}

.woocommerce-order .wm-thankyou-next-steps p {
    margin: 0 0 18px 0 !important;
    font-size: 15px !important;
    color: var(--wm-text-muted, #7A7470) !important;
    line-height: 1.5 !important;
}

.woocommerce-order .wm-thankyou-next-steps .wm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--wm-primary, #4685A5);
    color: #fff !important;
    text-decoration: none !important;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s ease;
    min-height: 44px;
}

.woocommerce-order .wm-thankyou-next-steps .wm-btn i,
.woocommerce-order .wm-thankyou-next-steps .wm-btn svg {
    width: 18px;
    height: 18px;
}

.woocommerce-order .wm-thankyou-next-steps .wm-btn:hover {
    background: #3A6E88;
}

/* ── 5. Mobile responsive ────────────────────────────────────── */

@media (max-width: 640px) {
    body.single-product .single_add_to_cart_button {
        width: 100% !important;
        text-align: center !important;
    }

    body.single-product .wm-already-member,
    .woocommerce-order .wm-thankyou-next-steps {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    body.single-product .wm-already-member__icon,
    .woocommerce-order .wm-thankyou-next-steps__icon {
        margin: 0 auto;
    }

    body.single-product .wm-product-trust-strip {
        flex-direction: column;
        gap: 10px;
    }
}
