/* ── Friends Page ────────────────────────────────────────────────────────── */

.friends-page {
    padding: 16px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */

.friends-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--bg-tertiary, #2c2f33);
    margin-bottom: 16px;
    flex-shrink: 0;
}

.friends-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted, #72767d);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

.friends-tab:hover {
    color: var(--text-primary, #dcddde);
}

.friends-tab.active {
    color: var(--text-primary, #dcddde);
    border-bottom-color: var(--accent, #5865f2);
}

/* ── Content area ────────────────────────────────────────────────────────── */

.friends-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ── Section titles (Pending) ────────────────────────────────────────────── */

.friends-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #72767d);
    margin: 16px 0 8px;
    padding: 0 2px;
}

.friends-section-title:first-child {
    margin-top: 0;
}

/* ── Friend list & rows ──────────────────────────────────────────────────── */

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.friend-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.1s;
}

.friend-row:hover {
    background: var(--bg-secondary, #2c2f33);
}

.friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary, #40444b);
    color: var(--text-primary, #dcddde);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.friend-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.friend-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #dcddde);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

/* Icon-only action buttons — выровнено по стилю проекта (servers-sidebar, etc.) */
.friend-action-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--bg-tertiary, #2c2f33);
    color: var(--text-primary, #dcddde);
    cursor: pointer;
    padding: 0;
    transition: background 0.12s, color 0.12s, transform 0.08s;
}

.friend-action-btn:hover {
    background: var(--bg-modifier-hover, #3a3d42);
    color: var(--text-bright, #fff);
}

.friend-action-btn:active {
    transform: scale(0.94);
}

.friend-action-btn:focus-visible {
    outline: 2px solid var(--accent, #5865f2);
    outline-offset: 2px;
}

/* Семантические варианты — accept/decline */
.friend-action-btn-accept {
    background: var(--accent, #5865f2);
    color: #fff;
}
.friend-action-btn-accept:hover {
    background: var(--accent-hover, #4752c4);
    color: #fff;
}

.friend-action-btn-decline {
    background: var(--bg-tertiary, #2c2f33);
    color: var(--text-muted, #b9bbbe);
}
.friend-action-btn-decline:hover {
    background: var(--danger, #ed4245);
    color: #fff;
}

/* ── Add Friend ──────────────────────────────────────────────────────────── */

.friends-add {
    max-width: 480px;
    padding: 16px 0;
}

.friends-add-hint {
    font-size: 13px;
    color: var(--text-muted, #72767d);
    margin-bottom: 12px;
}

.friends-add-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.friends-add-input {
    flex: 1;
    background: var(--bg-secondary, #2c2f33);
    border: 1px solid var(--bg-tertiary, #40444b);
    border-radius: 6px;
    color: var(--text-primary, #dcddde);
    font-size: 14px;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.15s;
}

.friends-add-input:focus {
    border-color: var(--accent, #5865f2);
}

.friends-add-error {
    margin-top: 8px;
    font-size: 13px;
    color: var(--danger, #ed4245);
}

/* ── Empty / loading states ──────────────────────────────────────────────── */

.friends-loading,
.friends-error {
    padding: 32px;
    text-align: center;
    color: var(--text-muted, #72767d);
    font-size: 14px;
}

.empty-state {
    padding: 48px 32px;
    text-align: center;
    color: var(--text-muted, #72767d);
    font-size: 14px;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .friends-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }

    .friends-tabs::-webkit-scrollbar {
        display: none;
    }

    .friends-tab {
        flex: 0 0 auto;
    }

    .friends-add-row {
        flex-direction: column;
    }

    .friends-add-input,
    .friends-add-submit {
        width: 100%;
    }
}
