/*
 * WP Loyalty Rewards — Customer Dashboard Stylesheet
 *
 * Scoped to #ld-root so nothing bleeds into the theme.
 * CSS custom properties for colours are injected inline by the shortcode
 * (class-shortcode.php) so this file stays static and browser-cacheable.
 *
 * Enqueued by WPLoyaltyPlugin::enqueue_frontend_assets()
 * when [loyalty_dashboard] shortcode is present.
 * ─────────────────────────────────────────────────────────────────────
 */


/* ══════════════════════════════════════════════════
   1. RESET & BASE
   ══════════════════════════════════════════════════ */

#ld-root *,
#ld-root *::before,
#ld-root *::after { box-sizing: border-box; }

#ld-root {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ld-text, #000000);
    max-width: 980px;
    margin: 0 auto;
}

#ld-root a            { color: var(--ld-link, #B2967C); }
#ld-root a:hover      { color: var(--ld-link-hover, #B8934A); }

/* Not-logged-in banner */
.ld-not-logged-in {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 20px 24px;
    color: #856404;
    font-family: sans-serif;
}


/* ══════════════════════════════════════════════════
   2. SKELETON SHIMMER
   ══════════════════════════════════════════════════ */

.ld-skel {
    background: linear-gradient(90deg, #e8e8e8 25%, #f4f4f4 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: ld-shimmer 1.4s infinite;
    border-radius: 6px;
    display: inline-block;
}
@keyframes ld-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ══════════════════════════════════════════════════
   3. LOADING SPINNER
   ══════════════════════════════════════════════════ */

#ld-loading {
    padding: 60px 0;
    text-align: center;
    color: var(--ld-muted, #8492a6);
    font-size: 14px;
}

.ld-spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid #eaecef;
    border-top-color: var(--ld-accent, #B8934A);
    border-radius: 50%;
    animation: ld-spin .7s linear infinite;
    margin-bottom: 14px;
}
@keyframes ld-spin { to { transform: rotate(360deg); } }


/* ══════════════════════════════════════════════════
   4. HERO CARD
   ══════════════════════════════════════════════════ */

.ld-hero {
    background: var(--ld-hero-bg, #1a1a2e);
    border-radius: 20px;
    padding: 48px 52px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
}

/* Decorative circles */
.ld-hero::before {
    content: '';
    position: absolute;
    top: -70px; right: -70px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .04);
}
.ld-hero::after {
    content: '';
    position: absolute;
    bottom: -90px; right: 90px;
    width: 180px; height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .03);
}

.ld-hero-left h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -.3px;
}
.ld-hero-left p {
    font-size: 14px;
    opacity: .6;
    margin-bottom: 22px;
}

.ld-loyalty-id {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .5px;
}
.ld-loyalty-id span { opacity: .6; font-weight: 400; }

.ld-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(72, 199, 142, .2);
    border: 1px solid rgba(72, 199, 142, .4);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #48c78e;
    margin-left: 10px;
}
.ld-status-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #48c78e;
    flex-shrink: 0;
}

/* Points ring */
.ld-hero-right {
    text-align: center;
    position: relative;
    z-index: 1;
}

.ld-points-ring {
    width: 148px; height: 148px;
    border-radius: 50%;
    background: conic-gradient(var(--ld-accent, #B8934A) var(--pct, 0turn), rgba(255, 255, 255, .08) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 12px rgba(184, 147, 74, .12);
}
.ld-points-inner {
    width: 118px; height: 118px;
    border-radius: 50%;
    background: var(--ld-hero-bg, #1a1a2e);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ld-points-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--ld-accent, #B8934A);
    line-height: 1;
}
.ld-points-lbl {
    font-size: 10px;
    opacity: .5;
    letter-spacing: .6px;
    text-transform: uppercase;
    margin-top: 4px;
}

.ld-brand {
    font-size: 11px;
    opacity: .35;
    margin-top: 10px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}


/* ══════════════════════════════════════════════════
   5. STATS STRIP
   ══════════════════════════════════════════════════ */

.ld-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.ld-stat-card {
    background: var(--ld-card-bg, #ffffff);
    border: 1px solid #eaecef;
    border-radius: 16px;
    padding: 26px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .2s, transform .2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}
.ld-stat-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, .09);
    transform: translateY(-2px);
}

/* Icon container — uniform square */
.ld-stat-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--ld-section-bg, #f7f8fa);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.ld-stat-icon svg {
    width: 18px; height: 18px;
    stroke: var(--ld-accent, #B8934A);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ld-stat-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--ld-text, #000000);
    line-height: 1;
}
.ld-stat-lbl {
    font-size: 11px;
    color: var(--ld-muted, #8492a6);
    text-transform: uppercase;
    letter-spacing: .6px;
}


/* ══════════════════════════════════════════════════
   6. CONTENT SECTIONS (shared card shell)
   ══════════════════════════════════════════════════ */

.ld-section {
    background: var(--ld-card-bg, #ffffff);
    border: 1px solid #eaecef;
    border-radius: 16px;
    padding: 32px 36px;
    margin-bottom: 22px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}

.ld-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ld-text, #000000);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: .6px;
}
.ld-section-title::before {
    content: '';
    width: 3px; height: 16px;
    background: var(--ld-accent, #B8934A);
    border-radius: 2px;
    flex-shrink: 0;
}


/* ══════════════════════════════════════════════════
   7. TIER PROGRESSION
   ══════════════════════════════════════════════════ */

.ld-tier-row {
    display: flex;
    align-items: center;
    gap: 18px;
}

/* Tier badge variants */
.ld-tier-badge {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .8px;
    padding: 6px 16px;
    border-radius: 20px;
    white-space: nowrap;
    text-transform: uppercase;
}
.ld-tier-BRONZE   { background: #fdebd0; color: #a04000; }
.ld-tier-SILVER   { background: #eaecef; color: #5d6d7e; }
.ld-tier-GOLD     { background: #fef9e7; color: #b7950b; border: 1px solid #f9e79f; }
.ld-tier-BLACK    { background: #1a1a2e; color: var(--ld-accent, #B8934A); }
.ld-tier-STANDARD { background: #f0f4f8; color: #4a5568; }
.ld-tier-default  { background: var(--ld-section-bg, #f7f8fa); color: var(--ld-muted, #8492a6); }

/* Progress track */
.ld-prog-track {
    flex: 1;
    height: 10px;
    background: #eaecef;
    border-radius: 5px;
    overflow: hidden;
}
.ld-prog-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ld-link, #B2967C), var(--ld-accent, #B8934A));
    border-radius: 5px;
    transition: width 1.2s cubic-bezier(.4, 0, .2, 1);
}
.ld-prog-meta {
    font-size: 12px;
    color: var(--ld-muted, #8492a6);
    white-space: nowrap;
    font-weight: 600;
}

.ld-pts-needed          { font-size: 13px; color: var(--ld-muted, #8492a6); margin-top: 12px; }
.ld-pts-needed strong   { color: var(--ld-text, #000000); }

/* Benefits grid */
.ld-benefits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}
.ld-benefits-col h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--ld-muted, #8492a6);
    margin-bottom: 14px;
}
.ld-benefit-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--ld-text, #000000);
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f4;
}
.ld-benefit-item:last-child { border-bottom: none; }

.ld-benefit-icon         { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.ld-benefit-icon svg     {
    width: 16px; height: 16px;
    stroke: var(--ld-accent, #B8934A);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* ══════════════════════════════════════════════════
   8. POINTS BREAKDOWN
   ══════════════════════════════════════════════════ */

.ld-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}

.ld-pt-item {
    background: var(--ld-section-bg, #f7f8fa);
    border-radius: 12px;
    padding: 20px 18px;
    border: 1px solid #eaecef;
}
.ld-pt-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--ld-text, #000000);
}
.ld-pt-lbl {
    font-size: 11px;
    color: var(--ld-muted, #8492a6);
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: .5px;
}


/* ══════════════════════════════════════════════════
   9. ENGAGEMENT
   ══════════════════════════════════════════════════ */

.ld-engage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 14px;
}
.ld-engage-item {
    text-align: center;
    background: var(--ld-section-bg, #f7f8fa);
    border-radius: 12px;
    padding: 22px 14px;
    border: 1px solid #eaecef;
}
.ld-engage-num {
    font-size: 26px;
    font-weight: 800;
    color: var(--ld-text, #000000);
}
.ld-engage-lbl {
    font-size: 11px;
    color: var(--ld-muted, #8492a6);
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: .5px;
}


/* ══════════════════════════════════════════════════
   10. ACCOUNT INFORMATION
   ══════════════════════════════════════════════════ */

.ld-account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px;
}
.ld-account-item {
    background: var(--ld-section-bg, #f7f8fa);
    border-radius: 12px;
    padding: 18px 20px;
    border: 1px solid #eaecef;
}
.ld-account-item label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--ld-muted, #8492a6);
    display: block;
    margin-bottom: 6px;
}
.ld-account-item span  {
    font-size: 14px;
    font-weight: 600;
    color: var(--ld-text, #000000);
}

.ld-verified   { color: #48c78e !important; }
.ld-unverified { color: #f14668 !important; }
.ld-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #48c78e;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}
.ld-verified-badge svg {
    width: 12px;
    height: 12px;
    fill: #fff;
    flex-shrink: 0;
}


/* ══════════════════════════════════════════════════
   11. EMPTY / ERROR STATES
   ══════════════════════════════════════════════════ */

.ld-not-found {
    text-align: center;
    padding: 72px 20px;
    background: var(--ld-card-bg, #ffffff);
    border-radius: 16px;
    border: 1px solid #eaecef;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}
.ld-not-found .ld-nf-icon {
    font-size: 52px;
    margin-bottom: 20px;
    display: block;
}
.ld-not-found h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--ld-text, #000000);
}
.ld-not-found p {
    color: var(--ld-muted, #8492a6);
    font-size: 14px;
    line-height: 1.6;
}


/* ══════════════════════════════════════════════════
   12. RESPONSIVE
   ══════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .ld-hero            { padding: 32px 24px; flex-direction: column; align-items: flex-start; }
    .ld-hero-right      { align-self: center; }
    .ld-section         { padding: 24px 20px; }
    .ld-benefits-grid   { grid-template-columns: 1fr; }
}


/* ══════════════════════════════════════════════════
   13. POINTS VALUATION CARD
   ══════════════════════════════════════════════════ */

.ld-valuation-section {
    border-left: 4px solid var(--ld-accent, #B8934A);
}

.ld-section.ld-valuation-section svg {
    height: 14px;
}

.ld-valuation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 16px;
}

.ld-val-item {
    background: var(--ld-section-bg, #f8f9fb);
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    transition: transform .2s;
}
.ld-val-item:hover { transform: translateY(-2px); }

.ld-val-highlight {
    background: linear-gradient(135deg, var(--ld-accent, #B8934A) 0%, #e6a84e 100%);
    color: #fff;
}

.ld-val-num {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--ld-text, #000);
}
.ld-val-highlight .ld-val-num { color: #fff; }

.ld-val-lbl {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--ld-muted, #8492a6);
}
.ld-val-highlight .ld-val-lbl { color: rgba(255,255,255,.8); }

.ld-val-note {
    font-size: 12px;
    color: var(--ld-muted, #8492a6);
    margin: 0;
    line-height: 1.5;
}
.ld-val-note strong { color: var(--ld-accent, #B8934A); }

@media (max-width: 640px) {
    .ld-valuation-grid { grid-template-columns: 1fr; }
}


/* ══════════════════════════════════════════════════
   14. CHECKOUT REDEMPTION BOX
   ══════════════════════════════════════════════════ */

#ld-checkout-redemption {
    background: #fff;
    border: 1.5px solid #e4e4e4;
    border-radius: 16px;
    padding: 28px 28px 24px;
    margin-bottom: 28px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
}

/* ── Header ── */
.ld-checkout-header {
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1.5px solid #f0f0f0;
}

.ld-checkout-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #111;
    letter-spacing: -.3px;
    line-height: 1.2;
}

.ld-checkout-subtitle {
    font-size: 13.5px;
    color: #888;
    margin: 0;
    line-height: 1.5;
}

/* ── Email notice ── */
.ld-checkout-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f5f8ff;
    border: 1.5px solid #d0dcf8;
    border-radius: 10px;
    padding: 13px 16px;
    font-size: 13.5px;
    color: #3a4a7a;
    line-height: 1.5;
}

.ld-notice-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    stroke: #3a6be0;
    stroke-width: 2;
    stroke-linecap: round;
    fill: none;
    margin-top: 1px;
}

/* ── Loading ── */
#ld-checkout-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0 6px;
    font-size: 13.5px;
    color: #888;
}

.ld-checkout-spinner {
    flex-shrink: 0;
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid #eee;
    border-top-color: #111;
    border-radius: 50%;
    animation: ld-spin .7s linear infinite;
}

/* ── Points bar ── */
.ld-checkout-points-bar {
    background: #f7f7f7;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ld-checkout-points-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ld-checkout-points-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #888;
}

.ld-checkout-points-value {
    font-size: 26px;
    font-weight: 800;
    color: #111;
    letter-spacing: -.5px;
    line-height: 1;
}

/* ── Input group ── */
.ld-checkout-input-group {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.ld-checkout-input-wrap {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ld-checkout-input-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.ld-checkout-input.input-text {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #111;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    -moz-appearance: textfield;
}
.ld-checkout-input.input-text::-webkit-outer-spin-button,
.ld-checkout-input.input-text::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ld-checkout-input.input-text:focus {
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .08);
}

/* ── Redeem button ── */
.ld-redeem-btn {
    background: #000 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 13px 24px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: .2px;
    transition: opacity .2s, transform .15s;
    line-height: 1.3 !important;
    height: auto !important;
    align-self: center;
    margin-top: -10px;
}
.ld-redeem-btn:hover:not(:disabled) {
    opacity: .85;
    transform: translateY(-1px);
}
.ld-redeem-btn:active:not(:disabled) {
    transform: translateY(0);
}
.ld-redeem-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ── Feedback messages ── */
.ld-redeem-msg {
    margin-top: 14px;
    padding: 11px 15px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.5;
}
.ld-redeem-msg.ld-msg-ok {
    background: #edfbf0;
    border: 1.5px solid #a8ddb5;
    color: #1e6b35;
}
.ld-redeem-msg.ld-msg-err {
    background: #fff2f2;
    border: 1.5px solid #f5b8b8;
    color: #b91c1c;
}

/* Inline hint shown below the redemption input group (e.g. redemption value feedback) */
.ld-redeem-hint {
    display: block;
    margin-top: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: #1e6b35;
    background: #edfbf0;
    border: 1px solid #a8ddb5;
    border-radius: 6px;
    padding: 5px 10px;
    line-height: 1.4;
}


.ld-checkout-error {
    margin-top: 12px;
    font-size: 13px;
    color: #b91c1c;
    background: #fff2f2;
    border: 1.5px solid #f5b8b8;
    border-radius: 8px;
    padding: 10px 14px;
}

@media (max-width: 480px) {
    #ld-checkout-redemption        { padding: 22px 18px 20px; }
    .ld-checkout-input-group       { flex-direction: column; align-items: stretch; }
    .ld-redeem-btn                 { width: 100% !important; text-align: center; }
}

/* Static description shown below the points input, configured in Customizations */
.ld-input-description {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #8492a6;
    line-height: 1.4;
}

/* ── Join Loyalty Program panel ──────────────────────────────────────────── */

.ld-join-btn {
    display:         inline-flex;
    align-items:     center;
    gap:             8px;
    margin-top:      22px;
    padding:         12px 28px;
    background:      #000 !important;
    color:           #fff !important;
    border:          0 !important;
    border-radius:   10px;
    font-size:       15px;
    font-weight:     700;
    cursor:          pointer;
    transition:      background .2s, transform .1s, opacity .2s;
    box-shadow:      0 2px 8px rgba(0,0,0,.14);
}

.ld-join-btn svg {
    width:  18px;
    height: 18px;
    stroke: #fff;
    fill:   none;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.ld-join-btn:hover:not(:disabled) {
    background: #222;
    transform:  translateY(-1px);
}

.ld-join-btn:disabled {
    opacity: .6;
    cursor:  not-allowed;
}

/* SVG icon in the not-enrolled panel */
.ld-nf-icon-svg {
    display:    block;
    margin:     0 auto 12px;
    color:      var(--ld-accent, #e2a84b);
    font-size:  0; /* suppress any residual text baseline */
}

.ld-join-msg {
    margin-top:    16px;
    padding:       10px 16px;
    border-radius: 8px;
    font-size:     13.5px;
    font-weight:   500;
    max-width:     420px;
    margin-left:   auto;
    margin-right:  auto;
}

.ld-join-success {
    background: #edfbf0;
    border:     1.5px solid #a8ddb5;
    color:      #1e6b35;
}

.ld-join-error {
    background: #fff2f2;
    border:     1.5px solid #f5b8b8;
    color:      #b91c1c;
}
