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

:root {
    --primary-color: #1e3a8a;
    --secondary-color: #3b82f6;
    --meliana-color: #fbbf24;
    --meliana-bg: #fef3c7;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-color: #1f2937;
    --bg-color: #f3f4f6;
    --white: #ffffff;
    --border-color: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
    min-height: 100vh;
    padding: 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 2rem 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

.tabs {
    display: flex;
    background: var(--bg-color);
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.3s ease;
    position: relative;
}

.tab:hover {
    background: rgba(59, 130, 246, 0.1);
}

.tab.active {
    color: var(--secondary-color);
    background: var(--white);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--secondary-color);
}

.tab-content {
    display: none;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

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

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

h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.loading {
    text-align: center;
    padding: 3rem 1.5rem;
}

.spinner {
    border: 4px solid var(--bg-color);
    border-top: 4px solid var(--secondary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.error {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--danger-color);
}

.error button {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.3s ease;
}

.error button:hover {
    background: var(--primary-color);
}

.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

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

th {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

td {
    padding: 0.75rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

th:first-child, td:first-child {
    width: 40px;
    text-align: center;
}

th:nth-child(2), td:nth-child(2) {
    text-align: left;
    padding-left: 1rem;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: var(--bg-color);
}

.meliana-row {
    background: var(--meliana-bg) !important;
    font-weight: 700;
    border-left: 4px solid var(--meliana-color);
}

.meliana-row:hover {
    background: #fde68a !important;
}

.partido-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.partido-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.partido-card.meliana-partido {
    border-left: 4px solid var(--meliana-color);
    background: var(--meliana-bg);
}

.partido-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: #6b7280;
}

.partido-equipos {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
}

.equipo {
    flex: 1;
    font-weight: 600;
}

.equipo.local {
    text-align: right;
}

.equipo.visitante {
    text-align: left;
}

.resultado {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 6px;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
}

.resultado.pendiente {
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.85rem;
}

.partido-campo {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: #6b7280;
    display: flex;
    align-items: center;
}

.jornada-group {
    margin-bottom: 2rem;
}

.jornada-title {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-color);
    color: #6b7280;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .tab {
        font-size: 0.9rem;
        padding: 0.75rem 0.5rem;
    }

    th, td {
        padding: 0.5rem 0.25rem;
        font-size: 0.85rem;
    }

    th:nth-child(4),
    th:nth-child(5),
    th:nth-child(6),
    th:nth-child(7),
    th:nth-child(8),
    th:nth-child(9),
    td:nth-child(4),
    td:nth-child(5),
    td:nth-child(6),
    td:nth-child(7),
    td:nth-child(8),
    td:nth-child(9) {
        display: none;
    }

    .partido-equipos {
        font-size: 0.9rem;
    }

    h2 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 1rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .tab-content {
        padding: 1rem;
    }
}
