/*
 * Sapphire Loyalty customer UI.
 *
 * Everything is scoped under .sapphire2 so a Divi (or any other) theme keeps its
 * own typography and layout elsewhere on the page. Buttons use the sph-btn class
 * rather than the theme's .button so Divi's global button rules do not fight us,
 * and the few !important declarations below exist only where Divi sets the same
 * property globally with its own !important.
 */

.sapphire2 {
    --sph-forest: #143e32;
    --sph-forest-dark: #0d2b22;
    --sph-forest-soft: #235e4b;
    --sph-gold: #a57a25;
    --sph-gold-soft: #c9a15a;
    --sph-cream: #faf7ef;
    --sph-ink: #23342c;
    --sph-muted: #5d6b63;
    --sph-line: #e3ded1;
    --sph-surface: #ffffff;
    --sph-radius: 16px;
    --sph-shadow: 0 1px 2px rgba(20, 62, 50, .06), 0 12px 32px -18px rgba(20, 62, 50, .45);

    color: var(--sph-ink);
    font-size: 16px;
    line-height: 1.6;
    margin: 2rem 0;
    -webkit-font-smoothing: antialiased;
}
.sapphire2 *,
.sapphire2 *::before,
.sapphire2 *::after { box-sizing: border-box; }

.sapphire2 h2,
.sapphire2 h3,
.sapphire2 h4 { color: var(--sph-forest); line-height: 1.2; padding: 0; }
.sapphire2 h2 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.9rem, 3.6vw, 3rem); max-width: 22ch; margin: .35em 0; }
.sapphire2 h3 { font-size: 1.25rem; margin: 0 0 .75rem; }
.sapphire2 h4 { font-size: 1rem; margin: 0 0 .35rem; }
.sapphire2 p { margin: 0 0 .75rem; }
.sapphire2 ul, .sapphire2 ol { margin: 0; padding: 0; list-style: none; }

.sph-kicker { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--sph-gold); margin: 0 0 .35rem; }
.sph-lede { max-width: 65ch; color: var(--sph-muted); }
.sph-muted { color: var(--sph-muted); font-size: .875rem; }
.sph-note { font-size: .82rem; color: var(--sph-muted); border-top: 1px solid var(--sph-line); padding-top: 1rem; margin-top: 2rem; }

/* --------------------------------------------------------------- buttons */

.sapphire2 .sph-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    background: var(--sph-forest); color: #fff !important;
    border: 1px solid var(--sph-forest); border-radius: 999px;
    padding: .7rem 1.4rem; font-size: .9rem; font-weight: 600; line-height: 1.3;
    text-align: center; text-decoration: none !important; white-space: normal;
    cursor: pointer; transition: background .15s ease, transform .15s ease;
}
.sapphire2 .sph-btn:hover { background: var(--sph-forest-soft); border-color: var(--sph-forest-soft); transform: translateY(-1px); }
.sapphire2 .sph-btn-ghost { background: transparent; color: var(--sph-forest) !important; }
.sapphire2 .sph-btn-ghost:hover { background: rgba(20, 62, 50, .07); }
.sapphire2 .sph-btn-quiet {
    background: transparent; color: var(--sph-muted) !important;
    border-color: var(--sph-line); padding: .45rem 1rem; font-size: .8rem; font-weight: 500;
}
.sapphire2 .sph-btn-quiet:hover { background: var(--sph-cream); color: var(--sph-forest) !important; }
.sapphire2 .sph-link { color: var(--sph-forest); font-size: .85rem; text-decoration: underline; }
.sapphire2 .sph-membercard .sph-link { color: rgba(255, 255, 255, .92); }
.sapphire2 .sph-membercard .sph-link:hover { color: #fff; }
.sapphire2 .sph-form { margin: 0; }
.sapphire2 a:focus-visible,
.sapphire2 button:focus-visible { outline: 3px solid var(--sph-gold-soft); outline-offset: 3px; border-radius: 4px; }

/* WooCommerce wraps prices in nested spans and some themes make them block-level. */
.sapphire2 .woocommerce-Price-amount { white-space: nowrap; }
.sapphire2 .woocommerce-Price-amount,
.sapphire2 .woocommerce-Price-amount bdi,
.sapphire2 .woocommerce-Price-currencySymbol { display: inline; font-size: inherit; font-weight: inherit; color: inherit; }

/* ------------------------------------------------------------------ hero */

.sph-hero { padding: 0 0 1.5rem; }
.sph-chip {
    display: inline-block; background: var(--sph-cream); border: 1px solid var(--sph-line);
    border-radius: 999px; padding: .45rem 1rem; font-size: .85rem; color: var(--sph-ink);
}
.sph-chip-live { background: rgba(20, 62, 50, .07); border-color: rgba(20, 62, 50, .2); }

/* ------------------------------------------------------------- qualify */

.sph-qualify {
    background: linear-gradient(135deg, var(--sph-forest) 0%, var(--sph-forest-dark) 100%);
    color: #fff; border-radius: var(--sph-radius); padding: 1.6rem; margin-bottom: 2rem;
}
.sph-qualify h3 { color: #fff; font-size: 1.05rem; letter-spacing: .02em; }
.sph-qualify-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.25rem; }
.sph-qualify-grid > div { border-left: 2px solid rgba(255, 255, 255, .22); padding-left: .9rem; }
.sph-qualify-grid span { display: block; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.sph-qualify-grid strong { display: block; font-size: 1.7rem; color: #fff; line-height: 1.15; margin: .2rem 0; overflow-wrap: break-word; }
.sph-qualify-grid small { font-size: .78rem; opacity: .75; }
.sph-qualify-grid .sph-of { font-size: 1rem; opacity: .6; }
.sph-qualify-list { display: grid; gap: .5rem; margin-bottom: 1rem; }
.sph-qualify-list li { padding-left: 1.4rem; position: relative; }
.sph-qualify-list li::before { content: "◆"; position: absolute; left: 0; color: var(--sph-gold); font-size: .7rem; top: .35rem; }

/* --------------------------------------------------------------- packages */

.sph-packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.1rem; }
.sph-package {
    position: relative; display: flex; flex-direction: column;
    background: var(--sph-surface); border: 1px solid var(--sph-line);
    border-radius: var(--sph-radius); padding: 1.6rem 1.4rem; overflow-wrap: break-word;
    box-shadow: var(--sph-shadow); transition: transform .18s ease, box-shadow .18s ease;
}
.sph-package:hover { transform: translateY(-3px); box-shadow: 0 1px 2px rgba(20, 62, 50, .08), 0 20px 40px -20px rgba(20, 62, 50, .5); }
.sph-package.is-featured { border-color: var(--sph-gold-soft); }
.sph-package.is-current { border-color: var(--sph-forest); background: var(--sph-cream); }
.sph-flag {
    position: absolute; top: -.7rem; left: 1.4rem;
    background: var(--sph-gold); color: #fff; border-radius: 999px;
    font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 700;
    padding: .25rem .7rem; margin: 0;
}
.sph-flag-current { background: var(--sph-forest); }
.sph-price { font-size: 1.7rem; font-weight: 700; color: var(--sph-forest); margin: .6rem 0 1rem; line-height: 1.15; }
.sph-price small { display: block; font-size: .78rem; font-weight: 400; color: var(--sph-muted); letter-spacing: .02em; }
.sph-benefits { flex: 1; display: grid; gap: .55rem; margin-bottom: 1.25rem; font-size: .9rem; }
.sph-benefits li { display: flex; gap: .55rem; align-items: flex-start; }
.sph-benefits li > span:last-child { flex: 1; min-width: 0; }
.sph-benefits strong { font-weight: 700; color: var(--sph-ink); }
.sph-tick {
    flex: 0 0 auto; width: 1rem; height: 1rem; margin-top: .28rem; border-radius: 50%;
    background: rgba(20, 62, 50, .1); position: relative;
}
.sph-tick::after {
    content: ""; position: absolute; left: .3rem; top: .15rem; width: .28rem; height: .52rem;
    border: solid var(--sph-forest); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* ---------------------------------------------------------------- panels */

.sph-panel {
    background: var(--sph-surface); border: 1px solid var(--sph-line);
    border-radius: var(--sph-radius); padding: 1.5rem; margin: 2rem 0;
}
.sph-steps ol { counter-reset: sph-step; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.sph-steps li { counter-increment: sph-step; padding-left: 2.4rem; position: relative; }
.sph-steps li::before {
    content: counter(sph-step);
    position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; border-radius: 50%;
    background: var(--sph-forest); color: #fff; font-size: .8rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.sph-steps strong { display: block; color: var(--sph-forest); }
.sph-steps span { font-size: .87rem; color: var(--sph-muted); }

/* --------------------------------------------------------------- account */

.sph-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1.75rem; align-items: start; }
.sph-overview > .sph-membercard { max-width: 420px; }
.sph-membercard {
    position: relative; overflow: hidden; border-radius: 20px; color: #fff; padding: 1.6rem;
    background: linear-gradient(145deg, var(--sph-forest) 0%, var(--sph-forest-dark) 65%, #0a1f19 100%);
    box-shadow: 0 22px 45px -24px rgba(13, 43, 34, .85);
}
.sph-membercard::after {
    content: ""; position: absolute; inset: auto -30% -45% auto; width: 16rem; height: 16rem;
    border-radius: 50%; background: radial-gradient(circle, rgba(201, 161, 90, .35), transparent 65%);
    pointer-events: none;
}
.sph-membercard h3, .sph-membercard a { color: #fff; }
.sph-membercard-top { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.sph-membercard-brand { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; opacity: .8; margin: 0; }
.sph-membercard-tier { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--sph-gold-soft); margin: 0; font-weight: 700; }
.sph-membercard-name { font-size: 1.3rem; margin: .6rem 0 1rem; }
.sph-membercard-body { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.sph-qr { background: #fff; width: 132px; max-width: 100%; padding: 8px; border-radius: 10px; }
.sph-qr svg { display: block; width: 100%; height: auto; }
.sph-membercard-meta { display: grid; gap: .6rem; margin: 0; flex: 1; min-width: 130px; }
.sph-membercard-meta dt { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.sph-membercard-meta dd { margin: 0; font-size: .95rem; font-weight: 600; }
.sph-membercard-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.25rem; position: relative; z-index: 1; }
.sph-membercard-actions .sph-btn-quiet { color: rgba(255, 255, 255, .85) !important; border-color: rgba(255, 255, 255, .3); }
.sph-membercard-actions .sph-btn-quiet:hover { background: rgba(255, 255, 255, .12); color: #fff !important; }

.sph-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.sph-stats > div { background: var(--sph-cream); border: 1px solid var(--sph-line); border-radius: 14px; padding: 1rem 1.1rem; }
.sph-stats > div > span { display: block; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--sph-muted); }
.sph-stats strong { display: block; font-size: 1.6rem; color: var(--sph-forest); line-height: 1.2; margin: .25rem 0; overflow-wrap: break-word; }
.sph-stats strong span { display: inline; font-size: inherit; }
.sph-stats small { font-size: .76rem; color: var(--sph-muted); display: block; }
.sph-stats .sph-of { display: inline; font-size: .95rem; color: var(--sph-muted); }

.sph-progress { margin: .9rem 0; }
.sph-progress p { display: flex; justify-content: space-between; gap: 1rem; font-size: .8rem; color: var(--sph-muted); margin: 0 0 .35rem; }
.sph-bar { background: var(--sph-line); border-radius: 999px; height: .5rem; overflow: hidden; }
.sph-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--sph-forest), var(--sph-gold)); }

.sph-rewards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.sph-reward { border: 1px solid var(--sph-line); border-radius: 14px; padding: 1.1rem; background: var(--sph-cream); }
.sph-reward-rate { font-size: .87rem; color: var(--sph-muted); }
.sph-reward .sph-bar { margin-bottom: .8rem; }

/* ------------------------------------------------------------------ tabs */

.sph-tabs { margin: 2rem 0; }
.sph-tablist { display: flex; gap: .4rem; border-bottom: 1px solid var(--sph-line); flex-wrap: wrap; }
.sapphire2 .sph-tab {
    background: none; border: 0; border-bottom: 3px solid transparent;
    padding: .7rem 1rem; font-size: .92rem; font-weight: 600; color: var(--sph-muted);
    cursor: pointer; border-radius: 0;
}
.sapphire2 .sph-tab.is-active { color: var(--sph-forest); border-bottom-color: var(--sph-gold); }
.sph-tabpanel { padding-top: 1.25rem; }
.sph-pill {
    display: inline-block; background: var(--sph-gold); color: #fff; border-radius: 999px;
    font-size: .68rem; font-weight: 700; padding: .1rem .45rem; margin-left: .3rem; vertical-align: middle;
}

/* ---------------------------------------------------------------- tables */

.sph-table { overflow-x: auto; border: 1px solid var(--sph-line); border-radius: 14px; }
.sapphire2 .sph-table table { border-collapse: collapse; width: 100%; font-size: .9rem; margin: 0; background: var(--sph-surface); }
.sapphire2 .sph-table th,
.sapphire2 .sph-table td { text-align: left; padding: .85rem .9rem; border-bottom: 1px solid var(--sph-line); vertical-align: top; }
.sapphire2 .sph-table thead th { background: var(--sph-cream); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--sph-muted); }
.sapphire2 .sph-table tbody tr:last-child td { border-bottom: 0; }
.sapphire2 .sph-table tr.is-current { background: rgba(20, 62, 50, .05); }
.sph-credit { color: #17694f; font-weight: 600; white-space: nowrap; }
.sph-debit { color: #8a3b2a; font-weight: 600; white-space: nowrap; }
.sph-empty { color: var(--sph-muted); }
.sph-pager { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }

.sph-notice {
    display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start; flex-wrap: wrap;
    border: 1px solid var(--sph-line); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: .75rem;
}
.sph-notice.is-unread { border-left: 4px solid var(--sph-gold); background: var(--sph-cream); }

/* ------------------------------------------------- my-account dashboard */

.sph-compact { margin: 0 0 2rem; }
.sph-summary {
    display: grid; gap: 1rem; align-items: center;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    border: 1px solid var(--sph-line); border-left: 5px solid var(--sph-forest);
    border-radius: var(--sph-radius); padding: 1.25rem 1.4rem; background: var(--sph-surface);
}
.sph-summary-head h3 { margin: 0; }
.sph-stats-compact { margin: 0; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.sph-stats-compact > div { background: transparent; border: 0; padding: 0; }
.sph-stats-compact strong { font-size: 1.2rem; }

/* ------------------------------------------------- cart / checkout panel */

.sph-checkout {
    display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    border: 1px solid var(--sph-line); border-radius: var(--sph-radius);
    padding: 1.1rem 1.3rem; margin: 0 0 1.5rem; background: var(--sph-cream);
}
.sph-checkout-head { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.sph-checkout-head h3 { margin: 0; font-size: 1rem; }
.sph-checkout-item span { display: block; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--sph-muted); }
.sph-checkout-item strong { display: block; font-size: 1.15rem; color: var(--sph-forest); overflow-wrap: break-word; }
.sph-checkout-item small { font-size: .78rem; color: var(--sph-muted); }

/* ----------------------------------------------------------- responsive */

@media (max-width: 900px) {
    .sph-overview { grid-template-columns: 1fr; }
    .sph-membercard { max-width: 420px; }
    .sph-summary { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .sapphire2 { font-size: 15px; }
    .sph-packages { grid-template-columns: 1fr; }
    .sph-qualify-grid { gap: 1rem; }
    .sapphire2 .sph-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .sapphire2 .sph-table--stack tbody tr { display: block; border-bottom: 1px solid var(--sph-line); padding: .5rem 0; }
    .sapphire2 .sph-table--stack tbody td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .35rem .9rem; }
    .sapphire2 .sph-table--stack tbody td::before { content: attr(data-label); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--sph-muted); flex: 0 0 auto; }
    .sph-notice { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    .sapphire2 * { transition: none !important; }
}
@media print {
    .sph-tablist, .sph-pager, .sph-form { display: none; }
}

/* Customer onboarding and profile. */
.sph-account-shell { max-width: 1240px; margin: 48px auto; padding: 0 24px; }
.sph-profile { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 28px; }
.sph-profile dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; }
.sph-profile dd { margin: 4px 0 0; overflow-wrap: anywhere; font-weight: 600; }
.sph-package form .sph-btn { width: 100%; }
@media(max-width:600px) { .sph-profile { grid-template-columns: 1fr; } .sph-account-shell { margin: 24px auto; padding: 0 16px; } }

/* Account status badge and redemption summary (beta.5) */
.sph-status{display:flex;flex-direction:column;gap:.15rem;margin:.75rem 0 0;padding:.65rem .9rem;border-radius:10px;border:1px solid var(--sph-line,rgba(127,127,127,.35));background:rgba(127,127,127,.08)}
.sph-status span{font-size:.9em;opacity:.85}
.sph-status-active{border-color:#1f8a5b;background:rgba(31,138,91,.12)}
.sph-status-pending,.sph-status-queued{border-color:#b7791f;background:rgba(183,121,31,.12)}
.sph-status-review,.sph-status-expired{border-color:#c0392b;background:rgba(192,57,43,.1)}
.sph-redemptions{margin-top:1rem}
.sph-pending td{opacity:.8}
