/**
 * SkillNest Unified Pricing Cards
 * Used on: /plans, /subscription, /buy-credits
 * ─────────────────────────────────────────────
 */

/* ════════════════════════════════════════════
   PLAN CARDS  (.sn-plan-card)
   ════════════════════════════════════════════ */

.sn-plan-card {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    border: 1.5px solid #e9ecef;
    background: #fff;
    height: 100%;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    position: relative;
}

.sn-plan-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.10);
}

/* Featured / Most Popular — scales up slightly */
.sn-plan-card.sn-featured {
    border: 2.5px solid var(--theme-deafult);
    box-shadow: 0 6px 28px rgba(82, 82, 233, 0.22);
    transform: scale(1.025);
    z-index: 2;
}

.sn-plan-card.sn-featured:hover {
    transform: scale(1.025) translateY(-4px);
    box-shadow: 0 18px 44px rgba(82, 82, 233, 0.28);
}

/* Current active subscription */
.sn-plan-card.sn-current {
    border: 2px solid #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.10);
}

/* Payment page selection state (mpesa/payhero use .selected, payhero uses .active) */
.sn-plan-card.selected,
.sn-plan-card.active {
    border-color: #006666 !important;
    box-shadow: 0 0 0 3px rgba(39, 218, 104, 0.18), 0 8px 24px rgba(0, 0, 0, 0.10) !important;
    background: rgba(39, 218, 104, 0.03);
}

/* ── Plan Header ────────────────────────── */

.sn-plan-header {
    padding: 22px 20px 18px;
    text-align: center;
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sn-plan-card.sn-free     .sn-plan-header { background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%); }
.sn-plan-card.sn-basic    .sn-plan-header { background: linear-gradient(145deg, #eff6ff 0%, #dbeafe 100%); }
.sn-plan-card.sn-pro      .sn-plan-header { background: linear-gradient(145deg, var(--theme-deafult, #4361ee) 0%, #6366f1 100%); border-bottom: none; }
.sn-plan-card.sn-business .sn-plan-header { background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%); border-bottom: none; }

/* Icon in header */
.sn-plan-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 18px;
}

.sn-plan-card.sn-free     .sn-plan-icon { background: rgba(100, 116, 139, 0.12); color: #64748b; }
.sn-plan-card.sn-basic    .sn-plan-icon { background: rgba(59, 130, 246, 0.14);  color: #3b82f6; }
.sn-plan-card.sn-pro      .sn-plan-icon { background: rgba(255, 255, 255, 0.20); color: #fff; }
.sn-plan-card.sn-business .sn-plan-icon { background: rgba(255, 255, 255, 0.10); color: rgba(255, 255, 255, 0.9); }

/* Plan badge */
.sn-plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 8px;
    line-height: 1.4;
}

.sn-badge-free    { background: rgba(100, 116, 139, 0.12); color: #64748b; }
.sn-badge-popular { background: rgba(234, 179, 8, 0.90);   color: #78350f; }
.sn-badge-best    { background: rgba(255, 255, 255, 0.18); color: rgba(255, 255, 255, 0.95); border: 1px solid rgba(255, 255, 255, 0.30); }
.sn-badge-current { background: #dcfce7; color: #166534; }

/* Plan name */
.sn-plan-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    margin: 0 0 4px;
    line-height: 1;
}

.sn-plan-card.sn-free     .sn-plan-name { color: #374151; }
.sn-plan-card.sn-basic    .sn-plan-name { color: #1e3a8a; }
.sn-plan-card.sn-pro      .sn-plan-name { color: #fff; }
.sn-plan-card.sn-business .sn-plan-name { color: #fff; }

/* Plan tagline */
.sn-plan-tagline {
    font-size: 12px;
    margin: 0;
    opacity: 0.65;
}

.sn-plan-card.sn-pro      .sn-plan-tagline { color: rgba(255, 255, 255, 0.85); opacity: 1; }
.sn-plan-card.sn-business .sn-plan-tagline { color: rgba(255, 255, 255, 0.75); opacity: 1; }

/* ── Plan Body ──────────────────────────── */

.sn-plan-body {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* ── Price Block ────────────────────────── */

.sn-plan-price {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.sn-plan-amount-wrap {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 1px;
    line-height: 1;
}

.sn-plan-currency {
    font-size: 14px;
    font-weight: 700;
    color: var(--theme-deafult, #4361ee);
    opacity: 0.75;
    margin-right: 2px;
}

.sn-plan-amount {
    font-size: 36px;
    font-weight: 800;
    color: var(--theme-deafult, #4361ee);
    letter-spacing: -1px;
    line-height: 1;
}

.sn-plan-card.sn-free .sn-plan-amount,
.sn-plan-card.sn-free .sn-plan-currency { color: #64748b; }

.sn-plan-period {
    font-size: 12px;
    color: #94a3b8;
    display: block;
    margin-top: 4px;
}

/* Full price string (used when displayUserPrice() returns pre-formatted text, e.g. PayPal) */
.sn-price-full {
    font-size: 28px;
    font-weight: 800;
    color: var(--theme-deafult, #4361ee);
    letter-spacing: -0.5px;
    line-height: 1;
}

.sn-plan-card.sn-free .sn-price-full { color: #64748b; }

.sn-plan-per-credit {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 5px;
    display: block;
}

.sn-plan-per-credit.sn-green {
    color: #16a34a;
    font-weight: 600;
}

.sn-value-bubble {
    display: inline-block;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 6px;
}

/* ── Credits Block ──────────────────────── */

.sn-credits-block {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    border: 1px solid #bae6fd;
}

.sn-credits-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--theme-deafult, #4361ee);
    line-height: 1;
    flex-shrink: 0;
}

.sn-credits-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sn-credits-label {
    font-size: 12px;
    font-weight: 600;
    color: #0369a1;
    line-height: 1;
}

.sn-credits-sub {
    font-size: 11px;
    color: #0284c7;
    line-height: 1;
    opacity: 0.8;
}

/* ── Features List ──────────────────────── */

.sn-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    flex: 1;
}

.sn-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    color: #374151;
    border-bottom: 1px solid #f8fafc;
    line-height: 1.4;
}

.sn-features li:last-child { border-bottom: none; }
.sn-features li.sn-off     { color: #cbd5e1; }

.sn-features .sn-check { color: #22c55e; font-size: 11px; flex-shrink: 0; width: 16px; text-align: center; }
.sn-features .sn-x     { color: #e2e8f0; font-size: 11px; flex-shrink: 0; width: 16px; text-align: center; }

/* ── Plan Footer ────────────────────────── */

.sn-plan-footer {
    padding: 0 20px 20px;
}


/* ════════════════════════════════════════════
   CREDIT PACKAGE CARDS  (.sn-credit-card)
   ════════════════════════════════════════════ */

.sn-credit-card {
    border-radius: 14px;
    overflow: hidden;
    border: 1.5px solid #e9ecef;
    background: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.sn-credit-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.09);
}

.sn-credit-card.sn-credit-popular {
    border: 2.5px solid var(--theme-deafult, #4361ee);
    box-shadow: 0 4px 18px rgba(82, 82, 233, 0.16);
}

/* Colored top accent bar */
.sn-credit-accent {
    height: 4px;
    background: #f1f5f9;
    flex-shrink: 0;
}

.sn-credit-card.sn-credit-popular .sn-credit-accent {
    background: linear-gradient(90deg, var(--theme-deafult, #4361ee) 0%, #6366f1 100%);
}

.sn-credit-body {
    flex: 1;
    padding: 18px 16px 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.sn-credit-icon-wrap {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 20px;
}

.sn-credit-name {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0;
    line-height: 1.2;
}

.sn-credit-price {
    font-size: 32px;
    font-weight: 800;
    color: var(--theme-deafult, #4361ee);
    letter-spacing: -1px;
    line-height: 1;
    margin: 8px 0 0;
}

.sn-credit-price-currency {
    font-size: 14px;
    font-weight: 700;
    vertical-align: super;
    opacity: 0.7;
}

.sn-credit-period {
    font-size: 11px;
    color: #94a3b8;
    display: block;
    margin-bottom: 10px;
}

.sn-credit-credits {
    font-size: 16px;
    font-weight: 700;
    color: #334155;
    display: block;
    margin: 8px 0 2px;
}

.sn-credit-per-credit {
    font-size: 11px;
    color: #94a3b8;
    display: block;
    margin-bottom: 14px;
}

.sn-credit-savings-badge {
    display: inline-block;
    background: rgba(234, 179, 8, 0.12);
    color: #92400e;
    border: 1px solid rgba(234, 179, 8, 0.30);
    border-radius: 20px;
    padding: 2px 9px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
}

.sn-credit-popular-badge {
    display: inline-block;
    background: var(--theme-deafult, #4361ee);
    color: #fff;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.sn-credit-features {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
    text-align: left;
    flex: 1;
}

.sn-credit-features li {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #475569;
    padding: 4px 0;
    border-bottom: 1px solid #f8fafc;
}

.sn-credit-features li:last-child { border-bottom: none; }

.sn-credit-footer {
    padding: 0 16px 16px;
}


/* ════════════════════════════════════════════
   DARK MODE
   ════════════════════════════════════════════ */

body.dark-only .sn-plan-card,
body[class*="dark"] .sn-plan-card {
    background: #222738;
    border-color: rgba(255, 255, 255, 0.07);
}

body.dark-only .sn-plan-card.sn-free .sn-plan-header,
body[class*="dark"] .sn-plan-card.sn-free .sn-plan-header {
    background: linear-gradient(145deg, #1e2430 0%, #262d40 100%);
}

body.dark-only .sn-plan-card.sn-basic .sn-plan-header,
body[class*="dark"] .sn-plan-card.sn-basic .sn-plan-header {
    background: linear-gradient(145deg, #172554 0%, #1e3a8a 100%);
}

body.dark-only .sn-plan-card.sn-free .sn-plan-name,
body[class*="dark"] .sn-plan-card.sn-free .sn-plan-name { color: #e2e8f0; }

body.dark-only .sn-plan-card.sn-basic .sn-plan-name,
body[class*="dark"] .sn-plan-card.sn-basic .sn-plan-name { color: #93c5fd; }

body.dark-only .sn-plan-header,
body[class*="dark"] .sn-plan-header { border-bottom-color: rgba(255, 255, 255, 0.05); }

body.dark-only .sn-plan-price,
body[class*="dark"] .sn-plan-price { border-bottom-color: rgba(255, 255, 255, 0.05); }

body.dark-only .sn-features li,
body[class*="dark"] .sn-features li { color: #cbd5e1; border-bottom-color: rgba(255, 255, 255, 0.04); }

body.dark-only .sn-features li.sn-off,
body[class*="dark"] .sn-features li.sn-off { color: rgba(255, 255, 255, 0.20); }

body.dark-only .sn-credits-block,
body[class*="dark"] .sn-credits-block { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.08); }

body.dark-only .sn-credits-label,
body[class*="dark"] .sn-credits-label { color: #7dd3fc; }

body.dark-only .sn-credits-sub,
body[class*="dark"] .sn-credits-sub { color: #38bdf8; }

body.dark-only .sn-plan-period,
body[class*="dark"] .sn-plan-period { color: #64748b; }

body.dark-only .sn-value-bubble,
body[class*="dark"] .sn-value-bubble { background: rgba(22, 163, 74, 0.15); color: #86efac; border-color: rgba(134, 239, 172, 0.3); }

body.dark-only .sn-credit-card,
body[class*="dark"] .sn-credit-card { background: #222738; border-color: rgba(255, 255, 255, 0.07); }

body.dark-only .sn-credit-name,
body[class*="dark"] .sn-credit-name { color: #e2e8f0; }

body.dark-only .sn-credit-credits,
body[class*="dark"] .sn-credit-credits { color: #cbd5e1; }

body.dark-only .sn-credit-features li,
body[class*="dark"] .sn-credit-features li { color: #94a3b8; border-bottom-color: rgba(255, 255, 255, 0.04); }

body.dark-only .sn-credit-accent,
body[class*="dark"] .sn-credit-accent { background: rgba(255, 255, 255, 0.05); }


/* ════════════════════════════════════════════
   LANDING PAGE DARK MODE (index.php)
   Uses data-landing-theme="dark" on <html>
   ════════════════════════════════════════════ */

html[data-landing-theme="dark"] .sn-plan-card {
    background: #1e2430;
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-landing-theme="dark"] .sn-plan-card.sn-free .sn-plan-header {
    background: linear-gradient(145deg, #1a2030 0%, #222940 100%);
}

html[data-landing-theme="dark"] .sn-plan-card.sn-basic .sn-plan-header {
    background: linear-gradient(145deg, #172554 0%, #1e3a8a 100%);
}

html[data-landing-theme="dark"] .sn-plan-card.sn-free .sn-plan-name  { color: #e2e8f0; }
html[data-landing-theme="dark"] .sn-plan-card.sn-basic .sn-plan-name { color: #93c5fd; }

html[data-landing-theme="dark"] .sn-plan-header  { border-bottom-color: rgba(255, 255, 255, 0.05); }
html[data-landing-theme="dark"] .sn-plan-price   { border-bottom-color: rgba(255, 255, 255, 0.05); }
html[data-landing-theme="dark"] .sn-features li  { color: #cbd5e1; border-bottom-color: rgba(255, 255, 255, 0.04); }
html[data-landing-theme="dark"] .sn-features li.sn-off { color: rgba(255, 255, 255, 0.22); }
html[data-landing-theme="dark"] .sn-credits-block { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.08); }
html[data-landing-theme="dark"] .sn-credits-label { color: #7dd3fc; }
html[data-landing-theme="dark"] .sn-credits-sub   { color: #38bdf8; }
html[data-landing-theme="dark"] .sn-plan-period   { color: #64748b; }
html[data-landing-theme="dark"] .sn-value-bubble  { background: rgba(22, 163, 74, 0.15); color: #86efac; border-color: rgba(134, 239, 172, 0.3); }


/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */

@media (max-width: 991px) {
    .sn-plan-card.sn-featured {
        transform: none;
    }
    .sn-plan-card.sn-featured:hover {
        transform: translateY(-4px);
    }
}

@media (max-width: 576px) {
    .sn-plan-amount { font-size: 30px; }
    .sn-plan-name   { font-size: 17px; letter-spacing: 1.5px; }
}


/* ════════════════════════════════════════════
   PRICING SECTION ANIMATIONS (index.php only)
   Scoped to .pricing-section — does not affect
   /plans, /subscription, or /buy-credits pages
   ════════════════════════════════════════════ */

/* 1. Card entrance — scale up as it rises in */
@keyframes sn-card-scale-in {
    from { transform: scale(0.88); }
    to   { transform: scale(1); }
}
@keyframes sn-featured-scale-in {
    from { transform: scale(0.90); }
    to   { transform: scale(1.025); }
}

.pricing-section .reveal.visible .sn-plan-card:not(.sn-featured) {
    animation: sn-card-scale-in 0.72s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.pricing-section .reveal.visible .sn-plan-card.sn-featured {
    animation: sn-featured-scale-in 0.72s cubic-bezier(0.22, 1, 0.36, 1) both,
               sn-glow-pulse 2.8s ease-in-out 1.8s infinite;
}

/* Stagger scale-in per column */
.pricing-section .rd-1.visible .sn-plan-card { animation-delay: 0.06s, 1.86s; }
.pricing-section .rd-2.visible .sn-plan-card { animation-delay: 0.12s; }
.pricing-section .rd-3.visible .sn-plan-card { animation-delay: 0.18s, 1.98s; }
.pricing-section .rd-4.visible .sn-plan-card { animation-delay: 0.24s; }

/* 2. Floating icon — gentle bob loop */
@keyframes sn-icon-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    40%      { transform: translateY(-7px) rotate(-4deg); }
    70%      { transform: translateY(-3px) rotate(2deg); }
}

.pricing-section .reveal.visible .sn-plan-icon {
    animation: sn-icon-float 3.8s ease-in-out infinite;
    animation-delay: 0.9s;
}

/* 3. Header shimmer sweep (once on entrance) */
.pricing-section .sn-plan-header {
    overflow: hidden;
}

@keyframes sn-shimmer {
    0%   { transform: skewX(-15deg) translateX(-200%); opacity: 0; }
    15%  { opacity: 1; }
    85%  { opacity: 1; }
    100% { transform: skewX(-15deg) translateX(400%); opacity: 0; }
}

.pricing-section .sn-plan-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 55%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transform: skewX(-15deg) translateX(-200%);
    pointer-events: none;
}

.pricing-section .reveal.visible .sn-plan-header::after { animation: sn-shimmer 1.1s ease 0.55s both; }
.pricing-section .rd-2.visible  .sn-plan-header::after  { animation-delay: 0.70s; }
.pricing-section .rd-3.visible  .sn-plan-header::after  { animation-delay: 0.85s; }
.pricing-section .rd-4.visible  .sn-plan-header::after  { animation-delay: 1.00s; }

/* 4. Feature list — stagger slide in */
@keyframes sn-feature-fade {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.pricing-section .reveal.visible .sn-features li {
    opacity: 0;
    animation: sn-feature-fade 0.38s ease both;
}
.pricing-section .reveal.visible .sn-features li:nth-child(1) { animation-delay: 0.42s; }
.pricing-section .reveal.visible .sn-features li:nth-child(2) { animation-delay: 0.50s; }
.pricing-section .reveal.visible .sn-features li:nth-child(3) { animation-delay: 0.58s; }
.pricing-section .reveal.visible .sn-features li:nth-child(4) { animation-delay: 0.66s; }
.pricing-section .reveal.visible .sn-features li:nth-child(5) { animation-delay: 0.74s; }
.pricing-section .reveal.visible .sn-features li:nth-child(6) { animation-delay: 0.82s; }
.pricing-section .reveal.visible .sn-features li:nth-child(7) { animation-delay: 0.90s; }

/* 5. CTA button — bounce pop */
@keyframes sn-btn-bounce {
    0%   { transform: scale(0.78) translateY(10px); opacity: 0; }
    60%  { transform: scale(1.06) translateY(-2px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.pricing-section .reveal.visible .sn-plan-footer .btn {
    animation: sn-btn-bounce 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) 0.78s both;
}

/* 6. Credits block — pop in */
@keyframes sn-credits-pop {
    0%   { transform: scale(0.82); opacity: 0; }
    70%  { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.pricing-section .reveal.visible .sn-credits-block {
    animation: sn-credits-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s both;
}

/* 7. PRO card glow pulse (continuous) */
@keyframes sn-glow-pulse {
    0%, 100% { box-shadow: 0 6px 28px rgba(82, 82, 233, 0.22); }
    50%      { box-shadow: 0 6px 28px rgba(82, 82, 233, 0.22),
                           0 0 0 5px rgba(82, 82, 233, 0.10),
                           0 0 24px rgba(82, 82, 233, 0.15); }
}

/* 8. Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .pricing-section .sn-plan-card,
    .pricing-section .sn-plan-header::after,
    .pricing-section .sn-plan-icon,
    .pricing-section .sn-features li,
    .pricing-section .sn-plan-footer .btn,
    .pricing-section .sn-credits-block {
        animation: none !important;
        opacity: 1 !important;
    }
    .pricing-section .reveal.visible .sn-plan-card.sn-featured {
        transform: scale(1.025);
        box-shadow: 0 6px 28px rgba(82, 82, 233, 0.22);
    }
}
