/* ================================================================
   BRACKET DISPLAY - Sistema de Cuadros de Eliminación
   ================================================================ */

/* Contenedor principal del bracket */
.bracket-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

.bracket-container h2 {
    color: #1e293b;
    margin: 0 0 30px 0;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
}

/* Grid horizontal del bracket */
.bracket {
    display: flex;
    gap: 40px;
    min-width: max-content;
    padding: 20px;
}

/* Columna de ronda */
.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 280px;
}

.bracket-round-title {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #1B6FF3;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
}

/* Grupo de matches por ronda */
.bracket-matches {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 40px;
}

/* Card de match individual */
.bracket-match {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.bracket-match:hover {
    border-color: #1B6FF3;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

/* Estado del match */
.bracket-match.completed {
    border-color: #10b981;
}

.bracket-match.in-progress {
    border-color: #f59e0b;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5); }
}

.bracket-match.scheduled {
    border-color: #3b82f6;
}

/* Header del match */
.match-header {
    background: linear-gradient(135deg, #1B6FF3 0%, #00B85C 100%);
    color: white;
    padding: 10px 15px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.match-header .match-date {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 3px;
}

/* Equipos */
.match-teams {
    padding: 0;
}

.bracket-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.3s ease;
}

.bracket-team:last-child {
    border-bottom: none;
}

.bracket-team:hover {
    background: #f8fafc;
}

/* Equipo ganador */
.bracket-team.winner {
    background: #d1fae5;
    font-weight: 700;
}

.bracket-team.winner .team-name {
    color: #059669;
}

/* Nombre del equipo */
.team-name {
    color: #1e293b;
    font-size: 15px;
    font-weight: 600;
    flex: 1;
}

.team-name.placeholder {
    color: #94a3b8;
    font-style: italic;
}

/* Score */
.team-score {
    font-size: 20px;
    font-weight: 700;
    color: #1B6FF3;
    min-width: 35px;
    text-align: right;
}

.bracket-team.winner .team-score {
    color: #059669;
}

/* Badge de estado */
.match-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 8px;
}

.match-status-badge.live {
    background: #fef3c7;
    color: #92400e;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.match-status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.match-status-badge.scheduled {
    background: #dbeafe;
    color: #1e40af;
}

/* Match vacío (BYE) */
.bracket-match.bye {
    opacity: 0.5;
    border-style: dashed;
}

.bracket-match.bye .match-header {
    background: #94a3b8;
}

/* Líneas de conexión entre matches */
.bracket-round::after {
    content: '';
    position: absolute;
    right: -40px;
    top: 50%;
    width: 40px;
    height: 2px;
    background: #e2e8f0;
}

.bracket-round:last-child::after {
    display: none;
}

/* Final especial */
.bracket-final {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    border: 3px solid #ffd700;
}

.bracket-final .match-header {
    background: linear-gradient(135deg, #ffa500 0%, #ff8c00 100%);
    font-size: 16px;
}

.bracket-final .team-name {
    font-size: 17px;
}

/* Responsive */
@media (max-width: 1024px) {
    .bracket {
        gap: 30px;
    }
    
    .bracket-round {
        min-width: 240px;
    }
}

@media (max-width: 768px) {
    .bracket-container {
        padding: 20px 10px;
    }
    
    .bracket {
        gap: 20px;
        padding: 10px;
    }
    
    .bracket-round {
        min-width: 200px;
    }
    
    .bracket-round-title {
        font-size: 14px;
        padding: 8px;
    }
    
    .team-name {
        font-size: 13px;
    }
    
    .team-score {
        font-size: 16px;
    }
}

/* Loading state */
.bracket-loading {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.bracket-loading::after {
    content: "⌛";
    font-size: 48px;
    display: block;
    margin-top: 20px;
    animation: spin 1.5s linear infinite;
}

/* Empty state */
.bracket-empty {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.bracket-empty h3 {
    color: #1e293b;
    margin-bottom: 10px;
}
