/* Импортируем основные переменные и стили */
@import url('components/fonts_and_variables.css');

body {
    background-color: var(--bg-dark, #1e2124);
    color: var(--text-light, #ffffff);
    font-family: var(--font-family, 'Poppins', sans-serif);
}

/* Основной контейнер турнирной таблицы */
.tournament-bracket {
    display: flex;
    justify-content: space-between;
    overflow-x: auto;
    padding: 20px;
    gap: 30px;
    min-height: 70vh;
}

/* Раунд */
.round {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
}

.round-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 20px;
}

/* Заголовок раунда */
.round-title {
    text-align: center;
    margin-bottom: 25px;
    font-weight: bold;
    font-size: 1.5em;
    background: linear-gradient(135deg, var(--primary-color, #4a90e2), var(--secondary-color, #357abd));
    color: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Контейнер матча */
.match-container {
    position: relative;
    margin-bottom: 20px;
}

/* Матч */
.match {
    position: relative;
    background: var(--card-bg, #2f3136);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    overflow: hidden;
}

.match:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border-color: var(--primary-color, #4a90e2);
}

/* Участник */
.participant {
    padding: 15px;
    margin: 0;
    background-color: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.participant:last-child {
    border-bottom: none;
}

.participant:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Победитель */
.winner {
    background: linear-gradient(135deg, var(--success-color, #28a745), #20c997);
    color: white;
    font-weight: bold;
    position: relative;
}

.winner::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #ffd700, #ffed4e);
}

.winner:hover {
    background: linear-gradient(135deg, #20c997, var(--success-color, #28a745));
}

/* Аватар участника */
.participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.winner .participant-avatar {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.participant-initial {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color, #4a90e2), var(--secondary-color, #357abd));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.winner .participant-initial {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Информация о задании - максимально в правом верхнем углу матча */
.task-info-container {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

.task-info {
    background: linear-gradient(135deg, var(--info-color, #17a2b8), #20c997);
    color: white;
    border-radius: 0 10px 0 10px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.4);
    font-size: 24px;
}

.task-info:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.6);
    background: linear-gradient(135deg, #20c997, var(--info-color, #17a2b8));
}

/* Коннекторы между матчами */
.match-connector {
    position: absolute;
    right: -30px;
    top: 50%;
    width: 30px;
    height: 2px;
    background: linear-gradient(to right, var(--primary-color, #4a90e2), transparent);
    transform: translateY(-50%);
}

.round:not(:last-child) .match-connector::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -25px;
    width: 2px;
    height: 50px;
    background: linear-gradient(to bottom, var(--primary-color, #4a90e2), transparent);
}

/* Стили для popover */
.popover {
    background-color: var(--card-bg, #2f3136);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.popover-header {
    background: linear-gradient(135deg, var(--primary-color, #4a90e2), var(--secondary-color, #357abd));
    color: white;
    border: none;
    border-radius: 10px 10px 0 0;
    font-weight: bold;
}

.popover-body {
    background-color: var(--card-bg, #2f3136);
    color: var(--text-light, #ffffff);
    border-radius: 0 0 10px 10px;
    border: none;
}

.popover .arrow::before {
    border-top-color: var(--card-bg, #2f3136);
}

/* Адаптивность */
@media (max-width: 1200px) {
    .tournament-bracket {
        gap: 20px;
    }
    
    .round {
        min-width: 220px;
    }
}

@media (max-width: 768px) {
    .tournament-bracket {
        flex-direction: column;
        align-items: center;
        gap: 30px;
        padding: 15px;
    }
    
    .round {
        width: 100%;
        max-width: 350px;
        min-width: auto;
    }
    
    .round-title {
        font-size: 1.3rem;
        margin-bottom: 20px;
        padding: 12px;
    }
    
    .match-container {
        margin-bottom: 15px;
    }
    
    .participant {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .participant-avatar,
    .participant-initial {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .task-info {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .match-connector,
    .match-connector::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .round {
        max-width: 100%;
    }
    
    .round-title {
        font-size: 1.1rem;
        padding: 10px;
    }
    
    .participant {
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .participant-avatar,
    .participant-initial {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .task-info {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* Анимации */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.round {
    animation: slideInFromLeft 0.6s ease forwards;
}

.round:nth-child(2) {
    animation-delay: 0.1s;
}

.round:nth-child(3) {
    animation-delay: 0.2s;
}

.round:nth-child(4) {
    animation-delay: 0.3s;
}

.round:nth-child(5) {
    animation-delay: 0.4s;
}

/* Дополнительные стили для улучшения UX */
.tournament-bracket::-webkit-scrollbar {
    height: 8px;
}

.tournament-bracket::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.tournament-bracket::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color, #4a90e2), var(--secondary-color, #357abd));
    border-radius: 4px;
}

.tournament-bracket::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--secondary-color, #357abd), var(--primary-color, #4a90e2));
}