/* =====================================================
   LEH · Stats Counter - CSS
   4 styles : simple, gradient, glassmorphism, outline
   3 animations : classic, gauge, icon
   ===================================================== */

.leh-stats-counter {
    position: relative;
}

/* ---------- EN-TÊTE ---------- */
.leh-stats-header {
    text-align: center;
    margin-bottom: 50px;
}

.leh-stats-pretitle {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 13px;
    font-weight: 600;
    color: #4A7C3B;
    margin-bottom: 16px;
    position: relative;
    padding: 0 30px;
}

.leh-stats-pretitle::before,
.leh-stats-pretitle::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 20px;
    height: 1px;
    background: currentColor;
}
.leh-stats-pretitle::before { left: 0; }
.leh-stats-pretitle::after  { right: 0; }

.leh-stats-title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    line-height: 1.2;
    color: #1B4D2E;
    margin: 0 0 16px 0;
}

.leh-stats-subtitle {
    font-size: 16px;
    line-height: 1.6;
    color: #5A5A5A;
    max-width: 720px;
    margin: 0 auto;
}

/* ---------- GRILLE ---------- */
.leh-stats-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* ---------- CARD COMMUN ---------- */
.leh-stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 36px 24px;
    border-radius: 16px;
    background-color: #FFFFFF;
    box-shadow: 0 8px 24px rgba(27,77,46,0.08);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s ease,
                background-color 0.4s ease,
                border-color 0.4s ease;
    overflow: hidden;
}

.leh-stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(27,77,46,0.18);
}

/* === STYLE 1 : SIMPLE === */
.leh-stat-card[data-style="simple"] {
    background-color: #FFFFFF;
}

/* === STYLE 2 : GRADIENT === */
.leh-stat-card[data-style="gradient"] {
    background: linear-gradient(135deg, #1B4D2E 0%, #4A7C3B 100%);
    border: 1px solid transparent;
}

.leh-stat-card[data-style="gradient"]::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

.leh-stat-card[data-style="gradient"]::after {
    content: "";
    position: absolute;
    top: -40%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(122,181,92,0.25) 0%, transparent 70%);
    z-index: 0;
    transition: transform 0.6s ease;
    pointer-events: none;
}

.leh-stat-card[data-style="gradient"]:hover::after {
    transform: scale(1.4);
}

.leh-stat-card[data-style="gradient"] > * {
    position: relative;
    z-index: 1;
}

/* === STYLE 3 : GLASSMORPHISM === */
.leh-stat-card[data-style="glassmorphism"] {
    background-color: rgba(255,255,255,0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.4);
}

.leh-stat-card[data-style="glassmorphism"]:hover {
    background-color: rgba(255,255,255,0.8);
    border-color: rgba(122,181,92,0.4);
}

/* === STYLE 4 : OUTLINE === */
.leh-stat-card[data-style="outline"] {
    background-color: transparent;
    box-shadow: none;
    border: 2px solid #4A7C3B;
}

.leh-stat-card[data-style="outline"]:hover {
    background-color: rgba(74,124,59,0.05);
    box-shadow: 0 12px 28px rgba(27,77,46,0.12);
}

/* ---------- ICÔNE (modes classic & icon) ---------- */
.leh-stat-icon-wrapper {
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
    max-width: 72px;
    max-height: 72px;
    flex: 0 0 72px;
    border-radius: 50%;
    background-color: rgba(74,124,59,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.leh-stat-card:hover .leh-stat-icon-wrapper {
    transform: scale(1.1) rotate(-5deg);
}

.leh-stat-icon {
    color: #4A7C3B;
    font-size: 32px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leh-stat-icon i { line-height: 1; }
.leh-stat-icon svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

/* === Animation icône (mode "icon") === */
.leh-anim-icon .leh-stat-card.is-animated .leh-stat-icon-wrapper {
    animation: leh-icon-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: var(--leh-delay, 0ms);
}

.leh-anim-icon .leh-stat-icon-wrapper {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
}

@keyframes leh-icon-pop {
    0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
    60%  { transform: scale(1.15) rotate(15deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ---------- CHIFFRE ---------- */
.leh-stat-number-wrapper {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    margin-bottom: 10px;
    line-height: 1.1;
}

.leh-stat-number {
    font-size: 54px;
    font-weight: 800;
    line-height: 1.1;
    color: #1B4D2E;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

.leh-stat-prefix,
.leh-stat-suffix {
    font-size: 65%;
    font-weight: 700;
    color: inherit;
    opacity: 0.85;
    line-height: 1;
}

/* ---------- TITRE & DESCRIPTION ---------- */
.leh-stat-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: #1B4D2E;
    margin: 0 0 6px 0;
}

.leh-stat-description {
    font-size: 14px;
    line-height: 1.5;
    color: #5A5A5A;
    margin: 0;
}

/* =====================================================
   MODE JAUGE CIRCULAIRE
   ===================================================== */
.leh-stat-gauge {
    position: relative;
    width: 180px;
    height: 180px;
    margin-bottom: 18px;
}

.leh-stat-gauge svg {
    width: 100%;
    height: 100%;
    display: block;
}

.leh-stat-gauge-track {
    stroke: rgba(74,124,59,0.15);
}

/* Cercle SVG circonference = 2 * PI * r = 2 * PI * 45 ≈ 282.74 */
.leh-stat-gauge-progress {
    stroke: #4A7C3B;
    stroke-linecap: round;
    stroke-dasharray: 282.74;
    stroke-dashoffset: 282.74;
    transition: stroke-dashoffset 2s cubic-bezier(0.16, 1, 0.3, 1);
}

.leh-stat-card.is-animated .leh-stat-gauge-progress {
    transition-delay: var(--leh-delay, 0ms);
}

/* En gradient, la jauge devient blanche pour contraste */
.leh-stat-card[data-style="gradient"] .leh-stat-gauge-track {
    stroke: rgba(255,255,255,0.2);
}

.leh-stat-card[data-style="gradient"] .leh-stat-gauge-progress {
    stroke: #FFFFFF;
}

/* Contenu au centre de la jauge */
.leh-stat-gauge-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.leh-stat-gauge-icon {
    color: #4A7C3B;
    font-size: 24px;
    line-height: 1;
    margin-bottom: 4px;
}

.leh-stat-card[data-style="gradient"] .leh-stat-gauge-icon {
    color: #FFFFFF;
}

.leh-stat-gauge-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.leh-stat-gauge-content .leh-stat-number-wrapper {
    margin-bottom: 0;
}

.leh-stat-gauge-content .leh-stat-number {
    font-size: 40px;
}

/* =====================================================
   ANIMATION D'APPARITION DES CARDS
   ===================================================== */
.leh-stats-counter .leh-stat-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s ease,
                background-color 0.4s ease,
                border-color 0.4s ease;
    transition-delay: var(--leh-delay, 0ms);
}

.leh-stats-counter.is-animated .leh-stat-card {
    opacity: 1;
    transform: translateY(0);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .leh-stats-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    html body .leh-stats-counter .leh-stats-header {
        margin-bottom: 32px !important;
    }
    html body .leh-stats-counter .leh-stats-pretitle {
        font-size: 11px !important;
        letter-spacing: 2px !important;
    }
    html body .leh-stats-counter .leh-stats-title {
        font-size: clamp(24px, 6vw, 32px) !important;
    }
    html body .leh-stats-counter .leh-stats-subtitle {
        font-size: 14px !important;
    }

    html body .leh-stats-counter .leh-stats-list {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    html body .leh-stats-counter .leh-stat-card {
        padding: 28px 22px !important;
    }

    html body .leh-stats-counter .leh-stat-icon-wrapper {
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        min-height: 60px !important;
        max-width: 60px !important;
        max-height: 60px !important;
        flex: 0 0 60px !important;
        margin-bottom: 16px !important;
    }

    html body .leh-stats-counter .leh-stat-icon {
        font-size: 26px !important;
    }
    html body .leh-stats-counter .leh-stat-icon svg {
        width: 26px !important;
        height: 26px !important;
    }

    html body .leh-stats-counter .leh-stat-number {
        font-size: 44px !important;
    }

    html body .leh-stats-counter .leh-stat-gauge {
        width: 150px !important;
        height: 150px !important;
    }
    html body .leh-stats-counter .leh-stat-gauge-content .leh-stat-number {
        font-size: 32px !important;
    }
    html body .leh-stats-counter .leh-stat-gauge-icon svg {
        width: 20px !important;
        height: 20px !important;
    }

    html body .leh-stats-counter .leh-stat-title {
        font-size: 16px !important;
    }
    html body .leh-stats-counter .leh-stat-description {
        font-size: 13px !important;
    }

    html body .leh-stats-counter {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* =====================================================
   ACCESSIBILITÉ
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    .leh-stat-card,
    .leh-stat-icon-wrapper,
    .leh-stat-gauge-progress {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
        stroke-dashoffset: 0 !important;
    }
}
