/* =====================================================================
 * Social Proof & Trust Building — Storefront CSS
 *
 * Phase 43: Works alongside Tailwind CSS in all storefront themes.
 * Includes purchase notifications, trust badges, testimonials,
 * sales counters, and dark theme support.
 * ===================================================================== */

/* -----------------------------------------------------------------
 * 1. Purchase Notification Toast (bottom-left slide-in)
 * --------------------------------------------------------------- */
.purchase-notification {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    max-width: 360px;
    width: calc(100vw - 48px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(139, 92, 246, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(-120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    pointer-events: none;
}

.purchase-notification.is-visible {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.purchase-notification__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 14px;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
    padding: 0;
    line-height: 1;
}

.purchase-notification__close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.purchase-notification__avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.purchase-notification__body {
    flex: 1;
    min-width: 0;
    padding-right: 16px;
}

.purchase-notification__text {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
    margin: 0;
}

.purchase-notification__text strong {
    color: #fff;
    font-weight: 600;
}

.purchase-notification__time {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

.purchase-notification__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.625rem;
    color: #34d399;
    margin-top: 4px;
}

.purchase-notification__badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    animation: sp-pulse 2s infinite;
}

@keyframes sp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* -----------------------------------------------------------------
 * 2. Trust Badges
 * --------------------------------------------------------------- */
.trust-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 20px 0;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex: 0 1 auto;
    min-width: 180px;
}

.trust-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.15);
}

.trust-badge__icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.trust-badge__content {
    min-width: 0;
}

.trust-badge__title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.3;
}

.trust-badge__desc {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.4;
    margin-top: 1px;
}

/* -----------------------------------------------------------------
 * 3. Testimonials Section
 * --------------------------------------------------------------- */
.testimonial-section {
    padding: 48px 0;
}

.testimonial-section__heading {
    text-align: center;
    margin-bottom: 32px;
}

.testimonial-section__title {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #a78bfa, #818cf8, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.testimonial-section__subtitle {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9375rem;
}

.testimonial-carousel {
    position: relative;
    overflow: hidden;
}

.testimonial-carousel__track {
    display: flex;
    gap: 20px;
    transition: transform 0.5s ease;
}

.testimonial-carousel__track--static {
    flex-wrap: wrap;
    justify-content: center;
}

.testimonial-card {
    flex: 0 0 calc(33.333% - 14px);
    min-width: 280px;
    max-width: 400px;
    padding: 28px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.testimonial-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(124, 58, 237, 0.15);
}

.testimonial-card__stars {
    color: #fbbf24;
    font-size: 0.875rem;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.testimonial-card__quote {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.6;
    margin-bottom: 16px;
    font-style: italic;
    position: relative;
}

.testimonial-card__quote::before {
    content: '"';
    font-size: 2.5rem;
    position: absolute;
    top: -16px;
    left: -4px;
    color: rgba(139, 92, 246, 0.3);
    font-family: Georgia, serif;
    line-height: 1;
}

.testimonial-card__author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.testimonial-card__avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.testimonial-card__name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.testimonial-card__title {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Carousel dots */
.testimonial-carousel__dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.testimonial-carousel__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.3s, transform 0.3s;
}

.testimonial-carousel__dot.is-active {
    background: #7c3aed;
    transform: scale(1.3);
}

/* -----------------------------------------------------------------
 * 4. Sales Counter
 * --------------------------------------------------------------- */
.sales-counter {
    font-variant-numeric: tabular-nums;
    display: inline-block;
}

.sales-counter[data-animated] {
    transition: opacity 0.3s;
}

/* -----------------------------------------------------------------
 * 5. Social Proof Stats
 * --------------------------------------------------------------- */
.social-proof-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    padding: 24px 0;
}

.social-proof-stat {
    text-align: center;
    padding: 20px 28px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 140px;
}

.social-proof-stat__value {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.social-proof-stat__label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* -----------------------------------------------------------------
 * 6. Visitor Counter
 * --------------------------------------------------------------- */
.visitor-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.visitor-count__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    animation: sp-pulse 1.5s infinite;
}

/* -----------------------------------------------------------------
 * 7. Product Page Social Proof
 * --------------------------------------------------------------- */
.product-sales-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.product-sales-badge__icon {
    font-size: 0.875rem;
}

/* -----------------------------------------------------------------
 * 8. Responsive
 * --------------------------------------------------------------- */
@media (max-width: 768px) {
    .purchase-notification {
        bottom: 80px; /* Above mobile bottom nav */
        left: 12px;
        max-width: calc(100vw - 24px);
    }

    .trust-badges {
        gap: 8px;
    }

    .trust-badge {
        min-width: 150px;
        padding: 10px 14px;
    }

    .testimonial-card {
        flex: 0 0 calc(100% - 16px);
        min-width: 260px;
    }

    .social-proof-stats {
        gap: 10px;
    }

    .social-proof-stat {
        min-width: 100px;
        padding: 14px 16px;
    }

    .social-proof-stat__value {
        font-size: 1.375rem;
    }
}

@media (max-width: 480px) {
    .trust-badge {
        flex: 1 1 100%;
        min-width: unset;
    }

    .trust-badge__desc {
        display: none;
    }
}

/* -----------------------------------------------------------------
 * 9. Dark Theme Support
 * --------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    .purchase-notification {
        background: rgba(15, 23, 42, 0.97);
    }
}

.dark .purchase-notification {
    background: rgba(15, 23, 42, 0.97);
}

/* Light theme overrides for themes that use light mode */
body.theme-light .purchase-notification,
body.theme-white .purchase-notification {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

body.theme-light .purchase-notification__text,
body.theme-white .purchase-notification__text {
    color: #1e293b;
}

body.theme-light .purchase-notification__text strong,
body.theme-white .purchase-notification__text strong {
    color: #0f172a;
}

body.theme-light .purchase-notification__time,
body.theme-white .purchase-notification__time {
    color: #94a3b8;
}

body.theme-light .purchase-notification__close,
body.theme-white .purchase-notification__close {
    color: #94a3b8;
}

body.theme-light .trust-badge,
body.theme-white .trust-badge {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(99, 102, 241, 0.15);
}

body.theme-light .trust-badge__title,
body.theme-white .trust-badge__title {
    color: #1e293b;
}

body.theme-light .trust-badge__desc,
body.theme-white .trust-badge__desc {
    color: #64748b;
}

body.theme-light .testimonial-card,
body.theme-white .testimonial-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(99, 102, 241, 0.12);
}

body.theme-light .testimonial-card__quote,
body.theme-white .testimonial-card__quote {
    color: #334155;
}

body.theme-light .testimonial-card__name,
body.theme-white .testimonial-card__name {
    color: #1e293b;
}

body.theme-light .testimonial-card__title,
body.theme-white .testimonial-card__title {
    color: #94a3b8;
}

body.theme-light .social-proof-stat,
body.theme-white .social-proof-stat {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(99, 102, 241, 0.1);
}

body.theme-light .social-proof-stat__label,
body.theme-white .social-proof-stat__label {
    color: #64748b;
}

/* Premium theme */
body.theme-premium .purchase-notification {
    border-color: rgba(251, 191, 36, 0.25);
}

body.theme-premium .purchase-notification__avatar {
    background: linear-gradient(135deg, #d97706, #fbbf24);
}

body.theme-premium .testimonial-section__title {
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Elite theme */
body.theme-elite .purchase-notification {
    border-color: rgba(6, 182, 212, 0.25);
}

body.theme-elite .purchase-notification__avatar {
    background: linear-gradient(135deg, #0891b2, #22d3ee);
}

body.theme-elite .testimonial-section__title {
    background: linear-gradient(135deg, #22d3ee, #06b6d4, #0891b2);
    -webkit-background-clip: text;
    background-clip: text;
}
