/* ===================================
   STATISTICS SECTION STYLES
   =================================== */

.stats {
    padding: var(--spacing-5xl) 0;
    background: linear-gradient(135deg, 
        var(--dark-color) 0%, 
        var(--dark-secondary) 50%,
        var(--primary-dark) 100%);
    position: relative;
    overflow: hidden;
    color: var(--white);
}

.stats::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><defs><pattern id="stats-pattern" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%2300d4ff" opacity="0.1"/><circle cx="0" cy="0" r="1" fill="%2300d4ff" opacity="0.05"/><circle cx="100" cy="100" r="1" fill="%2300d4ff" opacity="0.05"/></pattern></defs><rect width="100%" height="100%" fill="url(%23stats-pattern)"/></svg>');
    opacity: 0.3;
    animation: float-pattern 20s ease-in-out infinite;
}

.stats::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, 
        rgba(0, 212, 255, 0.1) 0%, 
        transparent 50%);
    animation: rotate-slow 30s linear infinite;
    pointer-events: none;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-2xl);
    position: relative;
    z-index: 2;
}

/* Individual Stat Item */
.stat-item {
    text-align: center;
    padding: var(--spacing-2xl);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(0, 212, 255, 0.1) 50%, 
        transparent 100%);
    transition: left var(--transition-slow);
}

.stat-item:hover::before {
    left: 100%;
}

.stat-item:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 20px 40px rgba(0, 212, 255, 0.2);
}

/* Stat Icon */
.stat-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    background: linear-gradient(135deg, 
        rgba(0, 212, 255, 0.2) 0%, 
        rgba(0, 102, 204, 0.2) 100%);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition-normal);
    border: 2px solid rgba(0, 212, 255, 0.3);
}

.stat-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    border-radius: 50%;
    transition: all var(--transition-slow);
    transform: translate(-50%, -50%);
    z-index: 1;
}

.stat-item:hover .stat-icon::before {
    width: 120%;
    height: 120%;
}

.stat-icon i {
    font-size: var(--fs-3xl);
    color: var(--accent-color);
    transition: all var(--transition-normal);
    position: relative;
    z-index: 2;
}

.stat-item:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
    border-color: var(--accent-color);
}

.stat-item:hover .stat-icon i {
    color: var(--white);
    transform: scale(1.1);
}

/* Stat Content */
.stat-content {
    position: relative;
    z-index: 2;
}

.stat-number {
    font-size: var(--fs-6xl);
    font-weight: 800;
    color: var(--white);
    display: block;
    margin-bottom: var(--spacing-sm);
    line-height: 1;
    position: relative;
    transition: all var(--transition-normal);
}

.stat-number::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
    border-radius: 2px;
    transition: width var(--transition-normal);
}

.stat-item:hover .stat-number::after {
    width: 100%;
}

.stat-number.counting {
    animation: number-glow 0.5s ease-out;
}

.stat-label {
    font-size: var(--fs-lg);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.3;
    transition: color var(--transition-normal);
}

.stat-item:hover .stat-label {
    color: var(--white);
}

/* Special Number Formatting */
.stat-number .number-prefix,
.stat-number .number-suffix {
    font-size: 0.6em;
    vertical-align: top;
    color: var(--accent-color);
    font-weight: 600;
}

.stat-number .number-suffix {
    vertical-align: baseline;
    margin-left: 2px;
}

/* Animated Counter */
.stat-number.animate-in {
    animation: count-up 2s ease-out;
}

/* Enhanced Stat Variants */
.stat-item.stat-primary {
    background: rgba(0, 102, 204, 0.1);
    border-color: rgba(0, 102, 204, 0.3);
}

.stat-item.stat-primary:hover {
    background: rgba(0, 102, 204, 0.2);
    border-color: var(--primary-color);
}

.stat-item.stat-accent {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.stat-item.stat-accent:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-color);
}

.stat-item.stat-success {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.3);
}

.stat-item.stat-success:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
}

/* Progress Ring (Optional Enhancement) */
.stat-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    pointer-events: none;
}

.stat-progress svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.stat-progress circle {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
}

.stat-progress .progress-bg {
    stroke: rgba(255, 255, 255, 0.1);
}

.stat-progress .progress-fill {
    stroke: var(--accent-color);
    stroke-dasharray: 314;
    stroke-dashoffset: 314;
    transition: stroke-dashoffset 2s ease-out;
}

.stat-item.animated .stat-progress .progress-fill {
    stroke-dashoffset: 0;
}

/* Stats Section Header (if needed) */
.stats-header {
    text-align: center;
    margin-bottom: var(--spacing-4xl);
    position: relative;
    z-index: 2;
}

.stats-header h2 {
    font-size: var(--fs-4xl);
    color: var(--white);
    margin-bottom: var(--spacing-md);
}

.stats-header p {
    font-size: var(--fs-lg);
    color: rgba(255, 255, 255, 0.8);
    max-width: 600px;
    margin: 0 auto;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: var(--spacing-xl);
    }
    
    .stat-item {
        padding: var(--spacing-xl);
    }
    
    .stat-icon {
        width: 70px;
        height: 70px;
        margin-bottom: var(--spacing-md);
    }
    
    .stat-icon i {
        font-size: var(--fs-2xl);
    }
    
    .stat-number {
        font-size: var(--fs-5xl);
    }
    
    .stat-label {
        font-size: var(--fs-base);
    }
}

@media (max-width: 768px) {
    .stats {
        padding: var(--spacing-4xl) 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
    
    .stat-item {
        padding: var(--spacing-lg);
    }
    
    .stat-icon {
        width: 60px;
        height: 60px;
    }
    
    .stat-icon i {
        font-size: var(--fs-xl);
    }
    
    .stat-number {
        font-size: var(--fs-4xl);
    }
    
    .stat-label {
        font-size: var(--fs-sm);
    }
    
    .stats-header h2 {
        font-size: var(--fs-3xl);
    }
    
    .stats-header p {
        font-size: var(--fs-base);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .stat-item {
        padding: var(--spacing-md);
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        margin-bottom: var(--spacing-sm);
    }
    
    .stat-icon i {
        font-size: var(--fs-lg);
    }
    
    .stat-number {
        font-size: var(--fs-3xl);
        margin-bottom: var(--spacing-xs);
    }
    
    .stat-label {
        font-size: var(--fs-xs);
    }
}

/* Animation Keyframes */
@keyframes float-pattern {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(10px, -10px) rotate(1deg); }
    50% { transform: translate(-5px, 5px) rotate(-1deg); }
    75% { transform: translate(-10px, -5px) rotate(0.5deg); }
}

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes number-glow {
    0% { text-shadow: none; }
    50% { text-shadow: 0 0 20px var(--accent-color); }
    100% { text-shadow: none; }
}

@keyframes count-up {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 212, 255, 0.6);
    }
}

/* Intersection Observer Animation Classes */
.stat-item.aos-animate .stat-number {
    animation: count-up 1s ease-out;
}

.stat-item.aos-animate .stat-icon {
    animation: pulse-glow 2s ease-out infinite;
}

/* Loading State */
.stats.loading .stat-number {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.1) 25%, 
        rgba(255, 255, 255, 0.3) 50%, 
        rgba(255, 255, 255, 0.1) 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    color: transparent;
    border-radius: var(--radius-sm);
}

@keyframes loading-shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .stats {
        background: var(--dark-color);
    }
    
    .stat-item {
        border: 2px solid var(--white);
        background: rgba(255, 255, 255, 0.1);
    }
    
    .stat-icon {
        border: 2px solid var(--accent-color);
    }
    
    .stat-number,
    .stat-label {
        color: var(--white);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .stats::before,
    .stats::after {
        animation: none;
    }
    
    .stat-item,
    .stat-icon,
    .stat-number,
    .stat-progress circle {
        transition: none;
        animation: none;
    }
    
    .stat-item:hover {
        transform: none;
    }
    
    .stat-item:hover .stat-icon {
        transform: none;
    }
}

/* Print Styles */
@media print {
    .stats {
        background: var(--white);
        color: var(--dark-color);
        padding: var(--spacing-xl) 0;
    }
    
    .stats::before,
    .stats::after {
        display: none;
    }
    
    .stat-item {
        background: var(--white);
        border: 1px solid var(--gray-light);
        box-shadow: none;
        break-inside: avoid;
        margin-bottom: var(--spacing-lg);
    }
    
    .stat-number,
    .stat-label {
        color: var(--dark-color);
    }
    
    .stat-icon {
        background: var(--gray-light);
        border-color: var(--gray-medium);
    }
    
    .stat-icon i {
        color: var(--primary-color);
    }
}