/* ============================================================
   STATS SECTION - مدرن و پویا
   ============================================================ */

:root {
    --primary: #0f2f1f;
    --surface: #ffffff;
    --text: #1a1a1a;
    --muted: #5a6d60;
    --border: #dde2df;
    --radius: 24px;
    --shadow: 0 2px 20px rgba(15, 47, 31, 0.06);
    --shadow-lg: 0 20px 60px rgba(15, 47, 31, 0.1);
    --transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stats-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    position: relative;
    z-index: 5;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
}

/* ===== Stat Box ===== */
.stat-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.8rem 1.2rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.stat-box:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* ===== خط بالای رنگی ===== */
.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    z-index: 3;
}

.wallet::before {
    background: linear-gradient(90deg, #27ae60, #2ecc71, #27ae60);
    background-size: 200% 100%;
    animation: shimmerLine 3s ease-in-out infinite;
}

.users::before {
    background: linear-gradient(90deg, #2471a3, #3498db, #2471a3);
    background-size: 200% 100%;
    animation: shimmerLine 3s ease-in-out infinite 0.5s;
}

.lottery::before {
    background: linear-gradient(90deg, #d68910, #f39c12, #d68910);
    background-size: 200% 100%;
    animation: shimmerLine 3s ease-in-out infinite 1s;
}

.done::before {
    background: linear-gradient(90deg, #7d3c98, #9b59b6, #7d3c98);
    background-size: 200% 100%;
    animation: shimmerLine 3s ease-in-out infinite 1.5s;
}

@keyframes shimmerLine {
    0%,
    100% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 100% 0%;
    }
}

/* ===== دایره‌های پس‌زمینه ===== */
.bg-circles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    animation: circleOrbit 8s ease-in-out infinite;
}

.wallet .bg-circle {
    background: #2ecc71;
}
.users .bg-circle {
    background: #3498db;
}
.lottery .bg-circle {
    background: #f39c12;
}
.done .bg-circle {
    background: #9b59b6;
}

.bg-circle:nth-child(1) {
    width: 120px;
    height: 120px;
    top: -40px;
    right: -40px;
    opacity: 0.03;
    animation-delay: 0s;
}

.bg-circle:nth-child(2) {
    width: 70px;
    height: 70px;
    bottom: -20px;
    left: 20%;
    opacity: 0.04;
    animation-delay: 2s;
}

.bg-circle:nth-child(3) {
    width: 50px;
    height: 50px;
    top: 50%;
    left: -20px;
    opacity: 0.05;
    animation-delay: 4s;
}

.bg-circle:nth-child(4) {
    width: 35px;
    height: 35px;
    top: 25%;
    right: 15%;
    opacity: 0.06;
    animation-delay: 6s;
}

@keyframes circleOrbit {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(15px, -25px) scale(1.5);
    }
    50% {
        transform: translate(-12px, -40px) scale(0.7);
    }
    75% {
        transform: translate(-20px, -10px) scale(1.3);
    }
}

/* ===== ذرات ===== */
.stat-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.s-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    animation: particleDrift 5s infinite;
}

.wallet .s-particle {
    background: #2ecc71;
}
.users .s-particle {
    background: #3498db;
}
.lottery .s-particle {
    background: #f39c12;
}
.done .s-particle {
    background: #9b59b6;
}

.s-particle:nth-child(1) {
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}
.s-particle:nth-child(2) {
    top: 75%;
    left: 90%;
    animation-delay: 0.6s;
}
.s-particle:nth-child(3) {
    top: 50%;
    left: 40%;
    animation-delay: 1.2s;
}
.s-particle:nth-child(4) {
    top: 85%;
    left: 15%;
    animation-delay: 1.8s;
}
.s-particle:nth-child(5) {
    top: 20%;
    left: 75%;
    animation-delay: 2.4s;
}
.s-particle:nth-child(6) {
    top: 60%;
    left: 30%;
    animation-delay: 3s;
}
.s-particle:nth-child(7) {
    top: 35%;
    left: 60%;
    animation-delay: 3.6s;
}

@keyframes particleDrift {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    20% {
        transform: translate(10px, -18px) scale(2);
        opacity: 0.9;
    }
    40% {
        transform: translate(-12px, -30px) scale(0.5);
        opacity: 0.2;
    }
    60% {
        transform: translate(-16px, -8px) scale(1.6);
        opacity: 0.7;
    }
    80% {
        transform: translate(6px, -22px) scale(0.8);
        opacity: 0.4;
    }
}

/* ===== سایه متحرک ===== */
.stat-glow {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 20px;
    border-radius: 50%;
    filter: blur(15px);
    opacity: 0;
    z-index: 0;
    transition: all 0.5s ease;
}

.stat-box:hover .stat-glow {
    opacity: 0.4;
    bottom: -25px;
}

.wallet .stat-glow {
    background: #2ecc71;
}
.users .stat-glow {
    background: #3498db;
}
.lottery .stat-glow {
    background: #f39c12;
}
.done .stat-glow {
    background: #9b59b6;
}

/* ===== آیکون ===== */
.stat-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.8rem;
    transition: var(--transition);
    position: relative;
    z-index: 2;
    animation: iconBreath 4s ease-in-out infinite;
}

@keyframes iconBreath {
    0%,
    100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.08);
    }
    75% {
        transform: scale(0.95);
    }
}

.stat-box:hover .stat-icon-wrapper {
    transform: scale(1.2) rotate(-12deg);
    animation: none;
}

.wallet .stat-icon-wrapper {
    background: linear-gradient(135deg, #e8f8f0, #d4f0e0);
    color: #1e7e34;
}

.users .stat-icon-wrapper {
    background: linear-gradient(135deg, #e8f0f8, #d4e4f4);
    color: #2471a3;
}

.lottery .stat-icon-wrapper {
    background: linear-gradient(135deg, #fef5e7, #fdebd0);
    color: #b8861e;
}

.done .stat-icon-wrapper {
    background: linear-gradient(135deg, #f4ecf7, #e8daef);
    color: #7d3c98;
}

/* ===== عدد ===== */
.stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 4px;
    transition: all 0.4s ease;
    position: relative;
    z-index: 2;
    letter-spacing: -1px;
}

.stat-box:hover .stat-value {
    transform: scale(1.08);
}

/* ===== لیبل ===== */
.stat-label {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
    position: relative;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-sub {
    font-size: 0.68rem;
    color: #8a9a8d;
    margin-top: 6px;
    position: relative;
    z-index: 2;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ===== دسکتاپ بزرگ ===== */
@media (min-width: 1200px) {
    .stats-container {
        max-width: 1200px;
    }

    .stat-box {
        padding: 2rem 1.5rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .stat-icon-wrapper {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }
}

/* ===== تبلت ===== */
@media (max-width: 991px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-box {
        padding: 1.5rem 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* ===== موبایل بزرگ ===== */
@media (max-width: 768px) {
    .stats-container {
        padding: 0 0.75rem;
        margin: 1.5rem auto;
    }

    .stats-grid {
        gap: 0.8rem;
    }

    .stat-box {
        padding: 1.2rem 0.8rem;
        border-radius: 18px;
    }

    .stat-icon-wrapper {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
        border-radius: 14px;
        margin-bottom: 0.6rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .stat-sub {
        font-size: 0.6rem;
    }

    .bg-circle:nth-child(1) {
        width: 80px;
        height: 80px;
        top: -30px;
        right: -30px;
    }

    .bg-circle:nth-child(2) {
        width: 50px;
        height: 50px;
        bottom: -15px;
        left: 15%;
    }

    .bg-circle:nth-child(3) {
        width: 35px;
        height: 35px;
        left: -15px;
    }

    .bg-circle:nth-child(4) {
        width: 25px;
        height: 25px;
    }
}

/* ===== موبایل کوچک ===== */
@media (max-width: 480px) {
    .stats-container {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .stat-box {
        padding: 0.9rem 0.5rem;
        border-radius: 14px;
    }

    .stat-icon-wrapper {
        width: 38px;
        height: 38px;
        font-size: 1rem;
        border-radius: 10px;
        margin-bottom: 0.4rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    .stat-label {
        font-size: 0.6rem;
        letter-spacing: 0.3px;
    }

    .stat-sub {
        font-size: 0.5rem;
        margin-top: 3px;
    }

    /* دایره‌ها در موبایل کوچک */
    .bg-circle:nth-child(1) {
        width: 60px;
        height: 60px;
        top: -20px;
        right: -20px;
    }

    .bg-circle:nth-child(2) {
        width: 35px;
        height: 35px;
        bottom: -10px;
        left: 10%;
    }

    .bg-circle:nth-child(3) {
        width: 25px;
        height: 25px;
        left: -10px;
    }

    .bg-circle:nth-child(4) {
        width: 20px;
        height: 20px;
    }

    /* ذرات در موبایل کوچک */
    .s-particle {
        width: 2px;
        height: 2px;
    }
}

/* ============================================================
   ANIMATION ON SCROLL (اختیاری)
   ============================================================ */
.stat-box {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.stat-box:nth-child(1) {
    animation-delay: 0.1s;
}
.stat-box:nth-child(2) {
    animation-delay: 0.2s;
}
.stat-box:nth-child(3) {
    animation-delay: 0.3s;
}
.stat-box:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}