/**
 * Teams CSS - Стили для страниц команд
 * /real/teams.php (каталог) и /real/team.php (профиль)
 *
 * Hero и stat-inline стили наследуются из championship.css (team.php подключает оба)
 */

/* ========================================================================
   Карточки команд в каталоге (teams.php)
   ======================================================================== */

.team-card-item {
    position: relative;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
}

.team-card-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.team-card-item.team-selected {
    border-color: #f0ad4e !important;
    box-shadow: 0 0 0 2px rgba(240, 173, 78, 0.18), 0 4px 15px rgba(0, 0, 0, 0.08);
}

.team-card-item h6 {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
}

.team-card-item h6 a:hover {
    color: #007bff !important;
}

.team-card-admin-check {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    z-index: 3;
}

.team-card-admin-check .form-check-input {
    cursor: pointer;
}

.teams-table-view th,
.teams-table-view td {
    white-space: nowrap;
}

.teams-table-view table {
    min-width: 920px;
}

.team-selected-row td {
    background: rgba(240, 173, 78, 0.1);
}

.team-merge-checkbox {
    cursor: pointer;
}

/* Эмблемы чемпионатов */
.championship-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    min-height: 24px;
    align-items: center;
}

.team-stats-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.team-activity-period {
    line-height: 1.2;
}

.team-stats-inline small {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.18rem 0.45rem;
    border-radius: 0.45rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
    line-height: 1.15;
    font-size: 0.72rem;
    font-weight: 600;
}

[data-bs-theme="dark"] .team-stats-inline small {
    background: rgba(255, 255, 255, 0.08);
}

/* ========================================================================
   Фильтры и аналитика пилотов (team.php)
   ======================================================================== */

.top-pilots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.875rem;
}

.top-pilot-card {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 10px;
    padding: 0.875rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.top-pilot-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.top-pilot-rank {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #212529;
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.top-pilot-name {
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}

.top-pilot-name:hover {
    color: #007bff;
}

.top-pilot-meta {
    color: var(--bs-secondary, #6c757d);
    font-size: 0.813rem;
}

.top-pilot-stats {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.625rem;
    font-size: 0.813rem;
}

.top-pilot-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    min-height: 24px;
}

.pilots-table-wrap {
    max-width: 100%;
}

.pilots-table-wrap table {
    min-width: 860px;
}

.pilots-table-wrap th,
.pilots-table-wrap td {
    white-space: nowrap;
}

.pilots-table-wrap th:first-child,
.pilots-table-wrap td:first-child {
    position: sticky;
    left: 0;
    background: var(--bs-body-bg, #fff);
    z-index: 1;
}

.pilots-table-wrap thead th:first-child {
    z-index: 2;
}

.pilot-name-cell {
    min-width: 180px;
}

/* ========================================================================
   Пилоты и автомобили (legacy + cars)
   ======================================================================== */

.pilots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.pilot-card {
    padding: 1rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pilot-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pilot-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.pilot-card h4 a {
    color: inherit;
    text-decoration: none;
}

.pilot-card h4 a:hover {
    color: #007bff;
}

.pilot-card .pilot-championships {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 0.5rem;
}

.pilot-card .pilot-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.813rem;
    color: var(--bs-secondary, #6c757d);
}

.pilot-card .pilot-stats span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.car-card {
    padding: 1rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.car-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.car-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.car-card h4 a {
    color: inherit;
    text-decoration: none;
}

.car-card h4 a:hover {
    color: #007bff;
}

.car-card .car-year {
    font-size: 0.813rem;
    color: var(--bs-secondary, #6c757d);
    margin-bottom: 0.5rem;
}

.car-card .car-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    font-size: 0.813rem;
}

.car-card .car-stats span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ========================================================================
   Позиция badge
   ======================================================================== */

.position-badge {
    display: inline-block;
    min-width: 35px;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
}

.position-badge.position-1 {
    background: #ffd700;
    color: #000;
}

.position-badge.position-2 {
    background: #c0c0c0;
    color: #000;
}

.position-badge.position-3 {
    background: #cd7f32;
    color: #fff;
}

/* ========================================================================
   Пустое состояние
   ======================================================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--bs-secondary, #6c757d);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* ========================================================================
   Responsive
   ======================================================================== */

@media (max-width: 991.98px) {
    .top-pilots-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    .pilots-grid,
    .cars-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 767.98px) {
    .team-card-item h6 {
        font-size: 0.85rem;
    }

    .team-stats-inline small {
        font-size: 0.68rem;
        padding: 0.15rem 0.4rem;
    }

    .pilots-grid,
    .cars-grid {
        grid-template-columns: 1fr;
    }

    .top-pilot-stats {
        flex-wrap: wrap;
    }
}

@media (max-width: 575.98px) {
    .team-card-item .card-body {
        padding: 0.45rem !important;
    }

    .team-card-admin-check {
        top: 0.35rem;
        right: 0.35rem;
    }

    .team-card-item h6 {
        font-size: 0.78rem;
        line-height: 1.1;
    }

    .team-stats-inline small {
        font-size: 0.64rem;
    }
}
