/* ═══════════════════════════════════════
   Друзья: список с онлайн-статусом, заявки в обе стороны и поиск игроков
   ═══════════════════════════════════════ */

/*
 * Своих цветов, отступов и радиусов файл не заводит — только переменные из
 * global.css, поэтому переключатель светлой и тёмной темы работает без единой
 * правки здесь.
 */
.friends {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg) var(--space-3xl);
}

.friends__header {
    margin-bottom: var(--space-2xl);
}

.friends__title {
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.friends__subtitle {
    max-width: 560px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.friends__section {
    margin-bottom: var(--space-3xl);
}

.friends__section-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
}

/* Переключатель направления заявок */
.friends__tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.friends__tab {
    display: inline-flex;
    gap: var(--space-xs);
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--font-md);
    color: var(--text-secondary);
    cursor: pointer;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.friends__tab:hover {
    background: var(--bg-hover);
}

.friends__tab--active {
    color: var(--text-on-accent);
    background: var(--accent);
    border-color: var(--accent);
}

.friends__tab--active:hover {
    background: var(--accent-hover);
}

/* Счётчик пустой строкой не рисуется: JS кладёт в него '' при нуле заявок. */
.friends__counter:empty {
    display: none;
}

.friends__counter {
    min-width: 20px;
    padding: 0 var(--space-xs);
    font-size: var(--font-xs);
    font-weight: 700;
    text-align: center;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
}

.friends__tab--active .friends__counter {
    color: var(--accent);
}

/* Списки и строки */
.friends__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    list-style: none;
}

.friends__row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.friends__player {
    display: flex;
    flex: 1 1 200px;
    gap: var(--space-md);
    align-items: center;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.friends__avatar {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    overflow: hidden;
    font-weight: 700;
    color: var(--text-on-accent);
    background: var(--accent);
    border-radius: var(--radius-full);
}

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

.friends__name {
    overflow: hidden;
    font-weight: 600;
    color: var(--text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/*
 * Статус: кружок и подпись. Цвет — единственное, чем различаются онлайн и
 * офлайн: форма одна, чтобы взгляд ловил разницу без чтения.
 */
.friends__status {
    display: inline-flex;
    gap: var(--space-xs);
    align-items: center;
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.friends__status--online::before,
.friends__status--offline::before {
    width: 8px;
    height: 8px;
    content: '';
    border-radius: var(--radius-full);
}

.friends__status--online::before {
    background: var(--success);
}

.friends__status--offline::before {
    background: var(--rarity-common);
}

.friends__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.friends__btn {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-sm);
}

.friends__search {
    width: 100%;
    max-width: 420px;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-lg);
    font-size: var(--font-md);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
}

.friends__search:focus {
    border-color: var(--accent);
    outline: none;
}

@media (max-width: 600px) {
    .friends__row {
        align-items: flex-start;
    }

    .friends__actions {
        width: 100%;
    }
}
