* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #feffda 0%, #ffece3 100%);
    color: #5a4a3a;
    min-height: 100vh;
}

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

h1 {
    color: #7a6a4a;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(122, 106, 74, 0.1);
}

.admin-link {
    text-align: center;
    margin-bottom: 20px;
}

.admin-link a {
    background: #ecedb4;
    color: #5a4a3a;
    padding: 10px 25px;
    border-radius: 20px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.admin-link a:hover {
    background: #d0e890;
    transform: translateY(-2px);
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.tab {
    background: #ffece3;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    color: #7a5a4a;
    transition: all 0.3s;
}

.tab:hover {
    background: #ffd5c3;
}

.tab.active {
    background: #deffa0;
    color: #4a4a2a;
}

.tab-content {
    display: none;
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(122, 106, 74, 0.15);
}

.tab-content.active {
    display: block;
}

.matchday-detail-content {
    display: block;
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(122, 106, 74, 0.15);
}

.refresh-btn {
    background: #feffda;
    border: 2px solid #deffa0;
    color: #7a6a4a;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.1em;
    display: block;
    margin: 0 auto 30px;
    transition: all 0.3s;
}

.refresh-btn:hover:not(:disabled) {
    background: #deffa0;
    transform: translateY(-2px);
}

.refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

thead {
    background: #feffda;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ffece3;
}

th {
    color: #7a6a4a;
    font-weight: bold;
}

tr:hover {
    background: #fffef5;
}

.prediction {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 10px;
    background: #ffece3;
    margin: 2px;
    font-size: 0.9em;
}

.prediction.correct {
    background: #d0fff8;
    color: #2a6a5a;
}

.prediction.incorrect {
    background: #ffcdd2;
    color: #c62828;
}

.standings-list {
    list-style: none;
}

.standings-list li {
    background: #feffda;
    padding: 15px 20px;
    margin: 10px 0;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid #deffa0;
    transition: all 0.3s;
}

.standings-list li:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(122, 106, 74, 0.2);
}

.standings-list li:first-child {
    border-left-color: #f4d03f;
    background: #fffef5;
}

.member-name {
    font-weight: bold;
    color: #7a6a4a;
}

.member-hits {
    background: #d0fff8;
    padding: 8px 15px;
    border-radius: 20px;
    color: #2a6a5a;
    font-weight: bold;
}

.message {
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
}

.message.error {
    background: #ffebee;
    color: #c62828;
}

.message.success {
    background: #d0fff8;
    color: #2a6a5a;
}

/* Login form */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(122, 106, 74, 0.2);
}

.login-container h2 {
    color: #7a6a4a;
    text-align: center;
    margin-bottom: 30px;
}

.login-form input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #ffece3;
    border-radius: 10px;
    font-size: 1em;
}

.login-form button {
    width: 100%;
    background: #deffa0;
    border: none;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    color: #4a4a2a;
    margin-top: 15px;
    transition: all 0.3s;
}

.login-form button:hover {
    background: #d0e890;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    table {
        font-size: 0.9em;
    }
    
    th, td {
        padding: 10px 5px;
    }
}

/* Estilos para la lista del histórico de jornadas */
.matchdays-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.matchday-card {
    background: linear-gradient(135deg, #feffda 0%, #ffece3 100%);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(122, 106, 74, 0.1);
    border: 2px solid transparent;
}

.matchday-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(122, 106, 74, 0.2);
    border-color: #deffa0;
}

.matchday-number {
    font-size: 1.3em;
    font-weight: bold;
    color: #7a6a4a;
    margin-bottom: 10px;
}

.matchday-date {
    color: #8a7a5a;
    font-size: 0.9em;
}

/* Estilos para pronósticos individuales en el detalle de jornada */
.pred-correct {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 10px;
    background: #c8f7dc;
    color: #1b5e3f;
    font-weight: bold;
    border: 2px solid #5fb88c;
}

.pred-incorrect {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 10px;
    background: #ffd4d4;
    color: #b71c1c;
    font-weight: bold;
    border: 2px solid #ffb4b4;
}

.pred-pending {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 10px;
    background: #e8e8e8;
    color: #7a7a7a;
    font-weight: bold;
    border: 2px solid #d0d0d0;
}

.predictions-table .totals-row {
    background: #feffda;
    font-weight: bold;
}

.predictions-table .totals-row td {
    border-top: 3px solid #deffa0;
    padding: 20px 15px;
}

.predictions-table td:not(:first-child):not(:nth-child(2)) {
    width: 100px;
    min-width: 100px;
    text-align: center;
}

.predictions-table th:not(:first-child):not(:nth-child(2)) {
    width: 100px;
    min-width: 100px;
    text-align: center;
}

/* Asegurar scroll horizontal en móvil para tabla de predicciones */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.predictions-table {
    min-width: 800px;
}

/* Estilo para el enlace de volver */
.back-link {
    display: inline-block;
    background: #deffa0;
    color: #5a4a3a;
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.back-link:hover {
    background: #d0e890;
    transform: translateX(-5px);
}

/* Mejoras para la tabla de clasificación con scroll horizontal */
.table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
}

.table-wrapper table {
    min-width: 600px;
}

@media (max-width: 768px) {
    .matchdays-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .matchday-card {
        padding: 20px;
    }
    
    .matchday-number {
        font-size: 1.1em;
    }
    
    .pred-correct, .pred-incorrect, .pred-pending {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .pred-correct.pleno, .pred-incorrect.pleno, .pred-pending.pleno {
        padding: 6px 8px;
        font-size: 0.9em;
    }
}

/* Estilos para posiciones en clasificación */
.pos-first {
    background: linear-gradient(to right, rgba(76, 175, 80, 0.25), transparent) !important;
}

.pos-second {
    background: linear-gradient(to right, rgba(76, 175, 80, 0.15), transparent) !important;
}

.pos-second-last {
    background: linear-gradient(to right, rgba(244, 67, 54, 0.15), transparent) !important;
}

.pos-last {
    background: linear-gradient(to right, rgba(244, 67, 54, 0.25), transparent) !important;
}

/* Indicadores de cambio de posición */
.position-up {
    display: inline-block;
    margin-left: 8px;
    color: #4caf50;
    font-weight: bold;
    font-size: 0.9em;
}

.position-down {
    display: inline-block;
    margin-left: 8px;
    color: #f44336;
    font-weight: bold;
    font-size: 0.9em;
}

/* Tablas especiales */
.special-tables {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
    margin-top: 50px;
}

.special-table-container {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(122, 106, 74, 0.1);
}

.special-table-container h3 {
    color: #7a6a4a;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.3em;
}

.special-table {
    width: 100%;
    border-collapse: collapse;
}

.special-table thead {
    background: #feffda;
}

.special-table th {
    padding: 12px;
    text-align: left;
    color: #7a6a4a;
    font-weight: bold;
}

.special-table td {
    padding: 12px;
    border-bottom: 1px solid #ffece3;
}

.special-table tbody tr:hover {
    background: #fffef5;
}

@media (max-width: 768px) {
    .special-tables {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .position-up, .position-down {
        font-size: 0.8em;
        margin-left: 4px;
    }
}

/* Nota provisional en jornada actual */
.provisional-note {
    font-size: 0.5em;
    color: #999;
    font-style: italic;
    font-weight: normal;
    display: block;
    margin-top: 5px;
}

.tiebreaker-note {
    margin: 10px 0 20px 0;
    text-align: center;
}

/* Contenedor de gráfica de evolución */
.chart-container-wrapper {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(122, 106, 74, 0.1);
    margin-top: 50px;
}

.chart-container-wrapper h3 {
    color: #7a6a4a;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5em;
}

.chart-scroll-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#evolutionChart {
    min-width: 600px;
    min-height: 400px;
    max-height: 500px;
}

@media (max-width: 768px) {
    .chart-container-wrapper {
        padding: 20px;
    }
    
    #evolutionChart {
        min-width: 500px;
        min-height: 350px;
    }
}