/* =================================================================== */
/* === ПОЛНЫЙ CSS-ФАЙЛ ДЛЯ МЕНЕДЖЕРА ТУРНИРОВ (ФИНАЛЬНАЯ ВЕРСИЯ) === */
/* =================================================================== */

/* --- Общие стили --- */
body {
    margin: 0; 
    font-family: "Inter", sans-serif;
    font-weight: 500;
    background-color: #e4e4e4;
    color: #525252;
}
h1, h2, h3 {
    font-family: 'Montserrat', sans-serif;
    color: #444;
}
a {
    text-decoration: none; 
    color: inherit; 
}
.container {
    max-width: 1200px; 
    margin: 0 auto;
    padding: 20px 15px; 
}

/* --- Шапка и Навигация --- */
.site-header {
    padding: 20px 0 15px; 
    background-color: transparent;
    border-bottom: 1px solid #d0d0d0;
}
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo a {
    font-family: "Rubik Lines", system-ui;
    font-size: 40px;
    font-style: normal;
    font-weight: 400;
    color: #525252;
}
.logo .accent {
    color: #ff7122; 
    text-shadow: 0 0 1px #ff7122;
}
.main-nav ul {
    margin: 0;
    padding: 0;
    list-style: none; 
    display: flex; 
    gap: 18px;
}
.main-nav a {
    font-family: "Inter", sans-serif;
    font-size: 20px;
    padding: 2px 0;
    font-weight: 500;
    position: relative;
    color: #525252;
    transition: color 0.2s ease;
}
.main-nav a:hover {
    color: #444;
}
.main-nav a#tournaments-modal-trigger {
    cursor: pointer;
}
.main-nav a::after {
    content: '';
    position: absolute; 
    bottom: -5px;
    left: 0;
    width: 0; 
    height: 2px;
    background-color: #ff7122; 
    transition: width 0.3s ease-in-out; 
}
.main-nav a:hover::after {
    width: 100%;
}
.main-nav li.dropdown {
    position: relative;
}
.main-nav li.dropdown .dropdown-toggle::after {
    display: none !important;
}
.main-nav li.dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 6px;
    list-style: none;
    padding: 10px 0;
    margin-top: 10px;
    min-width: 220px;
    z-index: 100;
}
.main-nav li.dropdown.open .dropdown-menu {
    display: block;
}
.dropdown-menu li a {
    display: block;
    padding: 10px 20px;
    font-size: 16px;
    white-space: nowrap;
}
.dropdown-menu li a:hover {
    background-color: #f5f5f5;
}
.hamburger-menu {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #333;
    cursor: pointer;
}
@media (max-width: 992px) {
    .hamburger-menu {
        display: block;
    }
    .main-nav {
        display: none;
    }
    .mobile-menu-wrapper {
        display: none; 
        position: absolute;
        top: 75px;
        left: 0;
        right: 0;
        background-color: #fff;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        z-index: 999;
    }
    .mobile-menu-wrapper.active {
        display: block;
    }
    .mobile-menu-wrapper .main-nav {
        display: block;
    }
    .mobile-menu-wrapper .main-nav ul {
        flex-direction: column;
        gap: 0;
    }
    .mobile-menu-wrapper .main-nav li {
        border-bottom: 1px solid #f0f0f0;
    }
    .mobile-menu-wrapper .main-nav a {
        display: block;
        padding: 15px 20px;
    }
    .mobile-menu-wrapper .main-nav a::after {
        display: none;
    }
}
/* Стили для УПРОЩЕННОЙ шапки */
header.simple-header div.logo a {
    font-family: "Rubik Lines", system-ui !important;
    font-size: 40px;
    font-style: normal;
    font-weight: 400;
    color: #525252;
}

/* --- Главная страница менеджера --- */

.button:hover, .top-bar button:hover {
    background-color: #e66017;
}
.search-form {
    display: flex;
    gap: 5px;
}
.search-form input[type="text"] {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    min-width: 160px; 
}
.tournament-list {
    display: grid;
    gap: 20px;
}
.tournament-item {
    background-color: #edf1eb;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #b2b2b2;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tournament-info h3 {
    margin: 0 0 5px 0;
}
.tournament-info p {
    margin: 0;
    color: #666;
}
.status-active {
    color: #28a745;
    font-weight: bold;
}
.status-completed {
    color: #888;
}
.tournament-actions {
    display: flex;
    gap: 10px;
}
.pagination {
    text-align: center;
    margin-top: 30px;
}
.pagination a {
    color: #ff7122;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid #ff7122;
    border-radius: 4px;
    transition: all 0.2s ease;
}
.pagination a:hover {
    background-color: #ff7122;
    color: white;
}
.pagination span {
    padding: 8px 12px;
}


/* --- Страницы создания турнира и Регистрации/Входа --- */
.back-button {
    display: inline-block;
    margin-bottom: 25px;
    background-color: #fff;
    color: #555;
    border: 1px solid #ccc;
    padding: 8px 16px;
    font-size: 14px;
}
.back-button:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
}
.format-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
    margin-top: 30px;
}
.format-card {
    background-color: #edf1eb;
    border-radius: 16px;
    padding: 25px;
    border: 1px solid #b2b2b2;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.format-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}
.format-card h3 {
    margin-top: 0;
    font-size: 22px;
}
.format-card .format-subtitle {
    font-size: 16px;
    font-weight: bold;
    color: #ff7122;
    margin: -15px 0 15px 0;
}
.format-card p {
    flex-grow: 1; 
    line-height: 1.6;
}
.format-card button {
    width: 100%;
    margin-top: 20px;
}
.form-container {
    max-width: 800px;
    margin: 30px auto;
}
.form-container h1, .form-container h2 {
    text-align: center;
}
.form-container h2 {
    color: #888;
    font-weight: normal;
    margin-top: -10px;
    margin-bottom: 30px;
}
.details-form {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px 40px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}
.details-form .form-group {
    margin-bottom: 25px;
}
.details-form .form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #444;
}
.details-form input[type="text"],
.details-form input[type="number"],
.details-form textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.details-form input[type="text"]:focus,
.details-form input[type="number"]:focus,
.details-form textarea:focus {
    outline: none;
    border-color: #ff7122;
    box-shadow: 0 0 0 3px rgba(255, 113, 34, 0.2);
}
.details-form textarea {
    min-height: 150px;
    resize: vertical;
}
.details-form .radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #f9f9f9;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 5px;
}
.details-form .radio-group label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.details-form .form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.form-footer-link {
    text-align: center;
    margin-top: 20px;
}
.form-footer-link a {
    color: #ff7122;
    font-weight: bold;
    text-decoration: underline;
}

/* --- Стили для страницы просмотра Турнира --- */
.container > h1 {
    text-align: center;
}
.tournament-meta-info {
    text-align: center;
    margin-top: -10px;
    margin-bottom: 25px;
    color: #777;
}
.tournament-meta-info span {
    margin: 0 15px;
}
.tournament-meta-info strong {
    color: #555;
}
.winner-announcement {
    background-color: #edf1eb;
    border: 1px solid #b2b2b2;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.winner-announcement h3 {
    margin: 0 0 15px 0;
    color: #28a745;
}
.winner-announcement .podium {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    max-width: 400px;
    font-size: 18px;
    line-height: 1.8;
}
.winner-announcement .podium li {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
}
/* Общий стиль для секций (сетки, таблицы) */
.bracket-section {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.bracket-section h2 {
    text-align: center;
    margin-top: 0;
}
.rounds-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 15px;
    position: relative;
}
.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 300px;
    flex-shrink: 0;
    gap: 10px;
}
.round-title {
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    padding: 10px;
    color: #444;
    margin-bottom: 5px;
}
.bracket-match {
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #2285ff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
    padding: 10px;
    margin-bottom: 10px;
}
.player-name {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}
.player-name.winner {
    font-weight: bold;
    color: #28a745;
}
.player-name a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}
.player-name a:hover {
    color: #ff7122;
}
.vs-separator {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 4px 0;
}
.match-actions-center {
    text-align: center;
    padding: 4px 0;
}
.match-actions {
    text-align: center;
    padding-top: 8px;
}
.draw-button {
    background-color: #6c757d;
    color: white;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
.draw-button:hover {
    background-color: #5a6268;
    color: white;
}
.undo-button {
    background: none;
    border: none;
    color: #007bff;
    text-decoration: underline;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}
.undo-button:hover {
    color: #0056b3;
}
.player-score {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}
.icon-advance, .icon-drop, .icon-eliminated, .icon-trophy, .player-name .fa-crown {
    margin-left: 8px;
}
.icon-advance { color: #28a745; }
.icon-drop { color: #ffc107; }
.icon-eliminated { color: #dc3545; }
.icon-trophy.gold { color: #FFD700; }
.icon-trophy.silver { color: #C0C0C0; }
.icon-trophy.bronze { color: #CD7F32; }
.player-name .fa-crown { color: #ffc107; }

/* Стили для таблиц (Швейцарка, Круговик) */
.swiss-layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}
@media (max-width: 1024px) {
    .swiss-layout-grid {
        grid-template-columns: 1fr;
    }
}
.crosstable {
    width: 100%;
    border-collapse: collapse;
}
.crosstable th, .crosstable td {
    text-align: center;
    padding: 10px 5px;
    border: 1px solid #eee;
}
.crosstable td:nth-child(2) {
    text-align: left;
    font-weight: 500;
}
.crosstable tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}
.crosstable-self {
    background-color: #e9ecef;
    color: #aaa;
}
/* --- Стили для единого блока-инструкции --- */

.intro-text-block {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px 15px;
    font-size: 17px;
    line-height: 1.6;
}

.intro-text-block h4 {
    margin-top: 15px;
    margin-bottom: 8px;
    text-align: center;
    font-size: 17px;
    color: #ff7122;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.intro-text-block h4:first-child {
    margin-top: 0;
}

.intro-text-block ul, .intro-text-block ol {
    padding-left: 20px;
    margin-bottom: 0;
}

.intro-text-block li {
    margin-bottom: 5px;
}
/* --- Стили для двухколоночного макета на главной странице менеджера --- */

.manager-layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Основной контент в 2 раза шире сайдбара */
    gap: 30px;
    align-items: flex-start;
}

/* В сайдбаре карточки-инструкции автоматически выстроятся в одну колонку */
.sidebar .intro-card-grid {
    margin-top: 0;
    grid-template-columns: 1fr; /* Гарантируем одну колонку */
    position: sticky; /* Делаем сайдбар "липким" при прокрутке */
    top: 20px;
}

/* Адаптивность для мобильных */
@media (max-width: 992px) {
    .manager-layout-grid {
        grid-template-columns: 1fr; /* На маленьких экранах все идет в одну колонку */
    }
}
/* --- НОВЫЕ СТИЛИ ДЛЯ ВЕРХНЕЙ ПАНЕЛИ И МАКЕТА --- */

/* Трехколоночная верхняя панель */
.new-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}
.top-bar-left, .top-bar-right {
    flex: 1; /* Занимают одинаковое пространство по бокам */
}
.top-bar-right {
    display: flex;
    justify-content: flex-end;
}
.top-bar-center {
    flex-grow: 2; /* Заголовок занимает центральное пространство */
    text-align: center;
}
.top-bar-center h1 {
    margin: 0;
    font-size: 32px;
}

/* Кнопка "Войти" слева */
.button-simple {
    background-color: transparent;
    color: #ff7122;
    border: 2px solid #ff7122;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.button-simple:hover {
    background-color: #ff7122;
    color: white;
}
.register-link {
    margin-left: 10px;
    background-color: #ff7122;
    color: white;
}

/* Поиск в сайдбаре */
.sidebar-search-form {
    margin-bottom: 20px;
}
.search-container {
    position: relative;
}
.search-container input {
    width: 100%;
    padding: 12px 40px 12px 15px; /* Оставляем место для иконки */
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}
.search-container .search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

/* Кнопка "Создать турнир" над списком */
.create-button-main {
    display: block;
    width: 40%;
    text-align: center;
    margin-bottom: 25px;
    padding: 15px;
    font-size: 18px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .new-top-bar {
        flex-direction: column;
        gap: 15px;
    }
    .top-bar-left, .top-bar-right {
        display: none; /* Скрываем пустые блоки и поиск на мобильных */
    }
    .main-content {
        order: 2; /* Список турниров идет после сайдбара */
    }
    .sidebar {
        order: 1; /* Сайдбар идет первым */
    }
    /* Показываем отдельную форму поиска для мобильных */
    .mobile-search-form {
        display: block;
        margin-bottom: 15px;
    }
    .mobile-search-form .search-container button {
        display: none; /* Скрываем кнопку, поиск по вводу */
    }
}
@media (min-width: 769px) {
    .mobile-search-form, .mobile-create-button, .mobile-auth-link {
        display: none; /* Скрываем мобильные элементы на десктопе */
    }
}
/* --- СТИЛИ ДЛЯ НОВОЙ ТРЕХКОЛОНОЧНОЙ ВЕРХНЕЙ ПАНЕЛИ --- */

.new-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.top-bar-left, .top-bar-right {
    flex: 1; /* Занимают одинаковое пространство по бокам */
}

.top-bar-left {
    display: flex;
    justify-content: flex-start; /* Выравнивание по левому краю */
    gap: 10px; /* Расстояние между кнопками "Войти" и "Регистрация" */
}

.top-bar-right {
    display: flex;
    justify-content: flex-end; /* Выравнивание по правому краю */
}

.top-bar-center {
    flex-grow: 2; /* Заголовок занимает основное центральное пространство */
    text-align: center;
}

.page-title {
    margin: 0;
    font-size: 36px;
    font-family: 'Montserrat', sans-serif;
}

/* Стили для кнопок "Войти" / "Регистрация" */
.button-simple {
    background-color: transparent;
    color: #ff7122;
    border: 2px solid #ff7122;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap; /* Чтобы текст не переносился */
}

.button-simple:hover {
    background-color: #ff7122;
    color: white;
}

.register-link {
    background-color: #ff7122;
    color: white;
}

/* Поиск в сайдбаре (этот стиль у вас уже должен быть, но на всякий случай) */
.sidebar-search-form .search-container {
    position: relative;
}
.sidebar-search-form input {
    width: 100%;
    box-sizing: border-box;
}
.sidebar-search-form .search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}
/* --- ОБЩИЙ СТИЛЬ ДЛЯ ОСНОВНЫХ КНОПОК --- */

.button {
    display: inline-block; /* Для корректного отображения отступов у ссылок */
    background-color: #ff7122;
    color: white !important; /* !important, чтобы перебить другие стили ссылок */
    border: none;
    padding: 8px 16px;
    font-size: 15px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease;
    white-space: nowrap; /* Чтобы текст не переносился */
}

.button:hover {
    background-color: #e66017;
    color: white !important;
}
/* --- Стили для прокручиваемого блока с турами --- */

.sidebar-column .rounds-container-vertical {
    max-height: 80vh; /* Максимальная высота блока, подберите под себя */
    overflow-y: auto; /* Добавляет вертикальную прокрутку, если содержимое не помещается */
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fdfdfd;
}

/* Убираем лишний фон и рамку у секции, так как теперь есть свой фон у контейнера */
.sidebar-column .bracket-section {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
}

/* Убираем лишний отступ у последней таблицы в списке туров */
.sidebar-column .round-table:last-child {
    margin-bottom: 0;
}
/* --- Стили для списка туров в сайдбаре (на div-ах) --- */

.rounds-container-vertical {
    max-height: 80vh;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fdfdfd;
}

.round-block {
    margin-bottom: 10px;
}

.round-block:last-child {
    margin-bottom: 0;
}

.round-block .round-title {
    background-color: #f0f0f0;
    padding: 10px;
    font-size: 16px;
    font-weight: bold;
    color: #444;
    border-radius: 6px 6px 0 0;
    border: 1px solid #e0e0e0;
    border-bottom: none;
}

/* Применяем стиль карточки к матчам внутри этого блока */
.round-block .bracket-match {
    border-radius: 0 0 6px 6px;
    border-top: none;
    margin: 0;
}
.round-block .bracket-match:last-child {
    margin-bottom: 0;
}
/* --- СТИЛИ ДЛЯ НОВОГО ПЬЕДЕСТАЛА ПОЧЕТА --- */

.podium-announcement {
    background-color: #fff;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    border: 1px solid #ddd;
}

.podium-tournament-title {
    text-align: center;
    margin-top: 0;
    font-size: 32px;
    color: #333;
}

.podium-subtitle {
    text-align: center;
    margin-top: -10px;
    margin-bottom: 30px;
    font-size: 18px;
    color: #28a745;
    font-weight: bold;
}

.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Выравниваем по нижнему краю */
    gap: 20px;
    flex-wrap: wrap;
    min-height: 120px;
}

.podium-place {
    text-align: center;
    width: 250px;
}

.podium-trophy {
    font-size: 64px;
    line-height: 1;
}

.podium-name {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-top: 10px;
}

.podium-score {
    font-size: 16px;
    color: #666;
    margin-top: 5px;
}

/* Размеры и порядок для пьедестала */
.podium-gold {
    order: 2;
     transform: translateY(-25px); /* Центральный элемент */
}
.podium-silver {
    order: 1; /* Левый элемент */
}
.podium-bronze {
    order: 3; /* Правый элемент */
}

.podium-gold .podium-trophy {
    font-size: 80px; /* Большой кубок */
}
.podium-gold .podium-name {
    font-size: 24px;
}