/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

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

.year-badge {
    background: #4caf50;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Navegación principal */
.main-nav {
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-bottom: 1px solid #e0e0e0;
}

.main-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav li {
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.nav-link:hover {
    background-color: #f5f5f5;
    color: #1a237e;
}

.nav-link.active {
    color: #1a237e;
    border-bottom-color: #1a237e;
    background-color: #f8f9fa;
}

/* Contenido principal */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Encabezados de sección */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.section-header h2 {
    color: #1a237e;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Botones */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #1a237e;
    color: white;
}

.btn-primary:hover {
    background: #283593;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}

/* Tabs */
.tabs {
    margin-bottom: 2rem;
}

.tabs-header {
    background: white;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tabs-list {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab:hover {
    color: #1a237e;
    background-color: #f8f9fa;
}

.tab.active {
    color: #1a237e;
    border-bottom-color: #1a237e;
    background-color: white;
}

.tabs-content {
    background: white;
    border-radius: 0 0 8px 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

/* Tablas */
.table-responsive {
    overflow-x: auto;
    margin: 1rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.data-table th {
    background: #1a237e;
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.data-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.data-table tr:nth-child(even):hover {
    background-color: #e9ecef;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ranking-table.full-width {
    width: 100%;
}

.ranking-table th {
    background: #2c3e50;
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    position: sticky;
    top: 0;
}

.ranking-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

.ranking-table tr:hover {
    background-color: #f8f9fa;
}

.ranking-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.ranking-table tr:nth-child(even):hover {
    background-color: #e9ecef;
}

/* Cards de torneos */
.torneos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.torneo-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid #1a237e;
}

.torneo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.torneo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.torneo-card-title {
    font-size: 1.3rem;
    color: #1a237e;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.torneo-card-sede {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.torneo-card-sede img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.torneo-card-fecha {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.torneo-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.torneo-card-estado {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.estado-en-curso {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.estado-finalizado {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Filtros */
.filter-container {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-select {
    width: 100%;
    max-width: 300px;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

/* Formularios */
.form-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #1a237e;
    box-shadow: 0 0 0 2px rgba(26, 35, 126, 0.2);
}

.form-control:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Checklist de equipos */
.equipos-checklist {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.equipos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.equipo-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    background: white;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.equipo-checkbox:hover {
    border-color: #1a237e;
    background-color: #f8f9ff;
}

.equipo-checkbox input[type="checkbox"] {
    margin: 0;
}

.equipo-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    flex: 1;
}

.equipo-logo-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

/* Partidos en rondas */
.partidos-container {
    /*display: grid;*/ /*Estilos DON*/
    /*grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));*/ /*Estilos DON*/
    gap: 1rem;
    margin-top: 1rem;
}

.partido-card {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
    width: 100%; /*Estilos DON*/
}

.partido-card.blanco {
    background-color: white;
    border-color: #ddd;
}

.partido-card.amarillo {
    background-color: rgb(255, 243, 205);
    border-color: rgb(255, 193, 7);
}

.partido-card.verde {
    background-color: rgb(232, 245, 232);
    border-color: rgb(39, 174, 96);
}

.mesa-number {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: #1a237e;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.tiempo-checkbox {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.tiempo-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.partido-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-top: 1.5rem;
}

.pareja-info {
    padding: 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.7);
}

.pareja-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #1a237e;
}

.victorias {
    background: #4caf50;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
}

.jugador-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.jugador-foto {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.equipo-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e0e0e0;
    font-size: 0.85rem;
    color: #666;
}

.puntos-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.puntos-input {
    width: 60px;
    padding: 0.4rem;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: bold;
}

.puntos-input:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.vs-text {
    font-weight: bold;
    color: #666;
    padding: 0 0.5rem;
}

/* Form actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

/* Info box */
.info-box {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1rem;
    font-size: 0.95rem;
}

/* Acciones del torneo */
.torneo-actions {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    width: 90%;
    max-width: 700px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header {
    padding: 1.5rem;
    background: #1a237e;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.close {
    cursor: pointer;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ffcc00;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Footer */
.footer {
    background: #1a237e;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
}

.footer p {
    margin: 0;
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }
    
    .main-nav ul {
        flex-direction: column;
    }
    
    .nav-link {
        justify-content: flex-start;
        padding-left: 2rem;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .section-header h2 {
        text-align: center;
    }
    
    .torneos-grid {
        grid-template-columns: 1fr;
    }
    
    .partidos-container {
        grid-template-columns: 1fr;
    }
    
    .partido-content {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .puntos-inputs {
        order: 3;
        justify-content: center;
        margin-top: 1rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-row .form-group {
        min-width: 100%;
    }
    
    .equipos-grid {
        grid-template-columns: 1fr;
    }
    
    .torneo-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 95%;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem;
    }
    
    .tabs-list {
        flex-direction: column;
    }
    
    .tab {
        text-align: center;
        border-bottom: none;
        border-right: 3px solid transparent;
        margin-bottom: 0;
        margin-right: -2px;
    }
    
    .tab.active {
        border-bottom: none;
        border-right-color: #1a237e;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    .jugador-info {
        flex-direction: column;
        text-align: center;
        gap: 0.25rem;
    }
    
    .equipo-info {
        flex-direction: column;
        text-align: center;
        gap: 0.25rem;
    }
}

/* Estilos para imágenes miniaturas */
.img-mini {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
}

.img-extra-mini {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
}

/* Estilos para logos de equipos en tablas */
.equipo-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Estilos para ranking */
.ranking-position {
    display: inline-block;
    width: 30px;
    height: 30px;
    background: #1a237e;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    margin-right: 0.5rem;
}

.pos-1 { background: #ffd700; }
.pos-2 { background: #c0c0c0; }
.pos-3 { background: #cd7f32; }

/* Estilos para botones de acción */
.action-buttons {
    display: flex;
    gap: 0.25rem;
}

/* Estilos para filtro de equipos en rondas */
.ronda-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Estilos para mensajes de carga */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #1a237e;
    animation: spin 1s linear infinite;
}

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

/* Estilos para mensajes de error */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin: 1rem 0;
}

/* Estilos para mensajes de éxito */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    margin: 1rem 0;
}

/* Estilos para tooltips */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background: #333;
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 5px);
}

/* Estilos para scrollbars personalizados */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Estilos para print */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .header, .main-nav, .footer, .section-header, .filter-container, .torneo-actions, .btn {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .content-section {
        display: block !important;
    }
    
    .tabs-header {
        display: none !important;
    }
    
    .tab-pane {
        display: block !important;
        box-shadow: none !important;
        border: none !important;
    }
    
    .ranking-table, .data-table {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}