/* Страница клуба - новый дизайн */

.club-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Хедер клуба */
.club-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 1rem;
    box-shadow: 4px 4px 20px rgba(255, 255, 255, 0.1);
}

.club-identity {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.club-logo {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background-color: #ccc;
    overflow: hidden;
    flex-shrink: 0;
}

.club-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.club-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.club-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
}

.club-description {
    font-size: 0.875rem;
    color: #ccc;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.club-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #888;
}

.club-contacts span,
.club-contacts a {
    display: inline-flex;
    align-items: center;
}

.club-contacts span:not(:last-child)::after {
    content: "•";
    margin-left: 0.75rem;
    color: #555;
}

.club-contacts a {
    color: var(--clm-orange, #ff9000);
    text-decoration: none;
}

.club-contacts a:hover {
    text-decoration: underline;
}

/* Статистика клуба */
.club-stats {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 70px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.stat-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: lowercase;
}

/* Кнопки действий */
.club-actions {
    display: flex;
    align-items: center;
}

.club-actions .main-action {
    position: static;
}

/* Навигация */
.club-nav {
    display: flex;
    flex-direction: column;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 1rem;
    overflow: hidden;
}

/* Главные табы */
.main-tabs {
    display: flex;
    flex-direction: row;
    border-bottom: 1px solid #333;
}

.main-tab {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.main-tab:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.main-tab.active {
    color: #fff;
    border-bottom-color: var(--clm-red, #c62828);
}

/* Подтабы */
.sub-tabs {
    display: flex;
    flex-direction: row;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.02);
}

.sub-tabs.hidden {
    display: none;
}

.sub-tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.sub-tab:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.sub-tab.active {
    color: #fff;
    background-color: var(--clm-button-red, #2a1a1a);
}

/* Контент */
.club-content {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 1rem;
    box-shadow: 4px 4px 20px rgba(255, 255, 255, 0.1);
}

/* Таблицы на всю ширину */
.club-content .content-table {
    width: 100%;
}

/* Data wrapper */
.data-wrapper {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1.5rem;
    gap: 0.5rem;
    text-align: left;
    color: #fff;
    width: 96%;
    border-radius: 1rem;
}

.data-wrapper.hidden {
    display: none;
}

/* Строки пользователей */
.user-row {
    align-self: stretch;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    border-bottom: solid 1px var(--clm-content-border, #333);
    padding: 0.5rem 0;
}

.user-avatar {
    display: flex;
    position: relative;
}

.user-avatar img {
    height: 4rem;
    width: 4rem;
    object-fit: cover;
    border-radius: 0.5rem;
    border: none;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.2rem;
}

.user-status {
    position: relative;
    font-size: 14px;
    color: #10b981;
    text-align: right;
    margin-left: auto;
}

/* Кнопки действий */
.request-actions {
    display: flex;
    position: relative;
    flex-direction: row;
    margin-left: auto;
    gap: 0.5rem;
    align-items: center;
}

.action-btn {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 3.5rem;
    text-align: center;
    padding: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    background-color: var(--clm-button-red, #2a1a1a);
    color: var(--clm-text, #fff);
    min-width: 0;
    z-index: 10;
    cursor: pointer;
}

.action-btn:hover,
.action-btn.dark:hover,
.action-btn.red:hover,
.action-btn.dark-red:hover {
    color: var(--clm-red, #c62828);
    background-color: var(--clm-text, #fff);
}

.action-btn.success:hover {
    color: var(--clm-text-green-light, #10b981);
}

.action-btn.dark {
    background-color: var(--clm-light-bg, #333);
}

.action-btn.info {
    background-color: var(--clm-text, #fff);
    color: var(--clm-text-green-light, #10b981);
}

/* Статус "участник клуба" — без фона, только иконка */
.action-btn.info.success {
    background-color: transparent;
    box-shadow: none;
    color: #10b981;
}

.action-btn.red {
    background-color: var(--clm-red, #c62828);
}

.action-btn.dark-red {
    background-color: var(--clm-button-red, #2a1a1a);
}

/* Статусы запросов */
.request-status {
    display: flex;
    align-items: center;
    font-size: 2rem;
    font-weight: 600;
    line-height: 2rem;
    text-align: center;
    padding: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    background-color: var(--clm-text, #fff);
    min-width: 0;
    z-index: 10;
}

.request-status.approved {
    color: var(--clm-text-green-light, #10b981);
}

.request-status.rejected {
    color: var(--clm-red, #c62828);
}

.request-status.pending {
    color: var(--clm-orange, #ff9000);
}

/* Адаптивность */
@media (max-width: 900px) {
    .club-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .club-stats {
        width: 100%;
        justify-content: space-between;
    }

    .club-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 600px) {
    .club-identity {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-tabs {
        flex-wrap: wrap;
    }

    .main-tab {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .club-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .stat-item {
        min-width: 60px;
    }
}

/* Селектор турнира на странице клуба */
.tournament-tab-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tournament-selector {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    min-width: 280px;
    transition: border-color 0.2s;
}

.tournament-selector:hover,
.tournament-selector:focus {
    border-color: rgba(255, 144, 0, 0.5);
}

.tournament-selector option {
    background: #1a1a2e;
    color: #fff;
}

.tournament-tab-content {
    min-height: 100px;
}

.tournament-tab-content .loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    color: #888;
}

.tournament-tab-content .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.4);
}

.tournament-tab-content .empty-state .material-symbols-outlined {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

/* Анимация вращения для индикатора загрузки */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinning {
    animation: spin 1s linear infinite;
}

@media (max-width: 768px) {
    /* Страница клуба — фиксируем ширину, чтобы не гуляла при смене вкладок */
    .club-page {
        width: 100%;
        box-sizing: border-box;
    }

    /* Хедер клуба — grid: [logo] [info] [actions] / [stats] */
    .club-header {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "logo info actions"
            "stats stats stats";
        gap: 0.75rem 1rem;
        padding: 1rem;
        align-items: center;
    }

    /* Растворяем club-identity, его дети участвуют в grid напрямую */
    .club-identity {
        display: contents;
    }

    .club-logo {
        grid-area: logo;
        width: 56px;
        height: 56px;
        align-self: center;
    }

    .club-info {
        grid-area: info;
        align-self: center;
    }

    .club-stats {
        grid-area: stats;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .club-actions {
        grid-area: actions;
        align-self: center;
    }

    .club-title {
        font-size: 1.2rem;
    }
    .club-description {
        max-width: 100%;
    }
    .stat-item {
        min-width: 0;
        flex: 1;
    }
    .stat-value {
        font-size: 1rem;
    }

    /* Главные табы — скролл */
    .main-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .main-tabs::-webkit-scrollbar {
        display: none;
    }
    .main-tab {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .tournament-selector {
        min-width: 200px;
        font-size: 0.8rem;
    }

    /* Data wrapper — компактнее, с горизонтальным скроллом для широких таблиц */
    /* !important нужен для переопределения инлайн-стилей style="width: 96%" */
    .data-wrapper {
        padding: 1rem;
        width: 100% !important;
        box-sizing: border-box;
        overflow-x: auto;
    }

    /* Строки пользователей */
    .user-avatar img {
        height: 3rem;
        width: 3rem;
    }

    /* Action-кнопки — компактнее на мобильных (переопределяем 44px touch target из clm.css) */
    .club-content .action-btn {
        min-width: 2rem;
        min-height: 2rem;
        font-size: 1.1rem !important;
        line-height: 1.1rem;
        padding: 0.4rem;
        border-radius: 0.4rem;
    }
    .club-content .action-btn .material-symbols-outlined,
    .club-content .action-btn span {
        font-size: 1.1rem;
    }
    /* Переопределяем !important из clm.css для .action-buttons .action-btn */
    .club-content .action-buttons .action-btn {
        width: 2rem;
        height: 2rem;
        font-size: 1.1rem !important;
    }

    /* Кнопки действий */
    .request-actions {
        flex-wrap: wrap;
    }

    /* Табы */
    .sub-tabs {
        flex-wrap: wrap;
        padding: 0.5rem;
    }
    .sub-tab {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    /* Судьи — 1 колонка */
    .data[style*="grid-template-columns: repeat(2"] {
        grid-template-columns: 1fr !important;
    }

    /* Контент клуба — не растягивается от переполнения */
    .club-content {
        overflow: hidden;
        width: 100%;
        box-sizing: border-box;
    }

    /* Таблицы внутри клуба — min-width 100%, могут расширяться для скролла */
    .club-content .content-table {
        width: auto;
        min-width: 100%;
    }
}
