/* Стили для модуля турниров */

/* Основные стили управления турнирами */
.tournaments-management {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tournaments-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.tournaments-table-container {
    overflow-x: auto;
}

.tournaments-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.tournaments-table th,
.tournaments-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.tournaments-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.tournaments-table tr:hover {
    background-color: #f8f9fa;
}

.text-center {
    text-align: center !important;
}

.text-muted {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Статусы турниров */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.draft {
    background-color: #e9ecef;
    color: #495057;
}

.status-badge.active {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.paused {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.finished {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Кнопки действий */
.actions-cell {
    white-space: nowrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    margin-right: 5px;
}

.btn:last-child {
    margin-right: 0;
}

.btn-primary {
    background-color: #007bff;
    color: #fff;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-success {
    background-color: #28a745;
    color: #fff;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-edit {
    background-color: #17a2b8;
    color: #fff;
    padding: 4px 8px;
}

.btn-edit:hover {
    background-color: #138496;
}

.btn-view {
    background-color: #6f42c1;
    color: #fff;
    padding: 4px 8px;
}

.btn-view:hover {
    background-color: #5a359a;
}

.btn-delete {
    background-color: #dc3545;
    color: #fff;
    padding: 4px 8px;
}

.btn-delete:hover {
    background-color: #c82333;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
    padding: 4px 8px;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-large {
    padding: 12px 24px;
    font-size: 1rem;
}

/* Пустое состояние */
.no-tournaments {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.no-tournaments svg {
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-tournaments p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* Форма редактирования турнира */
.tournament-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.tournament-form-container {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tournament-form {
    max-width: 800px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    margin-bottom: 20px;
    color: #495057;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group.full-width {
    flex: 0 0 100%;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Уведомления */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    transition: opacity 0.3s;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Управление игроками */
.add-player-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.add-player-section h3 {
    margin-bottom: 20px;
    color: #495057;
}

.player-type-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.add-player-form {
    margin: 0;
}

.search-group {
    position: relative;
}

.search-container {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-result-item {
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item.selected {
    background-color: #007bff;
    color: #fff;
}

/* Список игроков */
.players-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.section-header h3 {
    margin: 0;
    color: #495057;
}

.players-count {
    color: #6c757d;
    font-weight: 500;
}

.players-count .count {
    color: #007bff;
    font-weight: 700;
}

.players-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.players-table {
    width: 100%;
    border-collapse: collapse;
}

.players-table th,
.players-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.players-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.players-table tr:hover {
    background-color: #f8f9fa;
}

/* Типы игроков */
.type-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-badge.registered {
    background-color: #d4edda;
    color: #155724;
}

.type-badge.external {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.withdrawn {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background-color: #e2e3e5;
    color: #383d41;
    vertical-align: middle;
}

.players-table tr.player-withdrawn {
    opacity: 0.75;
}

.players-table tr.player-withdrawn td:nth-child(2) strong {
    text-decoration: line-through;
    color: #6c757d;
}

.no-players {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.no-players svg {
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-players p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.tournament-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
}

/* Только крестик в шапке модалки — кнопка "Отмена" в .modal-actions тоже
   несёт класс .close-modal (нужен тот же клик-обработчик), но ей нужен
   обычный вид .btn-secondary, а не крошечный квадрат без фона — без скоупа
   на .modal-header это правило перебивало стиль кнопки (найдено 2026-07-15
   в billing.css/club_members.css, тот же паттерн скопирован и сюда). */
.modal-header .close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #adb5bd;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header .close-modal:hover {
    color: #495057;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.warning {
    color: #856404;
    font-style: italic;
    margin-top: 10px;
}

.info-notice {
    color: #0c5460;
    font-style: italic;
    margin-top: 10px;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 8px;
    background: #fff;
    border: 1px solid #dee2e6;
    color: #007bff;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.pagination-btn.active {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
}

.pagination-ellipsis {
    padding: 8px;
    color: #6c757d;
}

/* Адаптивность */
/* Стили для управления турами */
.tournament-info {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border-left: 4px solid #007bff;
}

.info-card h4 {
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 0.875rem;
    text-transform: uppercase;
    font-weight: 600;
}

.info-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #495057;
}

.tournament-actions-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.action-form {
    display: inline-block;
    margin: 0 10px;
}

/* Стили для партий */
.current-round-section,
.standings-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.round-progress {
    color: #6c757d;
    font-weight: 500;
}

.games-table-container,
.standings-table-container {
    overflow-x: auto;
    margin-top: 15px;
}

.games-table,
.standings-table {
    width: 100%;
    border-collapse: collapse;
}

.games-table th,
.games-table td,
.standings-table th,
.standings-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.games-table th,
.standings-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.games-table tr:hover,
.standings-table tr:hover {
    background-color: #f8f9fa;
}

/* Статусы партий */
.game-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.game-status.scheduled {
    background-color: #e9ecef;
    color: #495057;
}

.game-status.playing {
    background-color: #fff3cd;
    color: #856404;
}

.game-status.finished {
    background-color: #d4edda;
    color: #155724;
}

.game-status.adjourned {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Результаты партий */
.result-display {
    font-weight: 700;
    font-size: 1.1rem;
    color: #495057;
}

.result-pending {
    color: #6c757d;
    font-style: italic;
}

/* Активные партии */
.game-active {
    background-color: #fff3cd !important;
}

.game-active:hover {
    background-color: #ffeaa7 !important;
}

/* Места в турнирной таблице */
.first-place {
    background-color: #fff8dc !important;
    border-left: 4px solid #ffd700;
}

.second-place {
    background-color: #f8f9fa !important;
    border-left: 4px solid #c0c0c0;
}

.third-place {
    background-color: #fdf6e3 !important;
    border-left: 4px solid #cd7f32;
}

.score-cell {
    font-weight: bold;
    font-size: 1.1rem;
}

/* Модальное окно результата */
.game-info {
    margin-bottom: 20px;
}

.players-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.player-color {
    font-size: 2rem;
}

.player-name {
    font-weight: 600;
    color: #495057;
}

.vs {
    font-weight: 700;
    color: #6c757d;
    font-size: 1.2rem;
}

.result-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.result-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-option:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.result-option input[type="radio"] {
    margin: 0;
    width: 20px;
    height: 20px;
}

.result-option input[type="radio"]:checked + .result-text {
    color: #007bff;
    font-weight: 600;
}

.result-text {
    font-size: 1rem;
    color: #495057;
}

/* Прогресс-бар */
.progress-bar {
    position: relative;
    width: 100%;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
}

/* Индикаторы сортировки */
.sort-asc::after {
    content: ' ↑';
    color: #007bff;
}

.sort-desc::after {
    content: ' ↓';
    color: #007bff;
}

/* Уведомления */
.notification {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
}

.notification.success {
    background-color: #28a745 !important;
}

.notification.error {
    background-color: #dc3545 !important;
}

.notification.info {
    background-color: #17a2b8 !important;
}

/* Адаптивность для управления турами */
@media (max-width: 768px) {
    /* шапка действий списка турниров — перенос и выравнивание */
    .tournaments-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    /* главная таблица турниров — компактнее + плавный скролл */
    .tournaments-table-container {
        -webkit-overflow-scrolling: touch;
    }

    .tournaments-table th,
    .tournaments-table td {
        padding: 8px 8px;
        font-size: 13px;
    }

    .info-cards {
        grid-template-columns: 1fr;
    }

    .players-info {
        flex-direction: column;
        gap: 10px;
    }

    .vs {
        transform: rotate(90deg);
    }

    .tournament-actions-section {
        text-align: center;
    }

    .action-form {
        display: block;
        margin: 10px 0;
    }

    .games-table-container,
    .standings-table-container {
        font-size: 0.875rem;
    }

    .games-table th,
    .games-table td,
    .standings-table th,
    .standings-table td {
        padding: 8px 4px;
    }
}
