/**
 * Component: section_stats
 * Display 4 main platform statistics with counter animation
 * Last section on page (before footer) with background image
 * BEM naming: .section_stats__*
 */

/* ============================================================
 * SECTION CONTAINER
 * ============================================================ */

.section_stats {
    position: relative;
    width: 100%;
    overflow: hidden;
    min-height: 100vh;
}

/* ============================================================
 * BACKGROUND LAYER
 * ============================================================ */

.section_stats__background {
    position: absolute;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    top: 0;
    left: 0;
    z-index: 1;
    background-position: center bottom;
    background-repeat: no-repeat;
    background-size: cover;
}

/* ============================================================
 * WRAPPER (content layer)
 * ============================================================ */

.section_stats__wrapper {
    position: relative;
    z-index: 2;
    padding: 60px 20px;
    margin: 0 auto;
    max-width: 1400px;
    background-color: var(--color-surface);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 20px 30px 0 rgba(5, 8, 28, 0.5);
}

.section_stats__container {
    position: relative;
}

/* ============================================================
 * TITLE
 * ============================================================ */

.section_stats__title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 50px;
    color: var(--color-link);
}

/* ============================================================
 * STATS GRID (4 columns)
 * ============================================================ */

.section_stats__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 20px;
}

/* Mobile: 1 column */
@media (max-width: 576px) {
    .section_stats__grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Tablet: 2 columns */
@media (min-width: 577px) and (max-width: 992px) {
    .section_stats__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

/* Desktop: 4 columns */
@media (min-width: 993px) {
    .section_stats__grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

/* ============================================================
 * STAT CARD
 * ============================================================ */

.section_stats__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, 
        rgba(0, 207, 255, 0.05), 
        rgba(0, 255, 136, 0.05));
    border: 2px solid var(--color-border);
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

/* Glow effect on hover */
.section_stats__card:hover {
    border-color: var(--color-link);
    box-shadow: 0 0 20px rgba(0, 207, 255, 0.3),
                inset 0 0 20px rgba(0, 207, 255, 0.05);
    transform: translateY(-5px);
}

/* ============================================================
 * STAT NUMBER (with counter animation)
 * ============================================================ */

.section_stats__number {
    font-size: 3rem;
    font-weight: 900;
    color: var(--color-link);
    margin: 20px 0 10px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

/* Counter animation: 0 → final value */
@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.section_stats__number.animating {
    animation: countUp 0.5s ease-out forwards;
}

/* ============================================================
 * STAT LABEL
 * ============================================================ */

.section_stats__label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 15px;
}

/* ============================================================
 * LOADER
 * ============================================================ */

.section_stats__loader {
    text-align: center;
    padding: 40px 20px;
}

.section_stats__loader .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
    color: var(--color-link);
}

/* ============================================================
 * ERROR STATE
 * ============================================================ */

.section_stats__error {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-primary);
}

/* ============================================================
 * THEME VARIANTS
 * ============================================================ */

.section_stats.theme-dark .section_stats__wrapper {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
}

.section_stats.theme-dark .section_stats__card {
    background: linear-gradient(135deg, 
        rgba(0, 207, 255, 0.08), 
        rgba(0, 255, 136, 0.08));
    border-color: rgba(0, 207, 255, 0.35);
}

.section_stats.theme-dark .section_stats__card:hover {
    border-color: #00cfff;
    box-shadow: 0 0 30px rgba(0, 207, 255, 0.4),
                inset 0 0 30px rgba(0, 207, 255, 0.1);
}

.section_stats.theme-light {
    background: linear-gradient(135deg, rgba(240, 240, 240, 0.9), rgba(255, 255, 255, 0.9));
}

.section_stats.theme-light .section_stats__wrapper {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 100, 180, 0.3);
}

.section_stats.theme-light .section_stats__card {
    background: linear-gradient(135deg, 
        rgba(13, 110, 253, 0.05), 
        rgba(32, 201, 51, 0.05));
    border-color: rgba(13, 110, 253, 0.2);
}

.section_stats.theme-light .section_stats__card:hover {
    border-color: #0d6efd;
    box-shadow: 0 0 30px rgba(13, 110, 253, 0.2),
                inset 0 0 30px rgba(13, 110, 253, 0.05);
}

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

@media (max-width: 768px) {
    .section_stats__title {
        font-size: 1.8rem;
        margin-bottom: 40px;
    }

    .section_stats__wrapper {
        padding: 40px 15px;
    }

    .section_stats__card {
        padding: 25px 15px;
        min-height: 180px;
    }

    .section_stats__number {
        font-size: 2.2rem;
    }

    .section_stats__label {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .section_stats__title {
        font-size: 1.5rem;
        margin-bottom: 30px;
    }

    .section_stats__wrapper {
        padding: 30px 10px;
        border-radius: 8px;
    }

    .section_stats__card {
        padding: 20px 10px;
        min-height: 160px;
    }

    .section_stats__number {
        font-size: 1.8rem;
    }

    .section_stats__label {
        font-size: 0.75rem;
    }

    .section_stats__grid {
        gap: 15px;
    }
}
