/* --- Sidebar Friends Button --- */
.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem 1rem;
}

.sidebar-action-btn {
    width: 100%;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, transform 0.2s;
}

.sidebar-action-btn:hover {
    background: var(--bg-panel-hover);
    transform: translateX(4px);
}

/* --- Friends / Chat Full Page --- */
#friends-chat-view {
    background: #182536;
    color: #dbe8f5;
}

#friends-chat-view.active {
    display: flex;
}

.friends-chat-page {
    display: flex;
    width: 100%;
    height: 100vh;
    background: linear-gradient(180deg, #1b2a3d, #101722);
}

.friends-chat-sidebar {
    width: 320px;
    height: 100vh;
    background: #1a2430;
    border-right: 1px solid #2d3a4a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.friends-chat-user {
    position: relative;
    padding: 14px;
    background: linear-gradient(180deg, #223246, #1b2735);
    border-bottom: 1px solid #2d3a4a;
}

.friends-back-btn {
    background: transparent;
    color: #9fb4c9;
    border: none;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 12px;
}

.friends-back-btn:hover {
    color: #ffffff;
}

.friends-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.friends-avatar,
.web-friend-avatar {
    width: 42px;
    height: 42px;
    border: 2px solid #3b82f6;
    background: #304256;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.friends-user-info {
    min-width: 0;
}

.friends-current-name {
    color: #67c5f5;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friends-status-button {
    background: transparent;
    border: none;
    color: #22c58b;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 0;
}

.friends-status-button.status-away {
    color: #facc15;
}

.friends-status-button.status-dnd {
    color: #f87171;
}

.friends-status-button.status-offline {
    color: #94a3b8;
}

.friends-status-menu {
    display: none;
    position: absolute;
    left: 58px;
    top: 86px;
    z-index: 30;
    background: #263342;
    border: 1px solid #405166;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    min-width: 190px;
    padding: 6px;
}

.friends-status-menu.active {
    display: block;
}

.friends-status-menu button {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    color: #dbe8f5;
    padding: 9px 10px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
}

.friends-status-menu button:hover {
    background: #34465a;
}

.friends-panel-band {
    height: 34px;
    background: #4b5563;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #dbe8f5;
    font-weight: 800;
    padding: 0 12px;
}

.friends-panel-band button {
    width: 26px;
    height: 26px;
    border: 1px solid #94a3b8;
    background: #5b6674;
    color: white;
    cursor: pointer;
    font-weight: 900;
}

.friends-search-wrap {
    padding: 10px 12px;
}

.friends-search-wrap input {
    width: 100%;
    background: #eef4f8;
    color: #111827;
    border: none;
    padding: 9px 10px;
    outline: none;
}

.friends-section {
    padding: 4px 12px 10px;
}

.friends-section h3 {
    font-size: 0.95rem;
    color: #e5edf6;
    margin: 10px 0 8px;
}

.web-friend-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.web-friend-row,
.web-request-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 4px;
    cursor: pointer;
    border-radius: 4px;
    position: relative;
}

.web-friend-row:hover,
.web-request-row:hover,
.web-friend-row.active {
    background: rgba(255,255,255,0.06);
}

.web-friend-text {
    min-width: 0;
    flex: 1;
}

.web-friend-name {
    font-weight: 800;
    color: #76c8f5;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.web-friend-status {
    font-size: 0.82rem;
    line-height: 1.15;
}

.status-online {
    color: #8ee35d;
}

.status-away {
    color: #facc15;
}

.status-dnd {
    color: #f87171;
}

.status-offline {
    color: #64748b;
}

.web-friend-status.invite {
    color: #facc15;
}

.web-friend-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.web-friend-row:hover .web-friend-actions {
    opacity: 1;
}

.friend-menu-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
}

.web-request-actions {
    display: flex;
    gap: 4px;
}

.web-request-actions button {
    width: 26px;
    height: 26px;
    border: none;
    color: white;
    font-weight: 800;
    cursor: pointer;
}

.web-request-actions .accept {
    background: #10b981;
}

.web-request-actions .decline {
    background: #ef4444;
}

.web-empty-row {
    color: #64748b;
    font-size: 0.95rem;
    padding: 4px 0 10px;
}

.friends-chat-main {
    flex: 1;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #161b22;
}

.chat-empty-state {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #94a3b8;
    text-align: center;
}

.chat-empty-state h2 {
    color: white;
    margin-bottom: 8px;
}

.web-chat-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.web-chat-header {
    min-height: 70px;
    background: #202b3a;
    border-bottom: 1px solid #2d3a4a;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.web-chat-header h2 {
    color: white;
    font-size: 1.15rem;
    margin-bottom: 2px;
}

.web-chat-status {
    font-size: 0.9rem;
    font-weight: 700;
}

.web-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 38px;
    background: linear-gradient(180deg, #171b21, #15191f);
}

.web-chat-messages::-webkit-scrollbar {
    width: 10px;
}
.web-chat-messages::-webkit-scrollbar-track {
    background: #111827;
}
.web-chat-messages::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 5px;
}

.web-chat-sender {
    font-weight: 800;
    margin-bottom: 4px;
}

.web-chat-sender.mine {
    color: #8cc9ff;
}

.web-chat-sender.friend {
    color: #c5f59b;
}

.web-chat-line {
    color: #d4d7dd;
    font-size: 1rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.web-chat-gap {
    height: 18px;
}

.web-chat-input-row {
    height: 76px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #202b3a;
    border-top: 1px solid #2d3a4a;
    padding: 12px;
    position: relative;
}

.web-chat-input-row input {
    flex: 1;
    height: 46px;
    background: #101720;
    border: 1px solid #2d3a4a;
    color: white;
    padding: 0 12px;
    outline: none;
    font-size: 1rem;
}

.web-chat-input-row button {
    height: 46px;
    background: #33465c;
    color: white;
    border: 1px solid #718096;
    padding: 0 18px;
    cursor: pointer;
    font-weight: 800;
}

.web-chat-input-row button:hover {
    background: #3b5774;
}

.web-sound-menu {
    display: none;
    position: absolute;
    right: 92px;
    bottom: 64px;
    background: #263342;
    border: 1px solid #405166;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    width: 180px;
    padding: 6px;
    z-index: 40;
}

.web-sound-menu.active {
    display: block;
}

.web-sound-menu button {
    width: 100%;
    height: auto;
    display: block;
    padding: 8px 10px;
    background: transparent;
    border: none;
    color: #dbe8f5;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
}

.web-sound-menu button:hover {
    background: #34465a;
}

.web-friend-action-menu {
    position: fixed;
    z-index: 9999;
    background: #263342;
    border: 1px solid #405166;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    width: 150px;
    padding: 6px;
}

.web-friend-action-menu button {
    width: 100%;
    background: transparent;
    border: none;
    color: #dbe8f5;
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
}

.web-friend-action-menu button:hover {
    background: #34465a;
}

/* --- Add Friend Modal --- */
.web-friends-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.web-friends-modal.active {
    display: flex;
}

.web-friends-modal-card {
    width: 360px;
    background: #192433;
    border: 1px solid #405166;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    padding: 20px;
    border-radius: 10px;
}

.web-friends-modal-card h3 {
    margin-bottom: 12px;
}

.web-friends-modal-card input {
    width: 100%;
    background: #101720;
    border: 1px solid #405166;
    color: white;
    padding: 11px 12px;
    outline: none;
}

.web-friends-error {
    color: #ff6b6b;
    font-size: 0.9rem;
    min-height: 22px;
    margin-top: 8px;
}

.web-friends-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

.web-friends-modal-actions button {
    background: #33465c;
    color: white;
    border: 1px solid #718096;
    padding: 9px 16px;
    cursor: pointer;
    font-weight: 800;
}

.web-friends-modal-actions button:hover {
    background: #3b5774;
}

@media (max-width: 900px) {
    .friends-chat-page {
        flex-direction: column;
    }

    .friends-chat-sidebar {
        width: 100%;
        height: 45vh;
    }

    .friends-chat-main {
        height: 55vh;
    }
}

/* --- Friends unread badge --- */
.friends-chat-nav-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.friends-unread-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
}

.friends-unread-badge.hidden {
    display: none;
}
