<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Estadísticas &#8211; Fusion Core 7</title>
	<atom:link href="https://fc7.es/category/estadisticas/feed/" rel="self" type="application/rss+xml" />
	<link>https://fc7.es</link>
	<description></description>
	<lastBuildDate>Wed, 01 Oct 2025 21:36:37 +0000</lastBuildDate>
	<language>es</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://fc7.es/wp-content/uploads/2025/08/cropped-cropped-image-150x150.png</url>
	<title>Estadísticas &#8211; Fusion Core 7</title>
	<link>https://fc7.es</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Estadísticas de la Liga</title>
		<link>https://fc7.es/2025/10/01/1388/</link>
					<comments>https://fc7.es/2025/10/01/1388/#respond</comments>
		
		<dc:creator><![CDATA[jesusperez]]></dc:creator>
		<pubDate>Wed, 01 Oct 2025 21:02:44 +0000</pubDate>
				<category><![CDATA[Estadísticas]]></category>
		<guid isPermaLink="false">https://fc7.es/?p=1388</guid>

					<description><![CDATA[Estadísticas en Tiempo Real &#8211; Liga de Billar Estadísticas en Tiempo Real Liga de Billar &#8211; Datos actualizados al instante Cargando estadísticas&#8230; Conectando con la base de datos&#8230;]]></description>
										<content:encoded><![CDATA[
<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Estadísticas en Tiempo Real &#8211; Liga de Billar</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f8f9fa;
            color: #333;
            line-height: 1.6;
            padding: 20px;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
        }

        .header {
            text-align: center;
            margin-bottom: 40px;
            padding: 20px;
            border-bottom: 1px solid #eaeaea;
        }

        .header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
            color: #2c5530;
            font-weight: 600;
        }

        .header p {
            font-size: 1.1em;
            color: #666;
        }

        .last-update {
            text-align: center;
            color: #666;
            margin-bottom: 30px;
            font-style: italic;
            background: #fff;
            padding: 10px 15px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            display: inline-block;
            margin: 0 auto 30px;
        }

        .liga-billar-estadisticas {
            background: white;
            border-radius: 12px;
            padding: 30px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.08);
            margin-bottom: 30px;
        }

        .liga-billar-estadisticas h2 {
            color: #1a472a;
            padding-bottom: 15px;
            margin-bottom: 25px;
            font-size: 1.8em;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .liga-billar-estadisticas h3 {
            color: #2c5530;
            margin: 30px 0 20px 0;
            padding-bottom: 10px;
            border-bottom: 2px solid #f0f0f0;
            font-size: 1.4em;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .estadisticas-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 20px;
            margin: 25px 0;
        }

        .estadistica-item {
            text-align: center;
            padding: 25px 15px;
            background: #f8f9fa;
            border-radius: 10px;
            transition: all 0.3s ease;
            border: 1px solid #eaeaea;
            position: relative;
            overflow: hidden;
        }

        .estadistica-item::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 4px;
            background: linear-gradient(90deg, #2c5530, #4a6572);
        }

        .estadistica-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }

        .estadistica-icono {
            font-size: 2.2em;
            margin-bottom: 15px;
            color: #2c5530;
        }

        .estadistica-valor {
            font-size: 2.2em;
            font-weight: bold;
            color: #1a472a;
            margin: 10px 0;
        }

        .estadistica-label {
            font-size: 0.95em;
            color: #666;
            font-weight: 500;
        }

        .jugador-destacado-section,
        .top-jugadores-section,
        .estadisticas-avanzadas {
            margin-top: 40px;
            padding: 25px;
            background: #f8f9fa;
            border-radius: 10px;
            border: 1px solid #eaeaea;
        }

        .jugador-destacado {
            padding: 20px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 3px 10px rgba(0,0,0,0.08);
            border-left: 4px solid #ffc107;
        }

        .jugador-info {
            display: flex;
            align-items: center;
            gap: 25px;
        }

        .jugador-avatar {
            flex-shrink: 0;
        }

        .jugador-avatar img,
        .jugador-avatar .avatar-placeholder,
        .jugador-avatar div {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            object-fit: cover;
            border: 3px solid #ffc107;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }

        .avatar-placeholder {
            background: linear-gradient(135deg, #ffc107, #ffcd39);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.5em;
            color: white;
        }

        .jugador-datos h4 {
            font-size: 1.6em;
            color: #1a472a;
            margin-bottom: 15px;
        }

        .jugador-stats {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 15px;
        }

        .jugador-stats .stat {
            padding: 8px 16px;
            background: #fff9e6;
            border-radius: 20px;
            font-size: 0.9em;
            border: 1px solid #ffe066;
            font-weight: 500;
            color: #856404;
        }

        .top-jugadores-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 20px;
            margin-top: 20px;
        }

        .top-jugador-card {
            display: flex;
            align-items: center;
            padding: 20px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 3px 10px rgba(0,0,0,0.08);
            gap: 20px;
            transition: all 0.3s ease;
            border-left: 4px solid #4a6572;
        }

        .top-jugador-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }

        .top-jugador-posicion {
            background: linear-gradient(135deg, #4a6572, #344955);
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 1.1em;
            box-shadow: 0 3px 6px rgba(0,0,0,0.1);
        }

        .top-jugador-avatar img,
        .top-jugador-avatar .avatar-placeholder,
        .top-jugador-avatar div {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid #4a6572;
        }

        .top-jugador-info h5 {
            font-size: 1.2em;
            color: #2c5530;
            margin-bottom: 8px;
        }

        .top-jugador-stats {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .stat-mini {
            font-size: 0.85em;
            color: #666;
            font-weight: 500;
        }

        .avanzadas-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 25px;
            margin-top: 20px;
        }

        .avanzada-card {
            padding: 20px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 3px 10px rgba(0,0,0,0.08);
        }

        .avanzada-card h4 {
            margin-bottom: 20px;
            color: #2c5530;
            padding-bottom: 10px;
            border-bottom: 2px solid #f0f0f0;
            font-size: 1.3em;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .distribucion-item,
        .total-item {
            display: flex;
            justify-content: space-between;
            padding: 12px 0;
            border-bottom: 1px solid #f0f0f0;
            align-items: center;
        }

        .distribucion-item:last-child,
        .total-item:last-child {
            border-bottom: none;
        }

        .distribucion-label,
        .total-label {
            font-weight: 500;
            color: #555;
        }

        .distribucion-valor,
        .total-valor {
            font-weight: bold;
            color: #1a472a;
            background: rgba(26, 71, 42, 0.1);
            padding: 4px 12px;
            border-radius: 15px;
        }

        .loading {
            text-align: center;
            padding: 40px;
            color: #666;
        }

        .loading-spinner {
            border: 4px solid #f3f3f3;
            border-top: 4px solid #1a472a;
            border-radius: 50%;
            width: 50px;
            height: 50px;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .error-message {
            background: #f8d7da;
            color: #721c24;
            padding: 20px;
            border-radius: 8px;
            border: 1px solid #f5c6cb;
            text-align: center;
            margin: 20px 0;
        }

        .notice {
            padding: 15px;
            background: #fff3cd;
            border-left: 4px solid #ffc107;
            margin: 20px 0;
            border-radius: 4px;
            color: #856404;
        }

        .notice-warning {
            background: #fff3cd;
            border-left-color: #ffc107;
        }

        .notice-info {
            background: #d1ecf1;
            border-left-color: #17a2b8;
            color: #0c5460;
        }

        .stats-highlight {
            background: linear-gradient(135deg, #e3f2fd, #bbdefb);
            border-radius: 10px;
            padding: 15px;
            margin: 20px 0;
            text-align: center;
            border-left: 4px solid #2196f3;
        }

        /* Estilos específicos para los avatares de WordPress */
        .avatar-container {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .avatar-container img {
            border-radius: 50%;
            object-fit: cover;
        }

        @media (max-width: 768px) {
            .estadisticas-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            
            .jugador-info {
                flex-direction: column;
                text-align: center;
            }
            
            .jugador-stats {
                justify-content: center;
            }
            
            .top-jugadores-grid {
                grid-template-columns: 1fr;
            }
            
            .avanzadas-grid {
                grid-template-columns: 1fr;
            }
            
            .header h1 {
                font-size: 2.2em;
            }
        }

        @media (max-width: 480px) {
            .estadisticas-grid {
                grid-template-columns: 1fr;
            }
            
            .container {
                padding: 10px;
            }
            
            .liga-billar-estadisticas {
                padding: 20px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1><i class="fas fa-chart-line"></i> Estadísticas en Tiempo Real</h1>
            <p>Liga de Billar &#8211; Datos actualizados al instante</p>
        </div>

        <div class="last-update" id="lastUpdate">
            <i class="fas fa-sync-alt"></i> Cargando estadísticas&#8230;
        </div>

        <div id="estadisticasContainer">
            <div class="loading">
                <div class="loading-spinner"></div>
                <p>Conectando con la base de datos&#8230;</p>
            </div>
        </div>
    </div>

    <script>
        // URL de tu WordPress
        const WORDPRESS_URL = 'https://fc7.es';
        
        // Elementos del DOM
        const container = document.getElementById('estadisticasContainer');
        const lastUpdate = document.getElementById('lastUpdate');

        // Función para formatear fecha
        function formatDate(date) {
            return new Intl.DateTimeFormat('es-ES', {
                year: 'numeric',
                month: 'long',
                day: 'numeric',
                hour: '2-digit',
                minute: '2-digit',
                second: '2-digit'
            }).format(date);
        }

        // Función para cargar estadísticas REALES desde WordPress
        async function cargarEstadisticasReales() {
            try {
                const apiUrl = `${WORDPRESS_URL}/wp-json/liga-billar/v1/estadisticas`;
                
                const response = await fetch(apiUrl);
                
                if (!response.ok) {
                    throw new Error(`Error HTTP: ${response.status}`);
                }
                
                const data = await response.json();
                
                if (data.success && data.data) {
                    mostrarEstadisticas(data.data);
                } else {
                    throw new Error('Formato de respuesta inválido');
                }
                
            } catch (error) {
                console.error('Error:', error);
                mostrarError('Error al cargar las estadísticas: ' + error.message);
            }
        }

        // Función para mostrar estadísticas en el HTML
        function mostrarEstadisticas(estadisticas) {
            const now = new Date();
            lastUpdate.innerHTML = `<i class="fas fa-sync-alt"></i> Última actualización: ${formatDate(now)}`;

            container.innerHTML = `
                <div class="liga-billar-estadisticas">
                    <h2><i class="fas fa-trophy"></i> Estadísticas de la Temporada</h2>
                    
                    <!-- Estadísticas principales -->
                    <div class="estadisticas-principales">
                        <h3><i class="fas fa-chart-bar"></i> Resumen General</h3>
                        <div class="estadisticas-grid">
                            <div class="estadistica-item">
                                <div class="estadistica-icono"><i class="fas fa-users"></i></div>
                                <div class="estadistica-valor">${estadisticas.total_jugadores}</div>
                                <div class="estadistica-label">Jugadores</div>
                            </div>
                            
                            <div class="estadistica-item">
                                <div class="estadistica-icono"><i class="fas fa-table-tennis"></i></div>
                                <div class="estadistica-valor">${estadisticas.total_partidos}</div>
                                <div class="estadistica-label">Partidos Totales</div>
                            </div>
                            
                            <div class="estadistica-item">
                                <div class="estadistica-icono"><i class="fas fa-check-circle"></i></div>
                                <div class="estadistica-valor">${estadisticas.partidos_jugados}</div>
                                <div class="estadistica-label">Partidos Jugados</div>
                            </div>
                            
                            <div class="estadistica-item">
                                <div class="estadistica-icono"><i class="fas fa-clock"></i></div>
                                <div class="estadistica-valor">${estadisticas.partidos_pendientes}</div>
                                <div class="estadistica-label">Partidos Pendientes</div>
                            </div>
                            
                            <div class="estadistica-item">
                                <div class="estadistica-icono"><i class="fas fa-chart-pie"></i></div>
                                <div class="estadistica-valor">${estadisticas.estadisticas_generales.porcentaje_completado}%</div>
                                <div class="estadistica-label">Completado</div>
                            </div>
                            
                            <div class="estadistica-item">
                                <div class="estadistica-icono"><i class="fas fa-bullseye"></i></div>
                                <div class="estadistica-valor">${estadisticas.estadisticas_generales.promedio_juegos_por_partido}</div>
                                <div class="estadistica-label">Juegos/Partido</div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- Resumen destacado -->
                    <div class="stats-highlight">
                        <h4><i class="fas fa-star"></i> Resumen de la Temporada</h4>
                        <p>La temporada actual cuenta con <strong>${estadisticas.total_jugadores} jugadores</strong> y <strong>${estadisticas.total_partidos} partidos programados</strong>. 
                        Hasta el momento, se han jugado <strong>${estadisticas.partidos_jugados} partidos</strong> (${estadisticas.estadisticas_generales.porcentaje_completado}% completado).</p>
                    </div>
                    
                    <!-- Mensajes informativos -->
                    ${estadisticas.total_jugadores == 0 ? `
                    <div class="notice notice-warning">
                        <i class="fas fa-exclamation-triangle"></i> No hay jugadores en esta temporada.
                    </div>
                    ` : ''}
                    
                    ${estadisticas.partidos_jugados == 0 ? `
                    <div class="notice notice-info">
                        <i class="fas fa-info-circle"></i> No hay partidos jugados en esta temporada todavía.
                    </div>
                    ` : ''}
                    
                    <!-- Jugador Destacado -->
                    ${estadisticas.jugador_destacado && Object.keys(estadisticas.jugador_destacado).length > 0 ? `
                    <div class="jugador-destacado-section">
                        <h3><i class="fas fa-crown"></i> Jugador Destacado</h3>
                        <div class="jugador-destacado">
                            <div class="jugador-info">
                                <div class="jugador-avatar">
                                    ${estadisticas.jugador_destacado.avatar_html ? 
                                        `<div class="avatar-container">${estadisticas.jugador_destacado.avatar_html}</div>` :
                                        `<div class="avatar-placeholder"><i class="fas fa-user"></i></div>`
                                    }
                                </div>
                                <div class="jugador-datos">
                                    <h4>${estadisticas.jugador_destacado.nombre}</h4>
                                    <div class="jugador-stats">
                                        <span class="stat"><i class="fas fa-trophy"></i> ${estadisticas.jugador_destacado.puntos} puntos</span>
                                        <span class="stat"><i class="fas fa-check"></i> ${estadisticas.jugador_destacado.victorias} victorias</span>
                                        <span class="stat"><i class="fas fa-times"></i> ${estadisticas.jugador_destacado.derrotas} derrotas</span>
                                        <span class="stat"><i class="fas fa-table-tennis"></i> ${estadisticas.jugador_destacado.partidos_jugados} partidos</span>
                                        <span class="stat"><i class="fas fa-chart-line"></i> ${estadisticas.jugador_destacado.porcentaje_victorias}% efectividad</span>
                                        <span class="stat"><i class="fas fa-plus"></i> +${estadisticas.jugador_destacado.diferencia_juegos} dif. juegos</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    ` : ''}
                    
                    <!-- Top Jugadores -->
                    ${estadisticas.jugadores_destacados && estadisticas.jugadores_destacados.length > 0 ? `
                    <div class="top-jugadores-section">
                        <h3><i class="fas fa-medal"></i> Top ${estadisticas.jugadores_destacados.length} Jugadores</h3>
                        <div class="top-jugadores-grid">
                            ${estadisticas.jugadores_destacados.map((jugador, index) => `
                            <div class="top-jugador-card">
                                <div class="top-jugador-posicion">#${index + 1}</div>
                                <div class="top-jugador-avatar">
                                    ${jugador.avatar_html ? 
                                        `<div class="avatar-container">${jugador.avatar_html}</div>` :
                                        `<div class="avatar-placeholder">${index === 0 ? '<i class="fas fa-crown"></i>' : '<i class="fas fa-medal"></i>'}</div>`
                                    }
                                </div>
                                <div class="top-jugador-info">
                                    <h5>${jugador.nombre}</h5>
                                    <div class="top-jugador-stats">
                                        <span class="stat-mini"><i class="fas fa-trophy"></i> ${jugador.puntos} pts</span>
                                        <span class="stat-mini"><i class="fas fa-check"></i> ${jugador.victorias} V</span>
                                        <span class="stat-mini"><i class="fas fa-chart-line"></i> ${jugador.porcentaje_victorias}%</span>
                                        <span class="stat-mini"><i class="fas fa-plus"></i> +${jugador.diferencia_juegos}</span>
                                    </div>
                                </div>
                            </div>
                            `).join('')}
                        </div>
                    </div>
                    ` : ''}
                    
                    <!-- Estadísticas Avanzadas -->
                    ${estadisticas.distribucion_victorias ? `
                    <div class="estadisticas-avanzadas">
                        <h3><i class="fas fa-chart-area"></i> Estadísticas Avanzadas</h3>
                        <div class="avanzadas-grid">
                            <div class="avanzada-card">
                                <h4><i class="fas fa-chart-pie"></i> Distribución de Victorias</h4>
                                <div class="distribucion-victorias">
                                    <div class="distribucion-item">
                                        <span class="distribucion-label">Menos del 25%:</span>
                                        <span class="distribucion-valor">${estadisticas.distribucion_victorias.menos_25} jugadores</span>
                                    </div>
                                    <div class="distribucion-item">
                                        <span class="distribucion-label">25% - 50%:</span>
                                        <span class="distribucion-valor">${estadisticas.distribucion_victorias['25_50']} jugadores</span>
                                    </div>
                                    <div class="distribucion-item">
                                        <span class="distribucion-label">50% - 75%:</span>
                                        <span class="distribucion-valor">${estadisticas.distribucion_victorias['50_75']} jugadores</span>
                                    </div>
                                    <div class="distribucion-item">
                                        <span class="distribucion-label">Más del 75%:</span>
                                        <span class="distribucion-valor">${estadisticas.distribucion_victorias.mas_75} jugadores</span>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="avanzada-card">
                                <h4><i class="fas fa-list-ol"></i> Totales de Juego</h4>
                                <div class="totales-juego">
                                    <div class="total-item">
                                        <span class="total-label">Juegos ganados:</span>
                                        <span class="total-valor">${estadisticas.estadisticas_generales.total_juegos_ganados}</span>
                                    </div>
                                    <div class="total-item">
                                        <span class="total-label">Juegos perdidos:</span>
                                        <span class="total-valor">${estadisticas.estadisticas_generales.total_juegos_perdidos}</span>
                                    </div>
                                    <div class="total-item">
                                        <span class="total-label">Total de juegos:</span>
                                        <span class="total-valor">${estadisticas.estadisticas_generales.total_juegos_ganados + estadisticas.estadisticas_generales.total_juegos_perdidos}</span>
                                    </div>
                                    <div class="total-item">
                                        <span class="total-label">Relación ganados/perdidos:</span>
                                        <span class="total-valor">${(estadisticas.estadisticas_generales.total_juegos_ganados / estadisticas.estadisticas_generales.total_juegos_perdidos).toFixed(2)}:1</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    ` : ''}
                </div>
            `;
        }

        // Función para mostrar errores
        function mostrarError(mensaje) {
            container.innerHTML = `
                <div class="error-message">
                    <h3><i class="fas fa-exclamation-triangle"></i> Error de Conexión</h3>
                    <p>${mensaje}</p>
                    <button onclick="cargarEstadisticasReales()" style="margin-top: 15px; padding: 10px 20px; background: #dc3545; color: white; border: none; border-radius: 5px; cursor: pointer;">
                        <i class="fas fa-redo"></i> Reintentar Conexión
                    </button>
                </div>
            `;
        }

        // Cargar estadísticas al iniciar
        document.addEventListener('DOMContentLoaded', cargarEstadisticasReales);

        // Recargar automáticamente cada 2 minutos
        setInterval(cargarEstadisticasReales, 2 * 60 * 1000);
    </script>
</body>
</html>
]]></content:encoded>
					
					<wfw:commentRss>https://fc7.es/2025/10/01/1388/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
