﻿/* assumes your global :root + base styles are already loaded */
/* строка панели */
.header-row {
    display: flex;
    align-items: center; /* на уровне текста */
    gap: 12px;
    flex-wrap: wrap;
}

    /* чтобы текст занимал место, а кнопка не уезжала вниз */
    .header-row > div {
        flex: 1 1 auto;
        min-width: 260px;
        /* ВАЖНО: во 2-й ветке form внутри этого div,
     поэтому делаем его flex-контейнером */
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .header-row .muted {
        margin: 0;
    }

    /* форма-кнопка */
    .header-row form.filter-form {
        margin: 0;
        padding: 0;
        display: flex;
        align-items: center;
    }


.muted {
    color: var(--muted);
}

.strong {
    font-weight: 700;
}

.header-actions {
    margin: 0;
    padding: 0;
}

    .header-actions button {
        margin: 0;
    }


.filter-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.col-action .filter-form {
    margin-left: 6px;
    flex-wrap: wrap;
    gap: 6px;
}

.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-weight: 600;
    opacity: .95;
}

    .chip:hover {
        filter: brightness(0.98);
        text-decoration: none;
    }

    .chip.active {
        border-color: rgba(95,143,76,.45);
        background: rgba(95,143,76,0.10);
        color: var(--badge-progress-fg);
    }

.empty {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: #fafbff;
}

/* -------- Table -------- */
.teams-table {
    margin-top: 12px;
    overflow-x: auto;
    overflow-y: visible;
}

.teams-table .grid {
    overflow: visible;
    position: relative;
    z-index: 1;
}

.teams-table .grid thead {
    position: relative;
    z-index: 1;
}

.teams-table .grid tbody {
    position: relative;
    z-index: 2;
}

.grid th, .grid td {
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
    text-align: left;
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: anywhere;
    overflow: visible;
    position: relative;
}

.grid thead th {
    background: #fafbff;
    font-weight: 800;
}

.teams-table .cell-two-line {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    white-space: normal;
    line-height: 1.2;
    max-height: calc(1.2em * 2);
    overflow-wrap: anywhere;
}

.col-team {
    width: 25%;
}

.col-org {
    width: 20%;
}

.col-coach {
    width: 20%;
}

.col-status {
    width: 15%;
    text-align: left;
}

.col-action {
    width: 14rem;
    min-width: 10rem;
    text-align: right;
    position: relative;
    z-index: 2;
}

.col-action .icon-btn,
.col-action button {
    white-space: nowrap;
}

/* tooltips are rendered in a fixed layer via JS to avoid table overlap */
.icon-btn[data-tooltip]::after,
.icon-btn[data-tooltip]::before {
    content: none;
}

/* -------- Badges -------- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
    border: 1px solid transparent;
    white-space: nowrap;
}

    .badge.ok {
        background: var(--badge-progress-bg);
        color: var(--badge-progress-fg);
        border-color: var(--badge-progress-br);
    }

    .badge.wait {
        background: var(--badge-created-bg);
        color: var(--badge-created-fg);
        border-color: var(--line);
    }

.badge.dq {
    background: #ffe3e3;
    color: #b00020;
    border-color: #f3b5b5;
}

/* -------- Tooltip layer -------- */
.teams-tooltip {
    position: fixed;
    z-index: 9999;
    background: #1f2937;
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 6px 16px rgba(0,0,0,.18);
}

/* -------- Cards (mobile) -------- */
.teams-cards {
    display: none;
    margin-top: 12px;
    gap: 10px;
}

.team-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}

.team-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.team-card-title {
    font-size: 16px;
    font-weight: 900;
    line-height: 1.2;
}

.team-card-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    padding: 6px 0;
    border-top: 1px dashed rgba(230,232,239,.9);
}

    .team-card-row .label {
        color: var(--muted);
        font-weight: 700;
    }

    .team-card-row .value {
        font-weight: 600;
    }

/* -------- Responsive переключение: table -> cards -------- */
@media (max-width: 820px) {
    .teams-table {
        display: none;
    }

    .teams-cards {
        display: grid;
    }

    .team-card-row {
        grid-template-columns: 110px 1fr;
    }
}

@media (max-width: 420px) {
    .filter-form label {
        display: none;
    }

    .team-card-row {
        grid-template-columns: 1fr;
    }

        .team-card-row .label {
            margin-bottom: 2px;
        }
}

.team-edit-form {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 10px 14px;
    max-width: 720px;
    margin: 0 auto;
    align-items: center;
}

.team-edit-form .field-label {
    text-align: right;
    font-weight: 700;
    justify-self: end;
}

.team-edit-form input[type="text"],
.team-edit-form input[type="number"],
.team-edit-form input:not([type]) {
    width: 100%;
    box-sizing: border-box;
    justify-self: start;
}

.team-edit-form .field-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.team-edit-form .form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 4px;
}
