/*
 * Elite Core - Premium Purchase Module CSS
 * Scoped under .ec-pm-* to avoid theme collisions.
 */

.ec-pm-wrap {
    --ec-pm-bg: #ffffff;
    --ec-pm-surface: #fafaf7;
    --ec-pm-border: #e8e4d9;
    --ec-pm-border-strong: #d4cdb8;
    --ec-pm-text: #0a0a0a;
    --ec-pm-text-light: #6b6b6b;
    --ec-pm-text-muted: #999999;
    --ec-pm-gold: #C9A961;
    --ec-pm-gold-soft: #C9A961;
    --ec-pm-teal: #B8954D;
    --ec-pm-success: #C9A961;
    --ec-pm-radius: 14px;
    --ec-pm-radius-sm: 8px;
    --ec-pm-shadow: 0 1px 2px rgba(15,17,22,0.04), 0 4px 12px rgba(15,17,22,0.04);
    --ec-pm-shadow-hover: 0 6px 18px rgba(15,17,22,0.08);

    margin-top: 20px;
    color: var(--ec-pm-text);
    font-family: inherit;
}

.ec-pm-wrap *,
.ec-pm-wrap *::before,
.ec-pm-wrap *::after { box-sizing: border-box; }

.ec-pm-block { margin-top: 22px; }

.ec-pm-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ec-pm-text-light);
    margin-bottom: 10px;
}

/* ============== PRICE ============== */
.ec-pm-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}
.ec-pm-price-current {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ec-pm-text);
}
.ec-pm-price-current .woocommerce-Price-amount { font-weight: 700; }
.ec-pm-price-note {
    font-size: 13px;
    color: var(--ec-pm-text-muted);
}

/* ============== DOSAGE PILL ============== */
.ec-pm-pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ec-pm-pill {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--ec-pm-border);
    background: var(--ec-pm-surface);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ec-pm-text);
    transition: all .2s ease;
}
.ec-pm-pill-active {
    background: var(--ec-pm-text);
    color: #fff;
    border-color: var(--ec-pm-text);
}

/* ============== QUANTITY ============== */
.ec-pm-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--ec-pm-border);
    border-radius: var(--ec-pm-radius-sm);
    background: #fff;
    overflow: hidden;
    width: fit-content;
}
.ec-pm-qty-btn {
    width: 42px;
    height: 44px;
    background: transparent;
    border: 0;
    font-size: 18px;
    color: var(--ec-pm-text);
    cursor: pointer;
    transition: background .15s ease;
}
.ec-pm-qty-btn:hover { background: var(--ec-pm-surface); }
.ec-pm-qty-btn:active { background: var(--ec-pm-border); }
.ec-pm-qty-input {
    width: 56px;
    height: 44px;
    border: 0;
    border-left: 1px solid var(--ec-pm-border);
    border-right: 1px solid var(--ec-pm-border);
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--ec-pm-text);
    background: #fff;
    -moz-appearance: textfield;
    appearance: textfield;
}
.ec-pm-qty-input::-webkit-outer-spin-button,
.ec-pm-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ec-pm-qty-input:focus { outline: 2px solid var(--ec-pm-gold-soft); outline-offset: -1px; }

/* ============== BUNDLES ============== */
.ec-pm-bundles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.ec-pm-bundle {
    position: relative;
    background: #fff;
    border: 1.5px solid var(--ec-pm-border);
    border-radius: var(--ec-pm-radius);
    padding: 14px 10px 12px;
    cursor: pointer;
    text-align: center;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
    font-family: inherit;
    color: var(--ec-pm-text);
    box-shadow: var(--ec-pm-shadow);
}
.ec-pm-bundle:hover {
    border-color: var(--ec-pm-gold-soft);
    box-shadow: var(--ec-pm-shadow-hover);
    transform: translateY(-1px);
}
.ec-pm-bundle-active {
    border-color: var(--ec-pm-text);
    box-shadow: 0 0 0 2px var(--ec-pm-text), var(--ec-pm-shadow-hover);
}
.ec-pm-bundle-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1;
}
.ec-pm-bundle-badge-popular {
    background: var(--ec-pm-text);
    color: #fff;
}
.ec-pm-bundle-badge-best {
    background: var(--ec-pm-gold);
    color: #fff;
}
.ec-pm-bundle-thumbs {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    height: 56px;
    margin-bottom: 8px;
}
.ec-pm-bundle-thumbs img {
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    background: #f6f5f1;
    border-radius: 6px;
    padding: 4px;
}
.ec-pm-bundle-thumbs-2 img { height: 90%; }
.ec-pm-bundle-thumbs-3 img { height: 80%; }
.ec-pm-bundle-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ec-pm-bundle-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ec-pm-text);
}
.ec-pm-bundle-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--ec-pm-text);
}
.ec-pm-bundle-price .woocommerce-Price-amount { font-weight: 700; }
.ec-pm-bundle-save {
    font-size: 11px;
    font-weight: 600;
    color: var(--ec-pm-success);
    min-height: 14px;
}
.ec-pm-bundle-note {
    font-size: 11.5px;
    color: var(--ec-pm-text-muted);
    margin: 10px 0 0;
    line-height: 1.5;
}

/* ============== COA + ADD TO CART ============== */
.ec-pm-cart-form { margin-top: 22px; }
.ec-pm-cart-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
}
.ec-pm-coa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 18px;
    height: 54px;
    background: #fff;
    border: 1.5px solid var(--ec-pm-border-strong);
    border-radius: 12px;
    color: var(--ec-pm-text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-decoration: none;
    transition: all .2s ease;
    cursor: pointer;
}
.ec-pm-coa-btn:hover {
    background: var(--ec-pm-surface);
    border-color: var(--ec-pm-text);
    color: var(--ec-pm-text);
}
.ec-pm-coa-btn svg { color: var(--ec-pm-gold); flex-shrink: 0; }
.ec-pm-add-btn {
    height: 54px;
    width: 100%;
    background: var(--ec-pm-text);
    color: #fff;
    border: 1.5px solid var(--ec-pm-text);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all .2s ease;
    box-shadow: 0 4px 14px rgba(10,10,10,0.18);
    font-family: inherit;
}
.ec-pm-add-btn:hover {
    background: #1c1c1c;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(10,10,10,0.25);
}
.ec-pm-add-btn:active {
    transform: translateY(0);
}

/* ============== SUBTOTAL ============== */
.ec-pm-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 14px;
    padding: 12px 16px;
    background: var(--ec-pm-surface);
    border-radius: 10px;
    border: 1px solid var(--ec-pm-border);
}
.ec-pm-subtotal-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ec-pm-text-light);
}
.ec-pm-subtotal-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--ec-pm-text);
}
.ec-pm-subtotal-value .woocommerce-Price-amount { font-weight: 700; }

/* ============== TRUST ROW ============== */
.ec-pm-trust {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--ec-pm-border);
}
.ec-pm-trust-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.ec-pm-trust-item svg {
    flex-shrink: 0;
    color: var(--ec-pm-gold);
    margin-top: 2px;
}
.ec-pm-trust-text {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}
.ec-pm-trust-text strong {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ec-pm-text);
}
.ec-pm-trust-text span {
    font-size: 11px;
    color: var(--ec-pm-text-muted);
}

/* ============== MOBILE ============== */
@media (max-width: 640px) {
    .ec-pm-bundles { grid-template-columns: 1fr; gap: 14px; }
    .ec-pm-bundle { padding: 16px; }
    .ec-pm-bundle-thumbs { height: 60px; }
    .ec-pm-cart-row { grid-template-columns: 1fr; }
    .ec-pm-coa-btn { width: 100%; }
    .ec-pm-add-btn { font-size: 13px; }
    .ec-pm-trust { grid-template-columns: 1fr; gap: 12px; }
    .ec-pm-price-current { font-size: 28px; }
    .ec-pm-bundle-badge { font-size: 9px; padding: 3px 8px; }
}

/* ==============================================================
   MOBILE POLISH v1.2.0 (2026-07-06)
   Fixes iOS Safari issues on the PDP purchase module:
   - Touch targets meet Apple HIG 44pt minimum
   - Input font 16px prevents Safari auto-zoom on focus
   - Prices and subtotal never overflow narrow screens
   - Add to Cart width locked so "Adding..."/"Added" swap does
     not cause layout shift
   - Safe-area-inset applied to sticky bar so home indicator
     does not overlap CTA on iPhone X and newer.
   Reversible: delete this block (or restore .bak-20260706-*).
   ============================================================== */
@media (max-width: 640px) {
    /* Container: nothing escapes the viewport horizontally. */
    .ec-pm-wrap {
        max-width: 100%;
        overflow-x: clip;
        box-sizing: border-box;
    }

    /* Quantity stepper: larger, full width of its row. */
    .ec-pm-qty {
        display: flex;
        width: 100%;
        max-width: 100%;
    }
    .ec-pm-qty-btn {
        flex: 0 0 56px;
        width: 56px;
        height: 52px;
        font-size: 22px;
        line-height: 1;
    }
    .ec-pm-qty-input {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        height: 52px;
        /* 16px is the magic number: any lower triggers iOS Safari
           auto-zoom on focus, which yanks the layout around. */
        font-size: 16px;
    }

    /* COA button matches the new stepper height. */
    .ec-pm-coa-btn {
        height: 52px;
        font-size: 14px;
    }

    /* Add to Cart: meets 44pt touch minimum, no width jitter
       when the label swaps between "Add to Cart" and "Added". */
    .ec-pm-add-btn {
        height: 56px;
        min-height: 56px;
        width: 100%;
        min-width: 100%;
        font-size: 14px;
        white-space: nowrap;
    }

    /* Subtotal row: wrap gracefully instead of pushing offscreen
       when the qty (and therefore the total) gets long. */
    .ec-pm-subtotal {
        flex-wrap: wrap;
        gap: 6px 12px;
    }
    .ec-pm-subtotal-value {
        text-align: right;
        font-size: 17px;
        white-space: nowrap;
    }

    /* Prices never break across lines mid-number. */
    .ec-pm-price-current,
    .ec-pm-bundle-price .woocommerce-Price-amount,
    .woocommerce-Price-amount { white-space: nowrap; }
}

/* Sticky mobile bar (in the theme): respect the iPhone home
   indicator so the CTA is not covered on iPhone X and newer.
   Kept here for reversibility so all the mobile fixes live in
   one file. */
@supports (padding: env(safe-area-inset-bottom)) {
    .ec-sticky-bar-inner {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

/* Hide the legacy buy-box markup if it leaks through (defensive). */
.product-details > form.ec-add-to-cart-form { display: none !important; }

/* ============== OUT OF STOCK STATE ============== */
.ec-pm-oos {
    margin-top: 22px;
    padding: 12px 16px;
    background: rgba(201,169,97,0.08);
    border: 1px solid rgba(201,169,97,0.10);
    border-radius: 10px;
    color: #B8954D;
    font-size: 12.5px;
    font-weight: 500;
}
.ec-pm-add-btn-disabled,
.ec-pm-add-btn[disabled] {
    background: #c4c4c4 !important;
    border-color: #c4c4c4 !important;
    color: #ffffff !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
}
.ec-pm-add-btn-disabled:hover,
.ec-pm-add-btn[disabled]:hover {
    background: #c4c4c4 !important;
    transform: none !important;
    box-shadow: none !important;
}
