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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    line-height: 1.6;
}

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

header {
    background: #2d2d2d;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    width: 100px;
    height: auto;
}

header h1 {
    color: #e0e0e0;
    margin: 0;
    font-size: 2em;
}

nav {
    display: flex;
    gap: 15px;
}

nav a {
    color: #e0e0e0;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    background: #3a3a3a;
    transition: background 0.3s;
}

nav a:hover {
    background: #4a4a4a;
}

nav a.active {
    background: #4CAF50;
    color: white;
}

section {
    background: #2d2d2d;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

h2 {
    color: #4CAF50;
    margin-bottom: 20px;
}

h3 {
    color: #4CAF50;
    margin-bottom: 15px;
}

.table-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.unique-players-badge {
    padding: 10px 18px;
    background: #3a3a3a;
    border-radius: 6px;
    border: 1px solid #4CAF50;
}

.unique-players-badge strong {
    color: #e0e0e0;
    font-size: 15px;
}

.unique-players-badge span {
    color: #4CAF50;
    font-weight: bold;
}

.bingo-card-overlay {
    position: absolute;
    transform: translate(-50%, -100%);
    margin-top: -10px;
    z-index: 1500;
    pointer-events: none;
    display: none;
}

.bingo-card-overlay img {
    max-width: 300px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    border: 3px solid #4CAF50;
}

.search-container {
    position: relative;
    margin-bottom: 20px;
}

#searchInput {
    width: 100%;
    max-width: 500px;
    padding: 12px;
    border: 2px solid #3a3a3a;
    border-radius: 4px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 16px;
}

#searchInput:focus {
    outline: none;
    border-color: #4CAF50;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-width: 500px;
    background: #3a3a3a;
    border-radius: 4px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #2d2d2d;
}

.autocomplete-item:hover {
    background: #4a4a4a;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.player-stats {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 4px;
    border-left: 4px solid #4CAF50;
    display: none;
}

.player-stats.active {
    display: block;
}

.player-stats h3 {
    margin-bottom: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    background: #2d2d2d;
    padding: 15px;
    border-radius: 4px;
}

.stat-label {
    color: #aaa;
    font-size: 14px;
    margin-bottom: 5px;
}

.stat-value {
    color: #4CAF50;
    font-size: 24px;
    font-weight: bold;
}

.stat-events {
    margin-top: 10px;
    font-size: 10px;
    color: #888;
    max-height: 150px;
    overflow-y: auto;
}

.stat-events div {
    padding: 2px 0;
    line-height: 1.3;
}

.table-scroll {
    overflow-x: auto;
    overflow-y: visible;
    max-height: calc(100vh - 200px);
    position: relative;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

thead {
    background: #3a3a3a;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #3a3a3a;
}

thead th:first-child {
    z-index: 150;
}

th {
    padding: 12px;
    text-align: left;
    color: #4CAF50;
    font-weight: 600;
    border-bottom: 2px solid #4CAF50;
}

tbody tr {
    border-bottom: 1px solid #3a3a3a;
    transition: background 0.2s;
}

tbody tr:hover {
    background: #3a3a3a;
}

td {
    padding: 12px;
    text-align: center;
}

th:first-child,
td:first-child {
    position: sticky;
    left: 0;
    background: #3a3a3a;
    z-index: 50;
}

td:first-child {
    text-align: left;
    font-weight: 500;
    color: #4CAF50;
}

tbody tr:hover td:first-child {
    background: #3a3a3a;
}

tfoot td:first-child {
    z-index: 95;
}

.status-cell {
    font-size: 18px;
}

.no-participation {
    color: #666;
}

.participated {
    color: #f44336;
}

.won {
    color: #4CAF50;
}

.legend {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-symbol {
    font-size: 20px;
    font-weight: bold;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #4CAF50;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #3a3a3a;
    border-radius: 4px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4CAF50;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background: #4CAF50;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #45a049;
}

button.secondary {
    background: #666;
}

button.secondary:hover {
    background: #777;
}

button.danger {
    background: #f44336;
}

button.danger:hover {
    background: #da190b;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #2d2d2d;
    padding: 30px;
    border-radius: 8px;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    color: #e0e0e0;
    font-size: 24px;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-close:hover {
    background: #3a3a3a;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.list-item {
    background: #1a1a1a;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item-actions {
    display: flex;
    gap: 10px;
}

.list-item-actions button {
    padding: 5px 10px;
    font-size: 14px;
}

.participant-list {
    margin-top: 15px;
}

.participant-item {
    background: #1a1a1a;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.participant-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.participant-input input[type="text"] {
    flex: 1;
}

.participant-input input[type="checkbox"] {
    width: auto;
}

.participant-autocomplete {
    position: relative;
}

.participant-autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 2px solid #3a3a3a;
    border-radius: 4px;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: none;
}

.participant-autocomplete-results.active {
    display: block;
}

.participant-autocomplete-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #2d2d2d;
}

.participant-autocomplete-item:hover {
    background: #3a3a3a;
}

.participant-autocomplete-item:last-child {
    border-bottom: none;
}

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

.admin-card {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 4px;
}

.admin-card h3 {
    margin-bottom: 15px;
}

button.winner {
    background: #4CAF50;
    border: 2px solid #4CAF50;
}

button.winner:hover {
    background: #45a049;
}

button.not-winner {
    background: #f44336;
    border: 2px solid #f44336;
}

button.not-winner:hover {
    background: #da190b;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-buttons button {
    padding: 8px 16px;
    font-size: 14px;
}

.filter-buttons button.active {
    background: #4CAF50;
}

/* Colores para botones de filtro por modalidad */
.filter-buttons button.filter-uhc {
    background: #3a3a3a;
    color: #4CAF50;
    border: 2px solid #4CAF50;
}

.filter-buttons button.filter-uhc:hover {
    background: #4a4a4a;
}

.filter-buttons button.filter-uhc.active {
    background: #4CAF50;
    color: white;
}

.filter-buttons button.filter-bingo {
    background: #3a3a3a;
    color: #FFB84D;
    border: 2px solid #FFB84D;
}

.filter-buttons button.filter-bingo:hover {
    background: #4a4a4a;
}

.filter-buttons button.filter-bingo.active {
    background: #FFB84D;
    color: #1a1a1a;
}

.filter-buttons button.filter-ctm {
    background: #3a3a3a;
    color: #64B5F6;
    border: 2px solid #64B5F6;
}

.filter-buttons button.filter-ctm:hover {
    background: #4a4a4a;
}

.filter-buttons button.filter-ctm.active {
    background: #64B5F6;
    color: #1a1a1a;
}

th.event-header {
    text-align: center;
    min-width: 120px;
    max-width: 150px;
    cursor: pointer;
    transition: background 0.3s;
}

th.event-header:hover {
    background: #4a4a4a;
}

th.event-header.filtered {
    background: #2a2a2a;
    border: 2px solid #4CAF50;
}

th.event-header div {
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
}

/* Colores por modalidad */
th.event-header.modalidad-uhc {
    color: #4CAF50;
}

th.event-header.modalidad-bingo {
    color: #FFB84D;
}

th.event-header.modalidad-ctm {
    color: #64B5F6;
}

/* Mantener colores cuando está filtrado */
th.event-header.filtered.modalidad-uhc {
    color: #4CAF50;
}

th.event-header.filtered.modalidad-bingo {
    color: #FFB84D;
}

th.event-header.filtered.modalidad-ctm {
    color: #64B5F6;
}

tbody tr.hidden {
    display: none;
}

.event-count {
    font-size: 11px;
    color: #aaa;
    font-weight: normal;
    margin-top: 5px;
    display: block;
}

tfoot {
    background: #3a3a3a;
}

tfoot td {
    position: sticky;
    bottom: 0;
    padding: 10px;
    font-size: 12px;
    color: #aaa;
    border-top: 2px solid #4CAF50;
    background: #3a3a3a;
    z-index: 90;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .legend {
        flex-direction: column;
        gap: 15px;
    }

    .admin-section {
        grid-template-columns: 1fr;
    }
}
