/* Variables */
:root {
    --primary: #003366;
    --secondary: #009f4d;
    --background: #f5f5f5;
    --text: #333;
    --border: #ddd;
    --highlight: #ff4612;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background-color: var(--background);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 100%;
    padding: 1rem;
    margin: 0 auto;
}

/* Header */
header {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 1rem 0;
    border-bottom: 2px solid var(--primary);
}

.logo {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
}

h1 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

h2 {
    color: var(--primary);
    margin: 1rem 0;
    text-align: center;
}

h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Tabla de clasificación */
.tabla-container {
    overflow-x: auto;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px var(--shadow);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead {
    background-color: var(--primary);
    color: white;
}

th, td {
    padding: 0.5rem 0.3rem;
    text-align: center;
    font-size: 0.85rem;
}

th:nth-child(2), td:nth-child(2) {
    text-align: left;
    min-width: 120px;
}

th {
    position:!important;
}

th .tooltip {
    visibility: hidden;
    width: auto;
    min-width: 120px;
    background-color: #003366;
    color: white;
    text-align: center;
    border-radius: 4px;
    padding: 5px;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: normal;
    font-size: 0.75rem;
    white-space: nowrap;
}

th .tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #003366 transparent transparent transparent;
}

th:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

tbody tr:nth-child(odd) {
    background-color: #fff;
}

tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

tbody tr:hover {
    background-color: #eef7ff;
    cursor: pointer;
}

/* Zonas de clasificación */
.zona-champions {
    border-left: 4px solid #4CAF50;
}

.zona-europa {
    border-left: 4px solid #2196F3;
}

.zona-descenso {
    border-left: 4px solid #F44336;
}

/* Botones */
.btn, .btn-volver {
    display: block;
    padding: 0.8rem 1.5rem;
    background-color: var(--secondary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    margin: 1rem auto;
    transition: background-color 0.3s;
}

.btn:hover, .btn-volver:hover {
    background-color: #008040;
}

.btn-volver {
    margin: 0.5rem 0 1rem;
    background-color: #666;
}

.btn-volver:hover {
    background-color: #444;
}

/* Botón de información */
.info-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: var(--primary);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}

.info-button:hover {
    background-color: white;
    color: var(--primary);
    border-color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.close-modal:hover {
    color: #000;
}

/* Contenedor de gráficos */
.chart-container {
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    box-shadow: 0 2px 8px var(--shadow);
    height: 400px;
    max-height: 400px;
    overflow: hidden;
}

/* Grid para los gráficos adicionales */
.chart-container-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

.chart-item {
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px var(--shadow);
    height: 250px;
    max-height: 250px;
    overflow: hidden;
}

.radar-chart {
    height: 300px;
    max-height: 300px;
}

/* Gráficos de predicciones */
.charts-predicciones {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

.charts-predicciones .chart-container {
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px var(--shadow);
    height: 350px;
}

/* Tooltips generales */
[title] {
    position: relative;
    cursor: help;
}

/* Tooltips para estadísticas */
.stat-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    background: var(--primary);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    z-index: 10;
    white-space: nowrap;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
}

/* Estadísticas de la app */
.app-stat {
    display: flex;
    justify-content: space-between;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}

.app-stat:last-child {
    border-bottom: none;
}

.app-stat-label {
    font-weight: bold;
    color: var(--primary);
}

/* Detalle de equipo */
.info-equipo {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.estadisticas, .ultimos-partidos {
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.estadisticas ul {
    list-style: none;
}

.estadisticas li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.estadisticas li:last-child {
    border-bottom: none;
}

.resultado {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.resultado:last-child {
    border-bottom: none;
}

.fecha-partido {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.2rem;
}

.resultado-victoria {
    color: green;
    font-weight: bold;
}

.resultado-derrota {
    color: red;
    font-weight: bold;
}

.resultado-empate {
    color: orange;
    font-weight: bold;
}

/* Plantilla de jugadores */
.plantilla-jugadores {
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px var(--shadow);
    margin-top: 1.5rem;
}

.jugador {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.jugador:last-child {
    border-bottom: none;
}

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

.dorsal {
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 10px;
    font-weight: bold;
}

.jugador-nombre {
    font-weight: bold;
}

.jugador-posicion {
    font-size: 0.8rem;
    color: #666;
}

.jugador-stats {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
}

.stat-item {
    background-color: #f5f5f5;
    padding: 3px 6px;
    border-radius: 4px;
}

/* Loader */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.oculto {
    display: none;
}

/* Estilos para mensajes de error */
.error-container {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.error-container p {
    margin: 0;
    padding-right: 30px;
}

.close-error {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #721c24;
}

.retry-button {
    background-color: #721c24;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.retry-button:hover {
    background-color: #5a171d;
}

/* Última actualización */
.ultima-actualizacion {
    text-align: center;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
}

/* Añadir info de metadata */
.metadata-info {
    font-size: 0.75rem;
    color: #777;
    text-align: center;
    margin-top: 0.5rem;
}

/* Sección de próximos partidos */
.partido-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 1rem;
    padding: 1rem;
    position: relative;
}

.partido-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.equipos {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0;
}

.equipo {
    text-align: center;
    width: 40%;
}

.versus {
    font-weight: bold;
    font-size: 1.2rem;
}

.prediccion {
    background-color: #f0f8ff;
    border-radius: 6px;
    padding: 0.5rem;
    margin-top: 1rem;
    border-left: 4px solid var(--primary);
}

.prediccion-titulo {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.prob-container {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.probabilidad {
    width: 32%;
    text-align: center;
    padding: 0.5rem 0;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
}

.prob-local {
    background-color: #e6f7ff;
    color: #0066cc;
}

.prob-empate {
    background-color: #fff7e6;
    color: #d46b08;
}

.prob-visitante {
    background-color: #f6ffed;
    color: #52c41a;
}

.partido-estadisticas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.stat {
    background-color: #f5f5f5;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.btn-container {
    display: flex;
    justify-content: space-between;
    margin: 1rem 0;
}

.btn-proximosPartidos {
    background-color: var(--primary);
}

.btn-proximosPartidos:hover {
    background-color: #00274d;
}

/* Footer */
footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: #666;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
}

/* Responsive */
@media (min-width: 768px) {
    .container {
        max-width: 90%;
    }
    
    .info-equipo {
        flex-direction: row;
    }
    
    .estadisticas, .ultimos-partidos {
        flex: 1;
    }
    
    .chart-container-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .chart-container {
        grid-column: 1 / -1;
    }
    
    .charts-predicciones {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    th, td {
        padding: 0.4rem 0.2rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    header {
        position: relative;
    }
    
    .info-button {
        position: absolute;
        top: 10px;
        right: 10px;
    }
}