/*
 * MSP Checkout — brand foundation.
 *
 * Tokens + utility classes used by the WC chrome and override templates.
 * Mirrors resources/views/layouts/app.blade.php on the Laravel side so the
 * design system stays single-sourced (any future tweak should land on both).
 *
 * Scoped narrowly: only emits styles on `.msp-wc-page` body — never bleeds
 * onto non-WC pages where the parent Essentials theme is still in charge.
 */

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
    --msp-bg:           #FAF6EF;
    --msp-surface:      #FFFFFF;
    --msp-ink:          #1A1A22;
    --msp-ink-soft:     #4B4B5A;
    --msp-mute:         #8C8C99;
    --msp-line:         #ECE5D6;
    --msp-accent:       #E04FC8;
    --msp-accent-2:     #FF8E6E;
    --msp-accent-3:     #7C6BFF;
    --msp-accent-soft:  #FBE0F4;
    --msp-success:      #16A34A;
    --msp-danger:       #E11D48;

    /* Shell widths + spacing */
    --msp-shell-max:    1180px;
    --msp-radius-card:  20px;
    --msp-radius-pill:  9999px;

    /* Type scale */
    --msp-display-1:    clamp(2.4rem, 4vw + 1rem, 4rem);
    --msp-display-2:    clamp(1.8rem, 2vw + 1rem, 2.6rem);
    --msp-body:         16px;
}

/* ── Page baseline ──────────────────────────────────────────────────── */
body.msp-wc-page {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
    background: var(--msp-bg);
    color: var(--msp-ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.55;
    margin: 0;
}

body.msp-wc-page * { box-sizing: border-box; }

/* Display font — opt-in via .msp-display class or the auto rule below. */
.msp-display,
body.msp-wc-page h1,
body.msp-wc-page h2,
body.msp-wc-page .msp-h-display {
    font-family: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
    letter-spacing: -0.015em;
    line-height: 1.1;
    color: var(--msp-ink);
}

/* Shell — consistent gutter + max-width across header, main, footer. */
.msp-shell {
    max-width: var(--msp-shell-max);
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}
@media (min-width: 768px) {
    .msp-shell { padding-left: 32px; padding-right: 32px; }
}

/* ── Header ─────────────────────────────────────────────────────────── */
.msp-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(250, 246, 239, 0.92);
    backdrop-filter: saturate(160%) blur(8px);
    -webkit-backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--msp-line);
}
.msp-header-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    /* Row grows with whatever logo height the admin sets. The min-height
       keeps the bar comfortable when only the wordmark fallback shows. */
    min-height: 72px;
    padding-top: 12px; padding-bottom: 12px;
}
.msp-logo { color: var(--msp-ink); text-decoration: none; flex-shrink: 0; }
.msp-logo img { display: block; max-height: none; } /* no cap — admin controls height */
.msp-wordmark {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800; font-size: 20px; letter-spacing: -0.015em;
}
.msp-gradient-text {
    background: linear-gradient(135deg, var(--msp-accent-3), var(--msp-accent), var(--msp-accent-2));
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    font-weight: 900;
}

.msp-nav { display: none; align-items: center; gap: 36px; }
@media (min-width: 900px) {
    .msp-nav { display: inline-flex; }
}
.msp-nav-link {
    color: var(--msp-ink-soft); text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: color 0.2s;
}
.msp-nav-link:hover { color: var(--msp-ink); }

.msp-cart-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px 8px 12px;
    border-radius: var(--msp-radius-pill);
    border: 1px solid var(--msp-line);
    background: var(--msp-surface);
    color: var(--msp-ink); text-decoration: none;
    font-size: 13px; font-weight: 600;
    transition: border-color 0.2s, color 0.2s;
}
.msp-cart-pill:hover { border-color: var(--msp-ink); }
.msp-cart-pill .msp-icon { width: 18px; height: 18px; }
.msp-cart-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 9999px;
    background: var(--msp-accent); color: #fff;
    font-size: 11px; font-weight: 700;
}
.msp-cart-count[data-count="0"] { display: none; }

/* Right cluster — wrapper for language switch + cart pill. */
.msp-header-right { display: inline-flex; align-items: center; gap: 10px; }

/* EN/AR pill — same visual language as the cart pill so they read as one
   group. Active option is filled ink, inactive is muted so it never
   competes with the primary action. */
.msp-lang-switch {
    display: inline-flex; align-items: center;
    padding: 3px;
    border-radius: var(--msp-radius-pill);
    border: 1px solid var(--msp-line);
    background: var(--msp-surface);
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.04em;
}
.msp-lang-opt {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; padding: 5px 10px;
    border-radius: 9999px;
    color: var(--msp-ink-soft);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.msp-lang-opt:hover { color: var(--msp-ink); }
.msp-lang-opt.is-active {
    background: var(--msp-ink);
    color: var(--msp-bg);
}

/* RTL chrome — mirror the header layout when the active locale is Arabic.
   The body class is added by the `body_class` filter in functions.php so
   even when WP's site language stays English (and the theme isn't auto-
   RTL'd by WP), our own layout flips correctly. */
body.msp-rtl,
body.rtl {
    direction: rtl;
}
body.msp-rtl .msp-header-row,
body.rtl .msp-header-row {
    direction: rtl;
}
body.msp-rtl .msp-display,
body.rtl .msp-display {
    font-family: 'Tajawal', 'Bricolage Grotesque', sans-serif;
}

/* ── Main ───────────────────────────────────────────────────────────── */
.msp-main { padding: 48px 0 80px; min-height: 60vh; }
@media (min-width: 768px) { .msp-main { padding: 64px 0 96px; } }

.msp-page-title { margin-bottom: 32px; }
.msp-page-title h1 {
    font-size: var(--msp-display-1);
    margin: 0;
}

/* ── Cards / surfaces ───────────────────────────────────────────────── */
.msp-card {
    background: var(--msp-surface);
    border: 1px solid var(--msp-line);
    border-radius: var(--msp-radius-card);
    padding: 28px;
}
@media (min-width: 768px) { .msp-card { padding: 36px; } }

.msp-card-dark {
    background: var(--msp-ink);
    color: var(--msp-bg);
    border: none;
    border-radius: var(--msp-radius-card);
    padding: 28px;
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.msp-btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 28px;
    border-radius: var(--msp-radius-pill);
    background: linear-gradient(135deg, var(--msp-accent-3) 0%, var(--msp-accent) 55%, var(--msp-accent-2) 100%);
    color: #fff !important;
    font-size: 14px; font-weight: 700;
    border: none;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.18s, transform 0.05s;
    box-shadow: 0 6px 18px rgba(224, 79, 200, 0.18);
}
.msp-btn-primary:hover { opacity: 0.94; }
.msp-btn-primary:active { transform: scale(0.985); }
.msp-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.msp-btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 24px;
    border-radius: var(--msp-radius-pill);
    background: transparent;
    color: var(--msp-ink);
    font-size: 14px; font-weight: 600;
    border: 1px solid var(--msp-line);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.18s;
}
.msp-btn-ghost:hover { border-color: var(--msp-ink-soft); }

/* ── Footer ─────────────────────────────────────────────────────────── */
.msp-footer {
    margin-top: 80px;
    padding: 40px 0 32px;
    background: var(--msp-surface);
    border-top: 1px solid var(--msp-line);
}
/* ── Footer: trust strip ─────────────────────────────────────────────── */
.msp-trust {
    list-style: none; padding: 0; margin: 0 0 48px;
    display: grid; grid-template-columns: 1fr; gap: 14px;
    /* Breathing room between the cards and the divider line below. */
    padding-bottom: 56px;
    border-bottom: 1px solid var(--msp-line);
}
@media (min-width: 700px) {
    .msp-trust { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}
.msp-trust li {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 16px;
    background: var(--msp-bg);
    border: 1px solid var(--msp-line);
    border-radius: 14px;
}
.msp-trust .msp-trust-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(124,107,255,0.12), rgba(224,79,200,0.12));
    color: var(--msp-accent);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.msp-trust .msp-trust-icon svg { width: 22px; height: 22px; }
.msp-trust .msp-trust-title {
    margin: 0;
    font-size: 13px; font-weight: 700;
    color: var(--msp-ink);
}
.msp-trust .msp-trust-meta {
    margin: 2px 0 0;
    font-size: 12px; color: var(--msp-ink-soft);
}

/* ── Footer: main grid ───────────────────────────────────────────────── */
.msp-footer-grid {
    display: grid; grid-template-columns: 1fr; gap: 36px;
    margin-bottom: 36px;
}
@media (min-width: 800px) {
    .msp-footer-grid { grid-template-columns: 1.6fr 1fr 1fr; gap: 56px; }
}
.msp-footer-brand .msp-footer-tagline {
    margin: 0;
    font-size: 14px; line-height: 1.6;
    color: var(--msp-ink-soft);
    max-width: 360px;
}
.msp-footer-col { margin: 0; }
.msp-footer-eyebrow {
    margin: 0 0 14px;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--msp-mute);
}
.msp-footer-links-list {
    list-style: none; padding: 0; margin: 0;
    display: grid; gap: 10px;
}
.msp-footer-links-list a {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--msp-ink-soft); text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: color 0.18s, transform 0.18s;
}
.msp-footer-links-list a:hover {
    color: var(--msp-ink);
    transform: translateX(2px);
}
.msp-inline-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px;
    color: var(--msp-accent);
}
.msp-inline-icon svg { width: 18px; height: 18px; }

.msp-footer-meta {
    border-top: 1px solid var(--msp-line);
    padding-top: 24px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    font-size: 12px; color: var(--msp-mute);
}
.msp-footer-links { display: inline-flex; gap: 20px; flex-wrap: wrap; }
.msp-footer-links a {
    color: var(--msp-mute); text-decoration: none;
    transition: color 0.2s;
}
.msp-footer-links a:hover { color: var(--msp-ink); }

/* ── Header: checkout-flow progress indicator ────────────────────────── */
.msp-steps {
    padding: 12px 24px 16px;
    border-top: 1px solid var(--msp-line);
    background: rgba(250, 246, 239, 0.7);
}
@media (min-width: 768px) { .msp-steps { padding: 14px 32px 18px; } }
.msp-steps-list {
    list-style: none; padding: 0; margin: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.msp-step {
    display: flex; align-items: center; gap: 10px;
    font-size: 12px; font-weight: 600;
    color: var(--msp-mute);
    position: relative;
}
.msp-step::after {
    content: ''; position: absolute;
    top: 50%; right: -12px; transform: translateY(-50%);
    width: 12px; height: 1px;
    background: var(--msp-line);
    display: none;
}
@media (min-width: 600px) { .msp-step::after { display: block; } }
.msp-step:last-child::after { display: none; }

.msp-step-pip {
    width: 24px; height: 24px;
    border-radius: 9999px;
    border: 1.5px solid var(--msp-line);
    background: #fff;
    color: var(--msp-mute);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
    transition: all 0.2s;
}
.msp-step-pip svg { width: 12px; height: 12px; }
.msp-step-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 600px) {
    .msp-step-label { display: none; }
    .msp-steps-list { justify-content: center; }
}
.msp-step-active .msp-step-pip {
    background: linear-gradient(135deg, var(--msp-accent-3), var(--msp-accent));
    border-color: var(--msp-accent);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(224, 79, 200, 0.15);
}
.msp-step-active { color: var(--msp-ink); }
.msp-step-done .msp-step-pip {
    background: var(--msp-success);
    border-color: var(--msp-success);
    color: #fff;
}
.msp-step-done { color: var(--msp-ink-soft); }

/* ── Empty cart ──────────────────────────────────────────────────────── */
.msp-empty-cart {
    padding: 40px 0 32px;
}
.msp-empty-card {
    max-width: 640px; margin: 0 auto;
    background: var(--msp-surface);
    border: 1px solid var(--msp-line);
    border-radius: 28px;
    padding: 48px 28px 44px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
@media (min-width: 700px) { .msp-empty-card { padding: 56px 48px 48px; } }

.msp-empty-card::before {
    content: ''; position: absolute;
    top: -80px; left: 50%; transform: translateX(-50%);
    width: 320px; height: 160px;
    background: radial-gradient(circle, rgba(224,79,200,0.14), transparent 70%);
    pointer-events: none;
}

/* CSS book stack illustration */
.msp-empty-art {
    position: relative;
    width: 140px; height: 110px;
    margin: 0 auto 28px;
}
.msp-book {
    position: absolute;
    border-radius: 8px;
    box-shadow: 0 10px 24px -10px rgba(0,0,0,0.18);
}
.msp-book-1 {
    left: 50%; top: 0;
    transform: translateX(-50%) rotate(-3deg);
    width: 84px; height: 100px;
    background: linear-gradient(135deg, var(--msp-accent-2), var(--msp-accent));
    z-index: 3;
}
.msp-book-1 .msp-book-spine {
    position: absolute; left: 8px; top: 12px; bottom: 12px;
    width: 1.5px; background: rgba(255,255,255,0.5);
    border-radius: 2px;
}
.msp-book-1 .msp-book-corner {
    position: absolute; right: 0; top: 0;
    width: 16px; height: 16px;
    background: linear-gradient(225deg, rgba(255,255,255,0.4) 50%, transparent 50%);
    border-radius: 0 8px 0 0;
}
.msp-book-2 {
    left: 4px; top: 10px;
    transform: rotate(-9deg);
    width: 78px; height: 96px;
    background: linear-gradient(135deg, var(--msp-accent-3), var(--msp-accent));
    z-index: 2;
    opacity: 0.85;
}
.msp-book-3 {
    right: 4px; top: 14px;
    transform: rotate(6deg);
    width: 74px; height: 90px;
    background: linear-gradient(135deg, #FFD27A, var(--msp-accent-2));
    z-index: 1;
    opacity: 0.75;
}

.msp-empty-title {
    font-size: clamp(2rem, 4vw + 1rem, 3rem);
    margin: 14px 0 14px;
}
.msp-empty-body {
    color: var(--msp-ink-soft);
    font-size: 16px; line-height: 1.65;
    max-width: 460px; margin: 0 auto;
}
.msp-empty-actions {
    margin: 32px 0 8px;
    display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.msp-empty-reassure {
    list-style: none; padding: 24px 0 0; margin: 32px 0 0;
    border-top: 1px solid var(--msp-line);
    display: grid; grid-template-columns: 1fr; gap: 10px;
    text-align: left;
}
@media (min-width: 600px) {
    .msp-empty-reassure { grid-template-columns: repeat(3, auto); justify-content: center; gap: 28px; }
}
.msp-empty-reassure li {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--msp-ink-soft);
    font-weight: 500;
}
.msp-empty-reassure .msp-icon { color: var(--msp-success); width: 16px; height: 16px; }

/* ── Cart / checkout sub-header copy ─────────────────────────────────── */
.msp-page-sub {
    margin: 8px 0 0;
    font-size: 15px;
    max-width: 580px;
}

/* ── Checkout reassurance strip (above the form) ─────────────────────── */
.msp-reassure-strip {
    list-style: none; padding: 0; margin: 0 0 28px;
    display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media (min-width: 800px) {
    .msp-reassure-strip { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
.msp-reassure-strip li {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    background: var(--msp-surface);
    border: 1px solid var(--msp-line);
    border-radius: 12px;
    font-size: 13px; color: var(--msp-ink-soft); font-weight: 500;
}
.msp-reassure-strip .msp-icon { color: var(--msp-accent); width: 18px; height: 18px; flex-shrink: 0; }

/* ── Thank-you timeline ──────────────────────────────────────────────── */
.msp-timeline-wrap {
    margin: 40px auto 0;
    max-width: 560px;
    text-align: left;
}
.msp-timeline-eyebrow {
    display: block;
    text-align: center;
    margin-bottom: 20px;
    color: var(--msp-accent);
}
.msp-timeline {
    list-style: none; padding: 0; margin: 0;
    position: relative;
}
.msp-timeline::before {
    content: ''; position: absolute;
    left: 13px; top: 14px; bottom: 14px;
    width: 2px; background: var(--msp-line);
    border-radius: 2px;
}
.msp-timeline-step {
    display: flex; gap: 16px; align-items: flex-start;
    padding: 6px 0 14px;
    position: relative;
}
.msp-timeline-dot {
    position: relative; z-index: 1;
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 9999px;
    background: var(--msp-surface);
    border: 2px solid var(--msp-line);
    color: var(--msp-mute);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.msp-timeline-dot svg { width: 14px; height: 14px; }
.msp-timeline-done .msp-timeline-dot {
    background: var(--msp-success);
    border-color: var(--msp-success);
    color: #fff;
}
.msp-timeline-active .msp-timeline-dot {
    background: linear-gradient(135deg, var(--msp-accent-3), var(--msp-accent));
    border-color: var(--msp-accent);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(224, 79, 200, 0.15);
    animation: msp-pulse 1.8s ease-out infinite;
}
@keyframes msp-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(224, 79, 200, 0.15); }
    50%      { box-shadow: 0 0 0 8px rgba(224, 79, 200, 0.06); }
}
.msp-timeline-title {
    margin: 0;
    font-size: 15px; font-weight: 700;
    color: var(--msp-ink);
}
.msp-timeline-meta {
    margin: 2px 0 0;
    font-size: 13px; color: var(--msp-ink-soft);
    line-height: 1.55;
}

.msp-thankyou-actions {
    margin-top: 32px;
    display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}

/* ── Icons ──────────────────────────────────────────────────────────── */
.msp-icon { width: 20px; height: 20px; stroke-width: 1.75; }

/* ── Small utility ──────────────────────────────────────────────────── */
.msp-eyebrow {
    display: inline-block;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--msp-accent);
}
.msp-mute { color: var(--msp-mute); }
.msp-soft { color: var(--msp-ink-soft); }
.msp-sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
