/**
 * CMUK membership plan picker
 * Shared by /apply/ step 0 and [cmuk_membership_plans] on /become-a-vendor/.
 * Markup: public/templates/membership-plans.php
 */

.cmuk-plans {
    --plans-ink: var(--cmuk-brand-navy, #05386B);
    --plans-muted: #5b6b7f;
    --plans-line: #e5e7eb;
    --plans-soft: var(--cmuk-brand-offwhite-50, #FAF8F5);
    color: var(--plans-ink);
}

.cmuk-plans .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   Cards
   ======================================== */
.cmuk-membership-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem 1.5rem;
    margin: 1.5rem 0 1rem;
}

@media (min-width: 900px) {
    .cmuk-membership-grid {
        grid-template-columns: repeat(3, 1fr);
        align-items: stretch;
    }
}

.cmuk-membership-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 2px solid var(--plans-line);
    border-radius: 16px;
    padding: 1.75rem 1.5rem 1.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.cmuk-plans--marketing .cmuk-membership-card {
    cursor: default;
}

.cmuk-membership-card:hover {
    border-color: var(--cmuk-brand-teal, #00ceb5);
    box-shadow: 0 8px 32px rgba(5, 56, 107, 0.10);
    transform: translateY(-2px);
}

.cmuk-membership-card.selected {
    border-color: var(--cmuk-brand-teal, #00ceb5);
    background: linear-gradient(135deg, rgba(0, 206, 181, 0.03) 0%, rgba(0, 206, 181, 0.08) 100%);
    box-shadow: 0 8px 32px rgba(0, 206, 181, 0.15);
}

/* Free plan: the recommended starting point. */
.cmuk-membership-card--start {
    border-color: var(--cmuk-brand-teal, #00ceb5);
    box-shadow: 0 12px 40px rgba(0, 206, 181, 0.16);
}

.cmuk-plan-badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    background: var(--cmuk-brand-teal, #00ceb5);
    color: var(--cmuk-brand-navy, #05386B);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Unlimited plan: navy "luxe" card. */
.cmuk-membership-card--luxe {
    border-color: transparent;
    background: linear-gradient(135deg, var(--cmuk-brand-navy, #05386B) 0%, #0a4a8c 100%);
    box-shadow: 0 12px 40px rgba(5, 56, 107, 0.25);
    color: var(--cmuk-brand-cream, #ffeedc);
}

.cmuk-membership-card--luxe:hover,
.cmuk-membership-card--luxe.selected {
    border-color: var(--cmuk-brand-gold, #f7aa29);
    background: linear-gradient(135deg, var(--cmuk-brand-navy, #05386B) 0%, #0a4a8c 100%);
    box-shadow: 0 16px 48px rgba(5, 56, 107, 0.35);
}

.cmuk-membership-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.cmuk-membership-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: inherit;
    margin: 0 0 0.4rem;
}

.cmuk-membership-desc {
    font-size: 0.9rem;
    color: var(--plans-muted);
    margin: 0;
    line-height: 1.5;
}

/* Pricing */
.cmuk-membership-pricing {
    text-align: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--plans-line);
}

.cmuk-price-display {
    margin: 0.5rem 0;
}

.cmuk-price-amount {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    color: inherit;
}

.cmuk-price-period {
    font-size: 1rem;
    font-weight: 400;
    color: var(--plans-muted);
}

.cmuk-annual-savings {
    display: inline-block;
    background: #d3f9d8;
    color: #0b7a3e;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 0.5rem 0 0;
}

.cmuk-plan-price-note {
    margin: 0.6rem 0 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0a7d70;
}

.cmuk-billing-toggle {
    margin-bottom: 0.75rem;
}

.cmuk-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    cursor: pointer;
}

.cmuk-billing-period-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: var(--wp--preset--color--slate, #e4eaf0);
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.cmuk-billing-period-toggle:checked {
    background: var(--cmuk-brand-teal, #00ceb5);
}

.cmuk-billing-period-toggle:focus-visible {
    outline: 2px solid var(--cmuk-brand-navy, #05386B);
    outline-offset: 2px;
}

.cmuk-billing-period-toggle::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cmuk-billing-period-toggle:checked::before {
    transform: translateX(22px);
}

.cmuk-toggle-text {
    font-size: 0.8rem;
    color: var(--plans-muted);
}

.cmuk-toggle-text span + span::before {
    content: ' / ';
    font-weight: 400;
    color: var(--plans-muted);
}

.cmuk-billing-period-toggle:not(:checked) ~ .cmuk-toggle-text .cmuk-toggle-monthly,
.cmuk-billing-period-toggle:checked ~ .cmuk-toggle-text .cmuk-toggle-annual {
    color: var(--plans-ink);
    font-weight: 700;
}

/* Marketing context has no JS: the checkbox drives the price via :has(). */
.cmuk-plans--marketing .cmuk-price-annual,
.cmuk-plans--marketing .cmuk-annual-savings {
    display: none;
}

.cmuk-plans--marketing .cmuk-membership-card:has(.cmuk-billing-period-toggle:checked) .cmuk-price-monthly {
    display: none;
}

.cmuk-plans--marketing .cmuk-membership-card:has(.cmuk-billing-period-toggle:checked) .cmuk-price-annual {
    display: inline;
}

.cmuk-plans--marketing .cmuk-membership-card:has(.cmuk-billing-period-toggle:checked) .cmuk-annual-savings {
    display: inline-block;
}

/* Features */
.cmuk-membership-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    flex-grow: 1;
}

.cmuk-membership-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.45rem 0;
    font-size: 0.95rem;
    line-height: 1.4;
    color: inherit;
}

.cmuk-membership-features .icon {
    color: var(--cmuk-brand-teal, #00ceb5);
    font-size: 19px;
    line-height: 1.1;
    flex-shrink: 0;
}

.cmuk-membership-features .cmuk-plan-feature--no {
    color: var(--plans-muted);
    opacity: 0.6;
}

.cmuk-membership-features .cmuk-plan-feature--no .icon {
    color: #b8c2cc;
}

/* Luxe overrides */
.cmuk-membership-card--luxe .cmuk-membership-desc,
.cmuk-membership-card--luxe .cmuk-price-period,
.cmuk-membership-card--luxe .cmuk-toggle-text,
.cmuk-membership-card--luxe .cmuk-toggle-text span + span::before,
.cmuk-membership-card--luxe .cmuk-membership-features .cmuk-plan-feature--no {
    color: var(--cmuk-brand-gold-50, #fff1d8);
}

.cmuk-membership-card--luxe .cmuk-billing-period-toggle:not(:checked) ~ .cmuk-toggle-text .cmuk-toggle-monthly,
.cmuk-membership-card--luxe .cmuk-billing-period-toggle:checked ~ .cmuk-toggle-text .cmuk-toggle-annual {
    color: #fff;
}

.cmuk-membership-card--luxe .cmuk-membership-pricing {
    border-color: rgba(247, 170, 41, 0.3);
}

.cmuk-membership-card--luxe .cmuk-membership-features .icon {
    color: var(--cmuk-brand-gold, #f7aa29);
}

.cmuk-membership-card--luxe .cmuk-plan-price-note {
    color: var(--cmuk-brand-gold, #f7aa29);
}

/* Buttons: apply context reuses .cmuk-btn from cmuk-application.css */
.cmuk-select-membership {
    width: 100%;
    min-height: 48px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    margin-top: auto;
}

.cmuk-membership-card.selected .cmuk-select-membership {
    background: var(--cmuk-brand-teal, #00ceb5);
    border-color: var(--cmuk-brand-teal, #00ceb5);
    color: #fff;
}

.cmuk-membership-card--luxe .cmuk-select-membership {
    color: var(--cmuk-brand-gold, #f7aa29);
    border-color: var(--cmuk-brand-gold, #f7aa29);
}

.cmuk-membership-card--luxe .cmuk-select-membership:hover,
.cmuk-membership-card--luxe.selected .cmuk-select-membership {
    background: var(--cmuk-brand-gold, #f7aa29);
    border-color: var(--cmuk-brand-gold, #f7aa29);
    color: var(--cmuk-brand-navy, #05386B);
}

.cmuk-plan-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    margin-top: auto;
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    border: 2px solid var(--cmuk-brand-navy, #05386B);
    background: transparent;
    color: var(--cmuk-brand-navy, #05386B);
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.cmuk-plan-cta:hover,
.cmuk-plan-cta:focus-visible {
    background: var(--cmuk-brand-navy, #05386B);
    color: #fff;
}

.cmuk-membership-card--start .cmuk-plan-cta {
    background: var(--cmuk-brand-teal, #00ceb5);
    border-color: var(--cmuk-brand-teal, #00ceb5);
    color: var(--cmuk-brand-navy, #05386B);
}

.cmuk-membership-card--start .cmuk-plan-cta:hover,
.cmuk-membership-card--start .cmuk-plan-cta:focus-visible {
    background: var(--cmuk-brand-navy, #05386B);
    border-color: var(--cmuk-brand-navy, #05386B);
    color: #fff;
}

.cmuk-membership-card--luxe .cmuk-plan-cta {
    background: var(--cmuk-brand-gold, #f7aa29);
    border-color: var(--cmuk-brand-gold, #f7aa29);
    color: var(--cmuk-brand-navy, #05386B);
}

.cmuk-membership-card--luxe .cmuk-plan-cta:hover,
.cmuk-membership-card--luxe .cmuk-plan-cta:focus-visible {
    background: #fff;
    border-color: #fff;
}

.cmuk-plan-switch-note {
    margin: 0 0 1.75rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--plans-muted);
}

/* ========================================
   Included on every plan
   ======================================== */
.cmuk-plan-everyone {
    margin: 0 0 1.25rem;
    padding: 1.5rem;
    border-radius: 16px;
    background: var(--plans-soft);
    border: 1px solid var(--plans-line);
}

.cmuk-plan-everyone h3,
.cmuk-plan-steps h3 {
    margin: 0 0 1rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: inherit;
}

.cmuk-plan-everyone__groups {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 960px) {
    .cmuk-plan-everyone__groups {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }

    .cmuk-plan-everyone__group + .cmuk-plan-everyone__group {
        padding-left: 1.5rem;
        border-left: 1px solid var(--plans-line);
    }
}

.cmuk-plan-everyone h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--plans-muted);
}

.cmuk-plan-everyone h4 .icon {
    font-size: 20px;
    color: var(--cmuk-brand-navy, #05386B);
}

.cmuk-plan-everyone ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cmuk-plan-everyone li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.95rem;
    line-height: 1.35;
}

.cmuk-plan-everyone li .icon {
    color: var(--cmuk-brand-teal, #00ceb5);
    font-size: 16px;
    flex-shrink: 0;
}

.cmuk-plan-fee-note {
    margin: 1rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--plans-line);
    font-size: 0.875rem;
    color: var(--plans-muted);
}

/* ========================================
   Compare (native <details>)
   ======================================== */
.cmuk-plan-compare {
    margin: 0 0 1.25rem;
    border: 1px solid var(--plans-line);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
}

.cmuk-plan-compare > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 56px;
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    list-style: none;
}

.cmuk-plan-compare > summary::-webkit-details-marker {
    display: none;
}

.cmuk-plan-compare > summary::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
    color: var(--cmuk-brand-teal, #00ceb5);
}

.cmuk-plan-compare[open] > summary::after {
    content: '\2212';
}

.cmuk-plan-compare > summary:focus-visible {
    outline: 2px solid var(--cmuk-brand-navy, #05386B);
    outline-offset: -4px;
}

.cmuk-plan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.cmuk-plan-table th,
.cmuk-plan-table td {
    padding: 0.85rem 1rem;
    text-align: center;
    vertical-align: middle;
    border-top: 1px solid var(--plans-line);
}

.cmuk-plan-table thead th {
    font-weight: 700;
    background: var(--plans-soft);
}

.cmuk-plan-table thead td {
    background: var(--plans-soft);
    border-top: 1px solid var(--plans-line);
}

.cmuk-plan-table tbody th[scope="row"] {
    text-align: left;
    font-weight: 600;
    width: 40%;
}

.cmuk-plan-table__group th {
    text-align: left;
    padding-top: 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--plans-muted);
    background: transparent;
}

.cmuk-plan-table__sub {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--plans-muted);
}

.cmuk-plan-yes {
    color: var(--cmuk-brand-teal, #00ceb5);
    font-size: 22px;
}

.cmuk-plan-no {
    color: #b8c2cc;
    font-size: 18px;
}

.cmuk-plan-value {
    font-weight: 700;
}

/* ========================================
   How joining works
   ======================================== */
.cmuk-plan-steps {
    margin: 0 0 1.5rem;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--plans-line);
    background: #fff;
}

.cmuk-plan-steps ol {
    list-style: none;
    counter-reset: plan-step;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 900px) {
    .cmuk-plan-steps ol {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

.cmuk-plan-steps li {
    counter-increment: plan-step;
    position: relative;
    padding-left: 2.75rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--plans-muted);
}

.cmuk-plan-steps li::before {
    content: counter(plan-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cmuk-brand-navy, #05386B);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.cmuk-plan-steps li strong {
    display: block;
    color: var(--plans-ink);
}

.cmuk-plan-steps__pay {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 1.25rem 0 0;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: rgba(0, 206, 181, 0.08);
    font-size: 0.9rem;
    line-height: 1.5;
}

.cmuk-plan-steps__pay .icon {
    color: #0a7d70;
    font-size: 22px;
    flex-shrink: 0;
}

/* ========================================
   Chosen-plan reminder (/apply/ step 2)
   ======================================== */
.cmuk-chosen-plan {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin: 0 auto 1.25rem;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    width: fit-content;
    max-width: 100%;
    border-radius: 999px;
    background: var(--plans-soft, #FAF8F5);
    border: 1px solid #e5e7eb;
    font-size: 0.9rem;
}

.cmuk-chosen-plan[hidden] {
    display: none;
}

.cmuk-chosen-plan__change {
    min-height: 36px;
    padding: 0.25rem 0.9rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--cmuk-brand-navy, #05386B);
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

/* ========================================
   Phones
   ======================================== */
@media (max-width: 640px) {
    .cmuk-membership-card {
        padding: 1.5rem 1.15rem 1.15rem;
    }

    .cmuk-membership-card:hover {
        transform: none;
    }

    .cmuk-price-amount {
        font-size: 2.1rem;
    }

    .cmuk-plan-everyone,
    .cmuk-plan-steps {
        padding: 1.15rem;
    }

    .cmuk-plan-compare > summary {
        padding: 0.75rem 1.15rem;
    }

    /* Table → stacked rows: label on its own line, three self-labelled cells below. */
    .cmuk-plan-table,
    .cmuk-plan-table tbody {
        display: block;
    }

    .cmuk-plan-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .cmuk-plan-table tbody tr {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        border-top: 1px solid var(--plans-line);
    }

    .cmuk-plan-table tbody th,
    .cmuk-plan-table tbody td {
        border-top: 0;
    }

    .cmuk-plan-table tbody th[scope="row"],
    .cmuk-plan-table__group th {
        grid-column: 1 / -1;
        width: auto;
        padding: 0.85rem 1.15rem 0.25rem;
    }

    .cmuk-plan-table__group {
        border-top: 0 !important;
    }

    .cmuk-plan-table__group th {
        padding-top: 1.25rem;
    }

    .cmuk-plan-table tbody td {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
        padding: 0.4rem 0.25rem 0.85rem;
        font-size: 0.9rem;
    }

    .cmuk-plan-table tbody td::before {
        content: attr(data-tier);
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--plans-muted);
    }
}
