:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --acc-primary: #3b82f6;
    --acc-hover: #2563eb;
    --acc-secondary: #10b981;
    --error: #ef4444;
    --tab-inactive: #1e293b;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.app-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.glass-header {
    text-align: center;
    padding: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.glass-header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.glass-header p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}

h2 {
    margin-top: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

button {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-btn {
    background: var(--acc-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.primary-btn:hover:not(:disabled) {
    background: var(--acc-hover);
    transform: translateY(-2px);
}

.secondary-btn {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.secondary-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

.result-box {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    font-family: monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.9rem;
    max-height: 200px;
    overflow-y: auto;
}

.result-box.success {
    border-left: 4px solid var(--acc-secondary);
}

.result-box.error {
    border-left: 4px solid var(--error);
}

.hidden {
    display: none;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.delegacion-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: transform 0.2s ease;
}

.delegacion-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
}

.delegacion-card img {
    max-width: 60px;
    margin-bottom: 0.5rem;
}

.delegacion-card p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 2rem;
}

/* New styles for teams and phases */
.equipos-list,
.clubes-list,
.categorias-list,
.competiciones-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.equipo-item,
.club-item,
.categoria-item,
.competicion-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.equipo-item:hover,
.club-item:hover,
.categoria-item:hover,
.competicion-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--acc-primary);
    transform: translateX(5px);
}


.fase-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.fase-item h3 {
    margin-top: 0;
    color: var(--acc-primary);
    font-size: 1.1rem;
}

.grupo-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    margin: 0.25rem 0;
    border-radius: 4px;
    font-size: 0.9rem;
}

.action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.status-label {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    background: #475569;
    color: white;
    cursor: pointer;
}

.status-label.ok {
    background: var(--acc-secondary);
}

.status-label.fail {
    background: var(--error);
}

/* Favorites Section */
.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.fav-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(16, 185, 129, 0.1));
    border: 1px solid var(--acc-primary);
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.fav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.fav-shield {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 2px;
}

.fav-shield img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.fav-shield-placeholder {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.fav-info {
    flex-grow: 1;
    min-width: 0;
}

.fav-card h3 {
    margin: 0;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1.5rem;
}

.fav-card p {
    margin: 0.1rem 0 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fav-category {
    color: var(--acc-primary) !important;
    font-weight: 700;
    font-size: 0.8rem !important;
}

.fav-competition {
    opacity: 0.7;
    font-size: 0.7rem !important;
}

.fav-stats {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--acc-primary);
    margin-top: 0.3rem;
    opacity: 0.8;
}

.remove-fav {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
}

.remove-fav:hover {
    color: var(--error);
}

.empty-msg {
    color: var(--text-secondary);
    font-style: italic;
    grid-column: 1 / -1;
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.nav-btn {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
    padding: 0.5rem 1.5rem;
    border-radius: 999px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-btn.active {
    background: var(--acc-primary);
    color: white;
    border-color: var(--acc-primary);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.view-pane {
    transition: opacity 0.3s ease;
}

.view-pane.hidden {
    display: none;
    opacity: 0;
}

/* Team item improvements */
.equipo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fav-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease, color 0.2s ease;
}

.fav-toggle.active {
    color: #fbbf24;
    transform: scale(1.2);
}

.fav-toggle:hover {
    transform: scale(1.3);
}

/* Inner Tabs */
.tabs-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.tab-btn.active {
    background: var(--acc-primary);
    color: white;
}

.tab-pane {
    display: none;
}

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

/* Fases Selector Mini */
.fases-grid-mini {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.fase-item-mini {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.fase-item-mini:hover,
.fase-item-mini.active {
    background: var(--acc-primary);
    border-color: var(--acc-primary);
    color: white;
}

/* Clasificación Table */
.clasificacion-table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
}

.clas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.clas-table th {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    text-align: left;
    padding: 0.75rem 0.5rem;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.clas-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

.clas-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.clas-table .pos {
    font-weight: 800;
    color: var(--acc-primary);
    width: 20px;
}

.clas-table .team-name {
    font-weight: 600;
}

.clas-table .stat-col {
    text-align: center;
}

.clas-table .highlight-row {
    background: rgba(59, 130, 246, 0.1) !important;
}

/* Calendario Styles */
.calendario-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.jornada-header {
    background: var(--acc-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.9rem;
    margin-top: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.jornada-header:first-child {
    margin-top: 0;
}

.partido-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.partido-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.02);
    border-color: var(--acc-primary);
}

.partido-item.terminado {
    border-left: 4px solid var(--acc-secondary);
}

.partido-item.pendiente {
    border-left: 4px solid var(--acc-primary);
}

.partido-fecha {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

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

.p-equipo {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
}

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

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

.p-resultado {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-family: monospace;
    font-weight: 800;
    min-width: 60px;
    text-align: center;
    color: var(--acc-secondary);
}

.partido-campo {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.5rem;
}

.fases-selector {
    margin: 1.5rem 0;
}

/* ── Jugadores ─────────────────────────────────────────────────── */
.jugadores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.jugador-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.jugador-card:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--acc-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

/* Avatar circular con dorsal como fallback */
.jugador-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--acc-primary), var(--acc-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: white;
}

.jugador-foto {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--acc-primary);
}

.jugador-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    overflow: hidden;
}

.jugador-nombre {
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jugador-posicion {
    font-size: 0.7rem;
    color: var(--acc-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.jugador-lic {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.jugador-stats {
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}


/* Número de dorsal flotando a la derecha */
.jugador-dorsal {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.15);
    line-height: 1;
}