/**
 * Programme Pricing Block — Block M v2 (M.D)
 *
 * Bottom-of-page horizontal block for programme pages. Reads the
 * `eiasm_programme_pricing` filter snapshot plus IC term-meta display fields.
 * Renders a two-pane layout: data grid on the left, pricing / scholarship
 * banner / CTAs on the right.
 *
 * Theme contract identical to the side card. Style scope: every rule lives
 * under `.eiasm-ppb`.
 *
 * @package EIASM_IC
 * @since   1.14.1
 */

/* ─── THEME TOKENS ───────────────────────────────────────────────────── */

.eiasm-ppb.eiasm-card--theme-default {
    --eiasm-card-primary:    #1587A8;
    --eiasm-card-primary-on: #FFFFFF;
    --eiasm-card-accent:     #1587A8;
    --eiasm-card-divider:    #E2E8F0;
    --eiasm-card-text:       #0B1220;
    --eiasm-card-muted:      #475569;
    --eiasm-card-bg:         #FFFFFF;
    --eiasm-card-border:     #E2E8F0;
    --eiasm-card-cta-bg:     var(--eiasm-card-primary);
    --eiasm-card-cta-fg:     var(--eiasm-card-primary-on);
    --eiasm-card-banner-bg:  #ECF6F9;
    --eiasm-card-banner-fg:  #0B1220;
}

.eiasm-ppb.eiasm-card--theme-dpr {
    --eiasm-card-primary:    #C9A84C;
    --eiasm-card-primary-on: #FFFFFF;
    --eiasm-card-accent:     #C9A84C;
    --eiasm-card-divider:    #E2E8F0;
    --eiasm-card-text:       #0B1220;
    --eiasm-card-muted:      #475569;
    --eiasm-card-bg:         #FFFFFF;
    --eiasm-card-border:     #E2E8F0;
    --eiasm-card-cta-bg:     var(--eiasm-card-primary);
    --eiasm-card-cta-fg:     var(--eiasm-card-primary-on);
    --eiasm-card-banner-bg:  #FBF4DB;
    --eiasm-card-banner-fg:  #0B1220;
}

/* ─── ROOT ───────────────────────────────────────────────────────────── */

.eiasm-ppb {
    width: 100%;
    max-width: 880px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--eiasm-card-border);
    background: var(--eiasm-card-bg);
    color: var(--eiasm-card-text);
    box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.05 );
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.4;
}

.eiasm-ppb *,
.eiasm-ppb *::before,
.eiasm-ppb *::after {
    box-sizing: border-box;
}

.eiasm-ppb__inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 100%;
}

@media ( min-width: 768px ) {
    .eiasm-ppb__inner {
        flex-direction: row;
    }
}

/* ─── LEFT PANE — DATA GRID ──────────────────────────────────────────── */

.eiasm-ppb__data {
    flex: 1;
    padding: 24px;
    border-bottom: 1px solid var(--eiasm-card-divider);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media ( min-width: 768px ) {
    .eiasm-ppb__data {
        padding: 40px;
        border-bottom: 0;
    }

    .eiasm-ppb--with-divider .eiasm-ppb__data {
        border-right: 1px solid var(--eiasm-card-divider);
    }
}

@media ( min-width: 1024px ) {
    .eiasm-ppb__data {
        padding: 48px;
    }
}

.eiasm-ppb__heading {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 32px;
    color: var(--eiasm-card-text);
}

@media ( min-width: 768px ) {
    .eiasm-ppb__heading {
        font-size: 24px;
    }
}

.eiasm-ppb__grid {
    display: grid;
    grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
    column-gap: 32px;
    row-gap: 32px;
}

@media ( min-width: 768px ) {
    .eiasm-ppb__grid {
        row-gap: 40px;
    }
}

.eiasm-ppb__cell {
    display: flex;
    flex-direction: column;
}

.eiasm-ppb__cell-label {
    font-size: 11px;
    color: var(--eiasm-card-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.12em;
    line-height: 1;
    margin-bottom: 8px;
}

.eiasm-ppb__cell-value {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--eiasm-card-text);
}

@media ( min-width: 768px ) {
    .eiasm-ppb__cell-value {
        font-size: 16px;
    }
}

.eiasm-ppb__cell-value--accent {
    color: var(--eiasm-card-accent);
}

/* ─── RIGHT PANE — PRICING + CTAs ────────────────────────────────────── */

.eiasm-ppb__pricing {
    width: 100%;
    flex-shrink: 0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: 1px solid var(--eiasm-card-divider);
    position: relative;
    overflow: hidden;
    background: rgba( 248, 250, 252, 0.2 );
}

@media ( min-width: 768px ) {
    .eiasm-ppb__pricing {
        width: 380px;
        padding: 32px;
        border-top: 0;
    }

    .eiasm-ppb--with-divider .eiasm-ppb__pricing {
        border-left: 1px solid var(--eiasm-card-divider);
    }
}

@media ( min-width: 1024px ) {
    .eiasm-ppb__pricing {
        border-top-right-radius: 12px;
        border-bottom-right-radius: 12px;
    }
}

/* Faint primary blob — visible only when a campaign is active. */
.eiasm-ppb__pricing--has-campaign::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 192px;
    height: 192px;
    background: var(--eiasm-card-primary);
    opacity: 0.03;
    filter: blur( 48px );
    border-radius: 50%;
    pointer-events: none;
}

/* ─── REGULAR PRICING (no campaign) ──────────────────────────────────── */

.eiasm-ppb__plain-price {
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.eiasm-ppb__plain-price-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    opacity: 0.6;
    margin-bottom: 8px;
    color: var(--eiasm-card-text);
}

.eiasm-ppb__plain-price-value {
    font-size: 36px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--eiasm-card-text);
}

/* ─── CAMPAIGN CERTIFICATE BLOCK ─────────────────────────────────────── */

.eiasm-ppb__cert {
    position: relative;
    z-index: 1;
    background: var(--eiasm-card-bg);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid color-mix( in srgb, var(--eiasm-card-primary) 15%, transparent );
    box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.06 );
    overflow: hidden;
}

/* Top metallic bar. */
.eiasm-ppb__cert::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background:
        linear-gradient( to right,
            var(--eiasm-card-bg) 0%,
            var(--eiasm-card-primary) 50%,
            var(--eiasm-card-bg) 100%
        );
    opacity: 0.8;
}

.eiasm-ppb__cert-body {
    padding: 20px;
}

@media ( min-width: 640px ) {
    .eiasm-ppb__cert-body {
        padding: 24px;
    }
}

.eiasm-ppb__cert-head {
    text-align: center;
    margin-bottom: 16px;
}

.eiasm-ppb__cert-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--eiasm-card-banner-bg);
    border: 1px solid color-mix( in srgb, var(--eiasm-card-primary) 10%, transparent );
    color: var(--eiasm-card-primary);
    margin-bottom: 10px;
}

.eiasm-ppb__cert-pill svg {
    width: 14px;
    height: 14px;
}

.eiasm-ppb__cert-pill-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.eiasm-ppb__cert-valid {
    font-size: 11px;
    font-weight: 500;
    color: var(--eiasm-card-muted);
    letter-spacing: 0.02em;
}

.eiasm-ppb__cert-valid-date {
    font-weight: 700;
    color: var(--eiasm-card-text);
}

.eiasm-ppb__cert-savings {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-top: 1px solid color-mix( in srgb, var(--eiasm-card-primary) 10%, transparent );
    border-bottom: 1px solid color-mix( in srgb, var(--eiasm-card-primary) 10%, transparent );
    padding: 16px 0;
    margin: 0 8px;
    background:
        linear-gradient( to bottom,
            transparent 0%,
            color-mix( in srgb, var(--eiasm-card-banner-bg) 50%, transparent ) 50%,
            transparent 100%
        );
}

.eiasm-ppb__cert-savings-label {
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--eiasm-card-primary);
    margin-bottom: 6px;
}

.eiasm-ppb__cert-savings-value {
    font-size: 36px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: var(--eiasm-card-primary);
    filter: drop-shadow( 0 2px 2px rgba( 0, 0, 0, 0.05 ) );
    line-height: 1;
}

@media ( min-width: 640px ) {
    .eiasm-ppb__cert-savings-value {
        font-size: 48px;
    }
}

.eiasm-ppb__cert-fees {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    margin-top: 16px;
}

.eiasm-ppb__cert-fee-col {
    display: flex;
    flex-direction: column;
}

.eiasm-ppb__cert-fee-col--right {
    text-align: right;
    align-items: flex-end;
}

.eiasm-ppb__cert-fee-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    color: var(--eiasm-card-muted);
    margin-bottom: 2px;
}

.eiasm-ppb__cert-fee-label--accent {
    color: var(--eiasm-card-primary);
}

.eiasm-ppb__cert-regular {
    font-size: 13px;
    text-decoration: line-through;
    text-decoration-color: color-mix( in srgb, var(--eiasm-card-primary) 40%, transparent );
    font-weight: 500;
    color: var(--eiasm-card-muted);
}

.eiasm-ppb__cert-effective {
    font-size: 18px;
    font-weight: 700;
    color: var(--eiasm-card-text);
    line-height: 1;
}

/* ─── CTAs ───────────────────────────────────────────────────────────── */

.eiasm-ppb__ctas {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/*
 * @since 1.14.2 — Cascade defense against Elementor kit-level link styles.
 *
 * Same root cause as the PSC sibling stylesheet: the CTA is an <a>, so it's
 * hit by Elementor's `.elementor-kit-XX a { color: ... }` (specificity 0,1,1)
 * which outranks single-class selectors like `.eiasm-ppb__cta--primary`
 * (0,1,0) and turns the white button text teal-on-teal. Same `.elementor a`
 * reset for `box-shadow` and `text-decoration`.
 *
 * Fix: scope under `.eiasm-ppb` AND chain modifier with base class. Base
 * rules become (0,3,0), interaction rules (0,4,0) — beats today's override
 * and any future Site Settings → Theme Style → Buttons configuration.
 * No `!important`; override ladder preserved.
 *
 * Do NOT "simplify" this back to single-class selectors. See post-launch
 * track §3.1 — and keep this in sync with programme-summary-card.css.
 */
.eiasm-ppb .eiasm-ppb__cta {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition:
        background-color 0.3s ease,
        color            0.3s ease,
        box-shadow       0.3s ease,
        transform        0.3s ease;
    box-sizing: border-box;
    cursor: pointer;
}

.eiasm-ppb .eiasm-ppb__cta.eiasm-ppb__cta--primary {
    background: var(--eiasm-card-cta-bg);
    color: var(--eiasm-card-cta-fg);
    box-shadow: 0 4px 12px rgba( 0, 0, 0, 0.05 );
}

.eiasm-ppb .eiasm-ppb__cta.eiasm-ppb__cta--primary:hover,
.eiasm-ppb .eiasm-ppb__cta.eiasm-ppb__cta--primary:focus-visible {
    transform: translateY( -2px );
    box-shadow: 0 6px 20px color-mix( in srgb, var(--eiasm-card-primary) 20%, transparent );
    color: var(--eiasm-card-cta-fg);
}

.eiasm-ppb .eiasm-ppb__cta.eiasm-ppb__cta--ghost {
    background: transparent;
    color: var(--eiasm-card-primary);
    border: 1px solid var(--eiasm-card-primary);
}

.eiasm-ppb .eiasm-ppb__cta.eiasm-ppb__cta--ghost:hover,
.eiasm-ppb .eiasm-ppb__cta.eiasm-ppb__cta--ghost:focus-visible {
    background: color-mix( in srgb, var(--eiasm-card-primary) 5%, transparent );
    color: var(--eiasm-card-primary);
}
