:root {
    --primary-color: #002244; /* Azul oscuro */
    --secondary-color: #FFD700; /* Dorado/Amarillo */
    --accent-color: #DC143C; /* Rojo (para detalles, errores) */
    --text-light: #f4f4f4;
    --text-dark: #333;
    --bg-light: #ffffff;
    --bg-dark: #e9e9e9;
    --border-color: #ddd;
    --header-height-large: 120px;
    --header-height-small: 80px;
}

/* Base styles */
body {
    font-family: 'Arial', sans-serif;
    font-size: 11px;
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Header */
header {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 1rem 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease-in-out;
    height: var(--header-height-large); /* Altura inicial */
    display: flex;
    align-items: center;
    justify-content: center;
}

header.scrolled {
    height: var(--header-height-small); /* Altura al hacer scroll */
    padding: 0.5rem 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.elf-logo {
    height: 80px; /* Tamaño grande */
    transition: height 0.3s ease-in-out;
}

header.scrolled .elf-logo {
    height: 50px; /* Tamaño pequeño al hacer scroll */
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    transition: font-size 0.3s ease-in-out;
    white-space: nowrap; /* Evita que el título se rompa en varias líneas */
}

header.scrolled h1 {
    font-size: 1.8rem;
}

.language-selector {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.language-selector select {
    padding: 8px 12px;
    border-radius: 5px;
    border: none;
    background-color: var(--secondary-color);
    color: var(--primary-color);
    font-weight: bold;
    cursor: pointer;
    appearance: none; /* Elimina estilos por defecto del select */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20256%20256%22%3E%3Cpath%20fill%3D%22%23002244%22%20d%3D%22M128%2C184a8%2C8%2C0%2C0%2C1-5.66-2.34l-80-80a8%2C8%2C0%2C0%2C1%2C11.32-11.32L128%2C165.32l74.34-74.34a8%2C8%2C0%2C0%2C1%2C11.32%2C11.32l-80%2C80A8%2C8%2C0%2C0%2C1%2C128%2C184Z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px; /* Espacio para el icono */
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* Main content layout */
main {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    display: flex;
    gap: 12px;
    grid-template-columns: 1fr;
}

/* Sections */
section {
    background-color: var(--bg-light);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

section h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

section h2 button {
    background: none;
    border: none;
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0 10px;
    line-height: 1;
}

.filter-content, .standings-content {
    transition: all 0.3s ease-out;
    overflow: hidden;
}

.filter-content.collapsed, .standings-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    transform: translateY(-10px);
}

.filter-content.expanded, .standings-content.expanded {
    /*max-height: 1000px; /* Suficientemente grande para contener el contenido */
    opacity: 1;
    transform: translateY(0);
}


/* Filters */
.filters-section {
    display: flex;
    flex-direction: column;
}

.filter-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--primary-color);
}

.filter-group select,
.filter-group input[type="date"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-sizing: border-box; /* Incluye padding y borde en el ancho */
}

#reset-filters {
    grid-column: 1 / -1; /* Ocupa todas las columnas disponibles */
    padding: 12px 20px;
    background-color: var(--accent-color);
    color: var(--text-light);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;      
    transition: background-color 0.2s ease;
    margin-top: 10px;
    width: 200px;
}

#reset-filters:hover {
    background-color: #a3102d; /* Tono más oscuro de rojo */
}

/* Standings tables */
.standings-table table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.standings-table th,
.standings-table td {
    border: 1px solid var(--border-color);
    padding: 5px;
    /*text-align: left;*/
}

.standings-table th {
    background-color: var(--primary-color);
    color: var(--text-light);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.6em;
}

.standings-table tbody tr:nth-child(even) {
    background-color: var(--bg-dark);
}

.standings-table tbody tr:hover {
    background-color: #e0e0e0;
}

.standings-table td {
    vertical-align: middle;
    font-size: 0.8em;
}

.standings-table .team-logo {
    height: 25px;
    width: auto;
    vertical-align: middle;
    margin-right: 3px;
    border-radius: 50%; /* Para logos redondos */
    background-color: #fff; /* Fondo blanco para logos con transparencia */
    padding: 2px;
    box-shadow: 0 0 3px rgba(0,0,0,0.1);
}

/* Posición en tabla */
.standings-table .playoff-spot {
    background-color: #d4edda; /* Verde claro para playoff */
    font-weight: bold;
    color: #155724;
}

.standings-table .wildcard-spot {
    background-color: #fff3cd; /* Amarillo claro para wildcard */
    font-weight: bold;
    color: #856404;
}

.standings-group{
    width: 35%;
}

/* Conference standings specific styles */
.conference-standings h3 {
    color: var(--primary-color);
    margin-top: 25px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.5rem;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 10px;
}

.conference-standings-item {
    margin-bottom: 30px; /* Espacio entre tablas de conferencia */
}

.conference-standings-item:last-child {
    margin-bottom: 0;
}


/* Matches section */

.matches {
    width: 65%;
}
.matches-section {
    position: relative;
}

.matches-header-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
}

.matches-header-controls button {
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: var(--text-light);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.matches-header-controls button:hover {
    background-color: #003366;
}

.match-list {
    display: grid;
    gap: 10px;
}

/* Grid View (default for wider screens) */
.match-list.grid-view {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.match-list.list-view {
    grid-template-columns: 1fr; /* Una columna para vista de lista */
}

.match-card {
    background-color: var(--bg-dark);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.match-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.match-card.played {
    border: 1px solid var(--primary-color);
}

.match-card.upcoming {
    border: 1px dashed var(--border-color);
}

.match-card .match-date {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.match-card .match-teams {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    margin-bottom: 15px;
}

.match-card .match-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 1; /* Permite que los equipos ocupen espacio equitativamente */
}

.match-card .match-team.away {
    order: 1; /* Equipo visitante a la izquierda */
    flex-direction: row-reverse; /* Logo a la derecha para visitante */
    text-align: right;
    justify-content: flex-end;
}

.match-card .match-team.home {
    order: 3; /* Equipo local a la derecha */
    flex-direction: row; /* Logo a la izquierda para local */
    text-align: left;
    justify-content: flex-start;
}

.match-card .match-team img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: contain;
    background-color: #fff;
    padding: 3px;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.match-card .team-info {
    display: flex;
    flex-direction: column;
    font-weight: bold;
    font-size: 1.1em;
    margin: 0 10px; /* Espacio entre logo y texto */
    flex-grow: 1; /* Permite que el texto ocupe espacio */
}

.match-card .team-info .team-role {
    font-size: 0.8em;
    font-weight: normal;
    color: #666;
}

.match-card .match-score {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-color);
    flex: 0 0 auto; /* No crece ni encoge, tamaño fijo */
    width: 80px; /* Ancho fijo para el marcador */
    text-align: center;
    order: 2; /* Siempre en el medio */
}

.match-card .match-score span {
    font-size: 0.8em; /* "vs" más pequeño */
    color: #888;
}

.match-simulation-inputs {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-top: auto; /* Empuja los inputs hacia abajo */
    justify-content: center;
}

.match-simulation-inputs input[type="number"] {
    width: 70px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    text-align: center;
    font-size: 1em;
}

.match-simulation-inputs button.simulate-btn {
    padding: 8px 12px;
    background-color: var(--secondary-color);
    color: var(--primary-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.match-simulation-inputs button.simulate-btn:hover {
    background-color: #e6b800; /* Tono más oscuro de dorado */
}

.simulation-info {
    font-size: 0.9em;
    color: #555;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.simulation-info .undo-simulation-btn {
    padding: 5px 10px;
    background-color: #6c757d; /* Gris para "Deshacer" */
    color: var(--text-light);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.2s ease;
}

.simulation-info .undo-simulation-btn:hover {
    background-color: #5a6268;
}

/* BYE Card specific styles */
.bye-card {
    background-color: #f0f0f0; /* Fondo más claro para BYE */
    border: 1px dashed #ccc;
    text-align: center;
}

.bye-card .match-date {
    font-weight: bold;
    color: var(--primary-color);
}

.bye-card .match-score {
    font-size: 1.5em;
    color: #666;
}

.bye-card .bye-team {
    justify-content: center; /* Centrar el logo y texto */
    flex-direction: row; /* Poner logo y texto en fila */
}

.bye-card .bye-team .team-info {
    text-align: center;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    background-color: var(--primary-color);
    color: var(--text-light);
    font-size: 0.9em;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
}


/* Tooltip container */
.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
    margin-left: 10px;  
  }
  
  /* Tooltip text */
  .tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: black;
    color: #fff;
    text-align: center;
    padding: 5px 0;
    border-radius: 6px;
   
    /* Position the tooltip text - see examples below! */
    position: absolute;
    z-index: 1;
  }
  
  /* Show the tooltip text when you mouse over the tooltip container */
  .tooltip:hover .tooltiptext {
    visibility: visible;
  }

  .playoff-boxes {
    display: flex;
    flex-direction: row;
    align-items: center;
}
.playoff-box{
    background: "#002244d";
    padding: 15px;
    color: white;
    border-radius: 10px;
    margin: 10px;
}

#main-title{
    display: none;
}


.tiebreaker-link{
    font-weight: bold;
    font-style: italic;
    padding-left: 3px;
    text-decoration: underline;
    cursor: pointer;
}
/* Responsive adjustments */
@media (max-width: 992px) {
    header h1 {
        font-size: 2rem;
    }

    header.scrolled h1 {
        font-size: 1.5rem;
    }

    .elf-logo {
        height: 60px;
    }

    header.scrolled .elf-logo {
        height: 40px;
    }

    main {
        padding: 0 15px;
    }

    .filter-content {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        
    }

    .standings-table th,
    .standings-table td {
        padding: 8px;
        font-size: 0.85em;
    }
}

@media (max-width: 768px) {
    header {
        height: auto; /* Deja que el contenido determine la altura */
        padding: 1rem 0;
        /*flex-direction: column;*/
    }

    header.scrolled {
        height: auto;
    }

    .header-content {
        flex-direction: row;
        gap: 2px;
        text-align: center;
    }

    .elf-logo {
        height: 50px;
    }

    header.scrolled .elf-logo {
        height: 50px; /* Mantiene el tamaño para móvil */
    }

    header h1 {
        font-size: 1.8rem;
    }

    header.scrolled h1 {
        font-size: 1.8rem; /* Mantiene el tamaño para móvil */
    }

    .language-selector {
        position: static;
        transform: none;
        margin-top: 10px;
    }

    .filter-content {
        grid-template-columns: 1fr; /* Una columna en pantallas pequeñas */
    }

    #reset-filters {
        width: 100%;
        margin-top: 0; /* Ajuste para la disposición de columna */
    }

    .match-list.grid-view {
        grid-template-columns: 1fr; /* Asegura una columna en móvil */
    }

    .match-card .match-teams {
        flex-direction: column; /* Apila los equipos verticalmente */
        gap: 10px;
    }

    .match-card .match-team {
        flex-direction: row; /* Vuelve a poner logo y texto en fila */
        justify-content: center;
        text-align: center;
    }

    .match-card .match-team.away,
    .match-card .match-team.home {
        order: unset; /* Reiniciar el orden */
        flex-direction: row;
        justify-content: center;
        text-align: center;
    }

    .match-card .team-info {
        margin: 0 10px;
    }

    .match-card .match-score {
        order: unset; /* Reiniciar el orden */
        margin: 10px 0;
    }

    .matches-header-controls {
        flex-direction: column;
        gap: 10px;
    }

    .matches-header-controls button {
        width: 100%;
    }

    section h2 button {
        font-size: 1.5em;
    }

    .filter-content.collapsed, .standings-content.collapsed {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        opacity: 0;
    }

    .filter-content.expanded, .standings-content.expanded {
        /*max-height: 1000px;*/
        opacity: 1;
    }
}

.tiebraker-modal-overlay{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Fondo oscuro semi-transparente */
    display: none; /* Inicialmente oculta */
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Asegura que esté por encima de otros elementos */
}

.modal {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    max-width: 80%;
    max-height: 80%;
    overflow: auto; /* Permite desplazamiento si el contenido es largo */
  }

  .tiebraker-modal-overlay.active {
    display: flex; /* Muestra la modal cuando se activa */
  }
  
  .close-button {
    position: relative;
    top: 10px;
    left: 10px;
    background-color: #ccc;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
  }

  table#tiebraker-table,
  table#tiebraker-table th,
  table#tiebraker-table td {
    border-collapse: collapse;
    border: 1px solid black;
    text-align: center;
    }

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    main {
        flex-direction: column-reverse;
    }

    .standings-table th,
    .standings-table td {
        font-size: 0.75em;
        padding: 6px;
    }

    .standings-table .team-logo {
        height: 20px;
        width: 20px;
    }

    .match-card .match-team img {
        width: 40px;
        height: 40px;
    }

    .match-card .match-score {
        font-size: 1.5em;
    }

    .match-simulation-inputs input[type="number"] {
        width: 60px;
        padding: 6px;
    }

    .standings-group{
        width: 100%;
    }

    .matches {
        width: 100%;
    }

}