/* ============================================================
   SOCIAL PAGE STYLES
   ============================================================ */

#social-page {
    padding: 20px;
    max-width: 940px;
    margin: 0 auto;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: calc(100vh - var(--header-h, 52px));
}

.social-page-header {
    margin-bottom: 24px;
}

.social-page-header h2 {
    font-size: 2rem;
    color: #333;
    margin: 10px 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================================
   TAB NAVIGATION (using settings-tab style)
   ============================================================ */

/* Social page uses settings-tabs styling - just add badge support */
.social-settings-tabs {
    margin-bottom: 24px;
}

/* Inbox sub-tabs - compact size with distinct teal color */
.inbox-subtabs {
    margin-top: 0;
    margin-bottom: 20px;
    padding: 6px 8px;
    background: #f0f7f7;
    border-radius: 8px;
    border: 1px solid #d0e5e5;
    gap: 6px;
}

.inbox-subtabs .settings-tab {
    padding: 5px 10px;
    font-size: 0.75rem;
    min-height: auto;
    background: linear-gradient(180deg, #ffffff 0%, #f5fafa 100%);
    border-color: #c5dede;
}

.inbox-subtabs .settings-tab:hover {
    background: linear-gradient(180deg, #e8f4f4 0%, #d8ecec 100%);
    border-color: #20a090;
}

.inbox-subtabs .settings-tab.active {
    background: linear-gradient(135deg, #20a090, #1abc9c);
    border-color: #18877a;
    color: white;
}

.inbox-subtabs .settings-tab .tab-icon {
    font-size: 0.8rem;
}

.inbox-subtabs .settings-tab .tab-label {
    font-size: 0.7rem;
}

.inbox-subtabs .tab-badge {
    top: -3px;
    right: -3px;
    font-size: 0.6rem;
    padding: 1px 4px;
    min-width: 14px;
}

/* Dark mode for inbox sub-tabs */
body.dark-mode .inbox-subtabs {
    background: #1a2a2a;
    border-color: #2a4040;
}

body.dark-mode .inbox-subtabs .settings-tab {
    background: linear-gradient(180deg, #253535 0%, #1f2f2f 100%);
    border-color: #3a5050;
    color: #bbb;
}

body.dark-mode .inbox-subtabs .settings-tab:hover {
    background: linear-gradient(180deg, #2a4040 0%, #254545 100%);
    border-color: #20a090;
}

body.dark-mode .inbox-subtabs .settings-tab.active {
    background: linear-gradient(135deg, #20a090, #1abc9c);
    border-color: #18877a;
    color: white;
}

.social-settings-tabs .settings-tab,
.inbox-subtabs .settings-tab {
    position: relative;
}

.social-settings-tabs .tab-badge,
.inbox-subtabs .tab-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #e74c3c;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.inbox-subtabs .tab-folder-count {
    display: block;
    font-size: 0.6rem;
    font-weight: 500;
    opacity: 0.7;
    margin-top: 1px;
    line-height: 1;
}

.inbox-subtabs .settings-tab.active .tab-folder-count {
    opacity: 0.9;
}

.inbox-subtabs .tab-folder-count.near-limit {
    color: #e67e22;
    opacity: 1;
    font-weight: 700;
}

.inbox-subtabs .tab-folder-count.at-limit {
    color: #e74c3c;
    opacity: 1;
    font-weight: 700;
}

.inbox-subtabs .settings-tab.active .tab-folder-count.near-limit {
    color: #ffd700;
}

.inbox-subtabs .settings-tab.active .tab-folder-count.at-limit {
    color: #ff6b6b;
}

/* ============================================================
   TAB CONTENT
   ============================================================ */

.social-content-wrapper {
    display: block;
}

.social-tab-content {
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.social-tab-content.active {
    display: block;
    width: 100%;
    box-sizing: border-box;
    animation: socialFadeIn 0.3s ease-in;
}

@keyframes socialFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================================
   SOCIAL CARDS
   ============================================================ */

.social-card {
    background: #ffffff;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.social-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.social-card-header {
    background: linear-gradient(135deg, #f5f5f5, #e9edf3);
    padding: 14px 20px;
    border-bottom: 2px solid #e0e0e0;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.social-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

.social-card-body {
    padding: 20px;
}

/* Header badges */
.header-badge {
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 5px;
    border-radius: 17px;
}

.header-badge-muted {
    background: var(--brand-blue, #18a2ee);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
}

/* ============================================================
   ADD FRIEND FORM
   ============================================================ */

.add-friend-form {
    display: flex;
    gap: 10px;
}

.add-friend-form .input-field {
    flex: 1;
}

.add-friend-form .btnunified {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-friend-form .btnunified svg {
    width: 18px;
    height: 18px;
}

/* ============================================================
   SEARCH RESULTS
   ============================================================ */

.friend-search-results {
    margin-top: 16px;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9f9f9;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.search-result-item:hover {
    background: #f0f4f8;
}

.search-result-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e0e0;
    overflow: hidden;
}

.search-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-name {
    font-weight: 600;
    color: #333;
}

.search-result-status {
    font-size: 0.85rem;
    color: #888;
    margin-top: 2px;
}

.search-result-actions {
    display: flex;
    gap: 8px;
}

/* ============================================================
   FRIEND REQUESTS LIST
   ============================================================ */

.friend-requests-list,
.friends-list,
.blocked-users-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.friend-request-item,
.friend-item,
.blocked-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px;
    background: #f9f9f9;
    border-radius: 10px;
    transition: all 0.2s;
}

.friend-request-item:hover,
.friend-item:hover,
.blocked-user-item:hover {
    background: #f0f4f8;
}

.friend-request-item.sent {
    background: #fff8e6;
    border: 1px solid #ffe4a0;
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.friend-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e0e0e0;
    overflow: hidden;
    flex-shrink: 0;
}

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

.friend-details {
    display: flex;
    flex-direction: column;
}

.friend-name {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.friend-status {
    font-size: 0.85rem;
    color: #888;
    margin-top: 2px;
}

.friend-status.online {
    color: #27ae60;
}

.friend-status.offline {
    color: #95a5a6;
}

.request-type {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

.request-message {
    display: block;
    font-size: 0.8rem;
    color: #555;
    font-style: italic;
    margin-top: 2px;
    line-height: 1.3;
    word-break: break-word;
}

body.dark-mode .request-message {
    color: #aaa;
}

.friend-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.friend-actions .btnunified {
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Action buttons with icons */
.btn-icon {
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Show text labels on buttons */
.btn-icon .btn-label {
    display: inline;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-icon.btn-accept {
    background: #27ae60;
    color: white;
}

.btn-icon.btn-accept:hover {
    background: #219653;
}

.btn-icon.btn-decline {
    background: #e74c3c;
    color: white;
}

.btn-icon.btn-decline:hover {
    background: #c0392b;
}

.btn-icon.btn-block {
    background: #95a5a6;
    color: white;
}

.btn-icon.btn-block:hover {
    background: #7f8c8d;
}

.btn-icon.btn-profile {
    background: #1abc9c;
    color: white;
}

.btn-icon.btn-profile:hover {
    background: #16a085;
}

.btn-icon.btn-message {
    background: #3498db;
    color: white;
}

.btn-icon.btn-message:hover {
    background: #2980b9;
}

.btn-icon.btn-remove {
    background: #95a5a6;
    color: white;
}

.btn-icon.btn-remove:hover {
    background: #7f8c8d;
}

.btn-icon.btn-block {
    background: #e74c3c;
    color: white;
}

.btn-icon.btn-block:hover {
    background: #c0392b;
}

.btn-icon.btn-unblock {
    background: #27ae60;
    color: white;
}

.btn-icon.btn-unblock:hover {
    background: #219653;
}

/* Invite block toggle button */
.btn-icon.btn-invite-block {
    background: #9b59b6;
    color: white;
}

.btn-icon.btn-invite-block:hover {
    background: #8e44ad;
}

.btn-icon.btn-invite-block.blocked {
    background: #7f8c8d;
    color: white;
}

.btn-icon.btn-invite-block.blocked:hover {
    background: #6c7a7d;
}

.btn-icon.btn-invite-block.disabled {
    background: #bdc3c7;
    color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-icon.btn-invite-block.disabled:hover {
    background: #bdc3c7;
}

/* Three-dot menu button */
.btn-icon.btn-more {
    background: #95a5a6;
    color: white;
    padding: 8px;
    min-width: auto;
}

.btn-icon.btn-more:hover {
    background: #7f8c8d;
}

/* Friend menu wrapper - contains button and dropdown */
.friend-menu-wrapper {
    position: relative;
}

/* Dropdown menu — opens upward to avoid clipping by parent overflow:hidden */
.friend-dropdown-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 4px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 140px;
    overflow: hidden;
}

.friend-dropdown-menu.show {
    display: block;
}

.friend-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
    color: #333;
    transition: background 0.15s;
}

.friend-dropdown-menu .dropdown-item:hover {
    background: #f5f5f5;
}

.friend-dropdown-menu .dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.friend-dropdown-menu .dropdown-item.btn-danger {
    color: #e74c3c;
}

.friend-dropdown-menu .dropdown-item.btn-danger:hover {
    background: #fdf2f2;
}

/* Dark mode for dropdown */
body.dark-mode .friend-dropdown-menu {
    background: #2a2a2a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .friend-dropdown-menu .dropdown-item {
    color: #e0e0e0;
}

body.dark-mode .friend-dropdown-menu .dropdown-item:hover {
    background: #3a3a3a;
}

body.dark-mode .friend-dropdown-menu .dropdown-item.btn-danger {
    color: #ff6b6b;
}

body.dark-mode .friend-dropdown-menu .dropdown-item.btn-danger:hover {
    background: #3a2a2a;
}

/* ============================================================
   COLLAPSIBLE SECTIONS
   ============================================================ */

.collapsible .collapsible-header {
    cursor: pointer;
    width: 100%;
    border: none;
    text-align: left;
    border-radius: 12px 0 0 0;
}

.collapsible .collapse-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s;
}

.collapsible .collapsible-header[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
}

/* ============================================================
   INBOX FOLDERS
   ============================================================ */

.inbox-folders {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.inbox-folder-btn {
    flex: 1;
    padding: 12px 16px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.inbox-folder-btn:hover {
    background: #eee;
    border-color: #ccc;
}

.inbox-folder-btn.active {
    background: #1487c6;
    color: white;
    border-color: #1487c6;
}

.inbox-folder-btn svg {
    width: 18px;
    height: 18px;
}

.folder-badge {
    background: #e74c3c;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ============================================================
   MESSAGES LIST
   ============================================================ */

.messages-list {
    max-height: 500px;
    overflow-y: auto;
}

.message-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.message-item:hover {
    background: #f9f9f9;
}

.message-item:last-child {
    border-bottom: none;
}

.message-item.unread {
    background: #f0f7ff;
}

.message-item.unread:hover {
    background: #e5f0fa;
}

.message-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e0e0e0;
    overflow: hidden;
    flex-shrink: 0;
}

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

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.message-sender {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.message-item.unread .message-sender {
    color: #1487c6;
}

.message-date {
    font-size: 0.8rem;
    color: #999;
}

.message-subject {
    font-weight: 500;
    color: #444;
    font-size: 0.9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-preview {
    font-size: 0.85rem;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-unread-dot {
    width: 10px;
    height: 10px;
    background: #1487c6;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

/* Loading state */
.messages-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: #888;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #1487c6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Load more button */
.load-more-btn {
    width: 100%;
    padding: 14px;
    background: #f5f5f5;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: background 0.2s;
}

.load-more-btn:hover {
    background: #eee;
}

/* ============================================================
   BULK ACTIONS BAR
   ============================================================ */

.bulk-actions-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f5f5f5, #e9edf3);
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.bulk-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #555;
}

.bulk-select-all input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#selected-count {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.bulk-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.bulk-btn {
    padding: 8px 14px !important;
    font-size: 0.85rem !important;
}

.bulk-btn i {
    width: 16px;
    height: 16px;
}

/* Message checkbox in list */
.message-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 6px;
}

.message-item.bulk-mode {
    cursor: default;
}

.message-item.bulk-mode:hover {
    background: inherit;
}

.message-item.selected {
    background: #e3f2fd !important;
    border-left: 3px solid #1487c6;
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

/* Ensure modals are hidden when is-hidden class is present */
.modal-overlay.is-hidden {
    display: none !important;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: linear-gradient(135deg, #f5f5f5, #e9edf3);
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 18px 24px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
}

.modal-footer .btnunified {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-footer .btnunified svg {
    width: 16px;
    height: 16px;
}

/* Form elements in modals */
.modal-body .form-group {
    margin-bottom: 18px;
}

.modal-body .form-group label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.modal-body .input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
    box-sizing: border-box;
}

.modal-body .input-field:focus {
    outline: none;
    border-color: #1487c6;
    box-shadow: 0 0 0 3px rgba(20, 135, 198, 0.1);
}

.modal-body .input-field:disabled {
    background-color: #f0f0f0;
    color: #666;
    cursor: not-allowed;
    border-color: #ccc;
}

.modal-body .textarea {
    resize: vertical;
    min-height: 120px;
}

.char-count {
    text-align: right;
    font-size: 0.85rem;
    color: #999;
    margin-top: 6px;
}

/* Inline Compose Form */
.compose-inline-body {
    padding: 20px !important;
}

.compose-inline-body .form-group {
    margin-bottom: 16px;
}

.compose-inline-body .form-group label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.compose-inline-body .input-field {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: #fff;
}

.compose-inline-body .input-field:focus {
    outline: none;
    border-color: #1487c6;
    box-shadow: 0 0 0 3px rgba(20, 135, 198, 0.1);
}

.compose-inline-body .input-field:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.compose-inline-body .textarea {
    resize: vertical;
    min-height: 120px;
}

.compose-inline-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}

body.dark-mode .compose-inline-body .form-group label {
    color: #ccc;
}

body.dark-mode .compose-inline-body .input-field {
    background: #2a2a2a;
    border-color: #444;
    color: #f0f0f0;
}

body.dark-mode .compose-inline-body .input-field:focus {
    border-color: #1487c6;
    box-shadow: 0 0 0 3px rgba(20, 135, 198, 0.2);
}

body.dark-mode .compose-inline-body .input-field:disabled {
    background: #1e1e1e;
}

/* Message modal specific */
.message-modal .message-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.message-modal #message-modal-from {
    font-weight: 600;
    color: #333;
}

.message-modal #message-modal-date {
    color: #888;
    font-size: 0.9rem;
}

.message-modal .message-body {
    font-size: 1rem;
    line-height: 1.6;
    color: #444;
    white-space: pre-wrap;
}

/* ============================================================
   DRAWER BADGE (for side menu notification)
   ============================================================ */

.drawer-badge {
    background: #e74c3c;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    text-align: center;
    color: #999;
    font-size: 0.95rem;
    padding: 20px;
}

/* .is-hidden utility class defined in lexilayers.css */

/* ============================================================
   BUTTON VARIANTS
   ============================================================ */

.btnunified-gray {
    background: linear-gradient(180deg, #f0f0f0, #e0e0e0);
    color: #666;
    border: 2px solid #ccc;
}

.btnunified-gray:hover {
    background: linear-gradient(180deg, #e8e8e8, #d8d8d8);
}

/* ============================================================
   DARK MODE SUPPORT
   ============================================================ */

body.dark-mode #social-page {
    background: transparent;
}

body.dark-mode .social-page-header h2 {
    color: #f0f0f0;
}

body.dark-mode .social-tab {
    background: linear-gradient(180deg, #2a2a2a 0%, #1f1f1f 100%);
    border-color: #444;
    color: #bbb;
}

body.dark-mode .social-tab:hover {
    background: linear-gradient(180deg, #333 0%, #2a2a2a 100%);
    border-color: #1487c6;
}

body.dark-mode .social-tab.active {
    background: linear-gradient(135deg, #1487c6, #18a2ee);
    color: #fff;
}

body.dark-mode .social-card {
    background: #1e1e1e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .social-card-header {
    background: linear-gradient(135deg, #2a2a2a, #222);
    border-bottom-color: #444;
}

body.dark-mode .social-card-header h3 {
    color: #f0f0f0;
}

body.dark-mode .friend-request-item,
body.dark-mode .friend-item,
body.dark-mode .blocked-user-item,
body.dark-mode .search-result-item {
    background: #2a2a2a;
}

body.dark-mode .friend-request-item:hover,
body.dark-mode .friend-item:hover,
body.dark-mode .blocked-user-item:hover,
body.dark-mode .search-result-item:hover {
    background: #333;
}

body.dark-mode .friend-name,
body.dark-mode .search-result-name {
    color: #f0f0f0;
}

body.dark-mode .request-type,
body.dark-mode .friend-status {
    color: #aaa;
}

body.dark-mode .friend-status.online {
    color: #2ecc71 !important;
}

body.dark-mode .inbox-folder-btn {
    background: #2a2a2a;
    border-color: #444;
    color: #bbb;
}

body.dark-mode .inbox-folder-btn:hover {
    background: #333;
}

body.dark-mode .inbox-folder-btn.active {
    background: #1487c6;
    color: white;
}

body.dark-mode .message-item {
    border-bottom-color: #333;
}

body.dark-mode .message-item:hover {
    background: #2a2a2a;
}

body.dark-mode .message-item.unread {
    background: #1a2a3a;
}

body.dark-mode .message-sender {
    color: #f0f0f0;
}

body.dark-mode .message-subject {
    color: #ddd;
}

body.dark-mode .modal-content {
    background: #1e1e1e;
}

body.dark-mode .modal-header {
    background: linear-gradient(135deg, #2a2a2a, #222);
    border-bottom-color: #444;
}

body.dark-mode .modal-header h3 {
    color: #f0f0f0;
}

body.dark-mode .modal-body {
    background: #1e1e1e;
}

body.dark-mode .modal-body .form-group label {
    color: #ccc;
}

body.dark-mode .modal-body .input-field {
    background: #2a2a2a;
    border-color: #444;
    color: #f0f0f0;
}

body.dark-mode .modal-body .input-field:focus {
    border-color: #1487c6;
}

body.dark-mode .modal-footer {
    background: #222;
    border-top-color: #444;
}

body.dark-mode .empty-state {
    color: #777;
}

body.dark-mode .bulk-actions-bar {
    background: linear-gradient(135deg, #2a2a2a, #222);
    border-color: #444;
}

body.dark-mode .bulk-select-all {
    color: #ccc;
}

body.dark-mode #selected-count {
    color: #999;
}

body.dark-mode .message-item.selected {
    background: #1a3a4a !important;
}

/* Dark mode: Message modal text colors */
body.dark-mode .message-modal #message-modal-from {
    color: #f0f0f0;
}

body.dark-mode .message-modal #message-modal-date {
    color: #aaa;
}

body.dark-mode .message-modal .message-body {
    color: #e0e0e0;
}

body.dark-mode .message-modal .message-header {
    border-bottom-color: #444;
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    #social-page {
        padding: 16px;
    }

    .social-page-header h2 {
        font-size: 1.6rem;
    }

    .social-tabs {
        gap: 8px;
    }

    .social-tab {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .social-tab .tab-icon-lucide {
        width: 18px;
        height: 18px;
    }

    .social-card-header {
        padding: 12px 16px;
    }

    .social-card-body {
        padding: 16px;
    }

    .friend-info {
        gap: 10px;
    }

    .friend-avatar {
        width: 40px;
        height: 40px;
    }

    .friend-name {
        font-size: 0.95rem;
    }

    .friend-actions {
        flex-wrap: wrap;
    }

    /* Make friend action buttons smaller on tablet */
    .btn-icon {
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .btn-icon svg {
        width: 14px;
        height: 14px;
    }

    .btn-icon .btn-label {
        font-size: 0.65rem;
    }

    .inbox-folders {
        flex-direction: column;
        gap: 8px;
    }

    .modal-content {
        max-height: 85vh;
        margin: 10px;
    }

    .modal-header,
    .modal-body {
        padding: 16px;
    }

    /* Fix message modal footer buttons on mobile */
    .modal-footer {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btnunified {
        flex: 1 1 auto;
        min-width: 70px;
        padding: 10px 8px;
        font-size: 0.8rem;
        justify-content: center;
    }

    .modal-footer .btnunified i {
        display: none;
    }
}

@media (max-width: 480px) {
    .social-tabs {
        flex-direction: column;
    }

    .social-tab {
        width: 100%;
        justify-content: flex-start;
    }

    .add-friend-form {
        flex-direction: column;
    }

    .add-friend-form .btnunified {
        width: 100%;
    }

    .friend-request-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .friend-actions {
        gap: 4px;
    }

    /* Compact friend action buttons on mobile */
    .btn-icon {
        padding: 6px;
    }

    .btn-icon svg {
        width: 16px;
        height: 16px;
    }
}

/* ============================================================
   GAME INVITE MODALS
   ============================================================ */

/* Game Invite Notification Modal */
.game-invite-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.game-invite-modal.show {
    opacity: 1;
    visibility: visible;
}

.game-invite-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: inviteSlideIn 0.3s ease;
}

@keyframes inviteSlideIn {
    from {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.game-invite-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.game-invite-icon {
    font-size: 32px;
}

.game-invite-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.game-invite-body {
    margin-bottom: 20px;
}

.game-invite-from {
    font-size: 1.1rem;
    margin: 0 0 12px 0;
    color: #333;
}

.game-invite-type {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px 0;
}

.game-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

.game-type-badge.versus {
    background: linear-gradient(135deg, #ef8b3a, #d97326);
}

.game-type-badge.elimination {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.game-type-badge.multiplayer {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.game-room-name {
    font-size: 0.9rem;
    color: #666;
}

.game-invite-message {
    font-style: italic;
    color: #666;
    margin: 8px 0;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
}

.game-invite-expires {
    font-size: 0.85rem;
    color: #888;
    margin: 0;
}

#invite-timer {
    font-weight: 600;
    color: #e74c3c;
}

/* Block invites checkbox in invite modal */
.invite-block-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    transition: background 0.2s;
}

.invite-block-option:hover {
    background: #eee;
}

.invite-block-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #e74c3c;
}

.game-invite-actions {
    display: flex;
    gap: 12px;
}

.btn-accept-invite,
.btn-decline-invite {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-accept-invite {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    color: white;
}

.btn-accept-invite:hover {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    transform: translateY(-2px);
}

.btn-decline-invite {
    background: #f1f1f1;
    color: #666;
}

.btn-decline-invite:hover {
    background: #e0e0e0;
}

/* Friend Invite Picker Modal */
.invite-friend-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.invite-friend-picker-modal.show {
    opacity: 1;
    visibility: visible;
}

.invite-picker-content {
    background: white;
    border-radius: 16px;
    max-width: 320px;
    width: 90%;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: inviteSlideIn 0.3s ease;
}

.invite-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.invite-picker-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.invite-picker-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.invite-picker-close:hover {
    color: #333;
}

.invite-picker-list {
    max-height: 50vh;
    overflow-y: auto;
    padding: 8px 0;
}

.invite-picker-friend {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.invite-picker-friend:hover {
    background: #f0f7ff;
}

.invite-picker-friend.online {
    background: #f0fff4;
}

.invite-picker-friend.online:hover {
    background: #e0f7e9;
}

.invite-picker-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.invite-picker-dot.online {
    background: #27ae60;
    box-shadow: 0 0 6px rgba(39, 174, 96, 0.5);
}

.invite-picker-dot.offline {
    background: #bdc3c7;
}

.friend-name {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.online-label {
    font-size: 0.75rem;
    color: #27ae60;
    font-weight: 500;
}

.recent-label {
    font-size: 0.65rem;
    color: #fff;
    background: #9b59b6;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.invite-picker-friend.recent {
    border-left: 3px solid #9b59b6;
}

/* Invite Button for Game Lobbies */
.btn-invite-friend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-invite-friend:hover {
    background: linear-gradient(135deg, #a569bd, #9b59b6);
    transform: translateY(-1px);
}

.btn-invite-friend i,
.btn-invite-friend svg {
    width: 18px;
    height: 18px;
}

/* Smaller invite button for in-game use */
.btn-invite-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    gap: 4px;
}

.btn-invite-small i,
.btn-invite-small svg {
    width: 14px;
    height: 14px;
}

/* In-game invite container */
.mp-ingame-invite {
    text-align: center;
    padding: 8px 0;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dark mode support */
body.dark-mode .game-invite-content,
body.dark-mode .invite-picker-content {
    background: var(--bg-secondary, #1e1e1e);
}

body.dark-mode .game-invite-header {
    border-bottom-color: var(--border-color, #333);
}

body.dark-mode .game-invite-header h3,
body.dark-mode .game-invite-from,
body.dark-mode .invite-picker-header h3,
body.dark-mode .friend-name {
    color: var(--text-primary, #fff);
}

body.dark-mode .game-invite-message {
    background: var(--bg-primary, #121212);
    color: var(--text-secondary, #aaa);
}

body.dark-mode .btn-decline-invite {
    background: var(--bg-primary, #121212);
    color: var(--text-secondary, #aaa);
}

body.dark-mode .btn-decline-invite:hover {
    background: var(--border-color, #333);
}

body.dark-mode .invite-block-option {
    background: var(--bg-primary, #121212);
    color: var(--text-secondary, #aaa);
}

body.dark-mode .invite-block-option:hover {
    background: var(--border-color, #333);
}

body.dark-mode .invite-picker-header {
    border-bottom-color: var(--border-color, #333);
}

body.dark-mode .invite-picker-friend:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .invite-picker-friend.online {
    background: rgba(39, 174, 96, 0.1);
}

body.dark-mode .invite-picker-friend.online:hover {
    background: rgba(39, 174, 96, 0.15);
}

/* ============================================================
   QUICK JOIN - Friend Game Status
   ============================================================ */

.friend-game-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
    margin-top: 2px;
}

.friend-game-status .game-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.friend-game-status.joinable {
    background: rgba(39, 174, 96, 0.15);
    color: #27ae60;
}

.friend-game-status.joinable .game-status-dot {
    background: #27ae60;
    box-shadow: 0 0 6px rgba(39, 174, 96, 0.5);
}

.friend-game-status.waiting {
    background: rgba(241, 196, 15, 0.15);
    color: #d4a80a;
}

.friend-game-status.waiting .game-status-dot {
    background: #f1c40f;
}

.friend-game-status.in-game {
    background: rgba(52, 152, 219, 0.15);
    color: #2980b9;
}

.friend-game-status.in-game .game-status-dot {
    background: #3498db;
}

/* Join game button styling */
.btn-join-game {
    background: linear-gradient(135deg, #27ae60, #1e8449) !important;
    color: white !important;
    border: none !important;
}

.btn-join-game:hover {
    background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
    transform: translateY(-1px);
}

.btn-join-game i,
.btn-join-game svg {
    stroke: white !important;
}

/* Dark mode */
body.dark-mode .friend-game-status.joinable {
    background: rgba(39, 174, 96, 0.2);
}

body.dark-mode .friend-game-status.waiting {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
}

body.dark-mode .friend-game-status.in-game {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

/* ============================================================
   PLAYER DROPDOWN (rank panels, game results)
   ============================================================ */

/* Clickable player names */
.player-name-clickable {
    cursor: pointer;
    transition: all 0.15s ease;
}

.player-name-clickable:hover {
    text-decoration: underline;
    opacity: 0.85;
}

/* Dropdown container */
.player-dropdown {
    position: fixed;
    z-index: 10000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    min-width: 160px;
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.15s ease;
    overflow: hidden;
}

.player-dropdown.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.player-dropdown-header {
    padding: 10px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.player-dropdown-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.player-dropdown-actions {
    padding: 6px;
}

.player-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #333;
    transition: background 0.15s ease;
}

.player-dropdown-btn:hover {
    background: #f0f0f0;
}

.player-dropdown-btn i,
.player-dropdown-btn svg {
    width: 18px;
    height: 18px;
    stroke: #666;
}

.player-dropdown-btn:hover i,
.player-dropdown-btn:hover svg {
    stroke: #333;
}

/* Mute button styling */
.player-dropdown-btn[data-action="toggle-mute"] {
    color: #e67e22;
}

.player-dropdown-btn[data-action="toggle-mute"] i,
.player-dropdown-btn[data-action="toggle-mute"] svg {
    stroke: #e67e22;
}

.player-dropdown-btn[data-action="toggle-mute"]:hover {
    background: #fef5ed;
}

.player-dropdown-btn[data-action="toggle-mute"].muted {
    color: #27ae60;
}

.player-dropdown-btn[data-action="toggle-mute"].muted i,
.player-dropdown-btn[data-action="toggle-mute"].muted svg {
    stroke: #27ae60;
}

.player-dropdown-btn[data-action="toggle-mute"].muted:hover {
    background: #e8f8f0;
}

.player-dropdown-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #27ae60;
    font-size: 0.85rem;
}

.player-dropdown-info i,
.player-dropdown-info svg {
    width: 18px;
    height: 18px;
    stroke: #27ae60;
}

/* Dark mode */
body.dark-mode .player-dropdown {
    background: #2a2a2a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

body.dark-mode .player-dropdown-btn {
    color: #e0e0e0;
}

body.dark-mode .player-dropdown-btn:hover {
    background: #3a3a3a;
}

body.dark-mode .player-dropdown-btn i,
body.dark-mode .player-dropdown-btn svg {
    stroke: #aaa;
}

body.dark-mode .player-dropdown-btn:hover i,
body.dark-mode .player-dropdown-btn:hover svg {
    stroke: #fff;
}

/* Dark mode mute button */
body.dark-mode .player-dropdown-btn[data-action="toggle-mute"] {
    color: #f39c12;
}

body.dark-mode .player-dropdown-btn[data-action="toggle-mute"] i,
body.dark-mode .player-dropdown-btn[data-action="toggle-mute"] svg {
    stroke: #f39c12;
}

body.dark-mode .player-dropdown-btn[data-action="toggle-mute"]:hover {
    background: #3d3020;
}

body.dark-mode .player-dropdown-btn[data-action="toggle-mute"].muted {
    color: #2ecc71;
}

body.dark-mode .player-dropdown-btn[data-action="toggle-mute"].muted i,
body.dark-mode .player-dropdown-btn[data-action="toggle-mute"].muted svg {
    stroke: #2ecc71;
}

body.dark-mode .player-dropdown-btn[data-action="toggle-mute"].muted:hover {
    background: #203d28;
}

/* ============================================================
   PLAYER PROFILE MODAL (compact view)
   ============================================================ */

.player-profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.player-profile-modal.show {
    opacity: 1;
}

.player-profile-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
}

.player-profile-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 290px;
    max-height: calc(100vh - 40px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    transform: translateX(20px);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.player-profile-modal.show .player-profile-content {
    transform: translateX(0);
}

/* Draggable header bar */
.player-profile-drag-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    user-select: none;
}

.player-profile-drag-header .drag-hint {
    opacity: 0.9;
}

.player-profile-close {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    padding: 0;
    border: none;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.15s ease;
    line-height: 1;
    flex-shrink: 0;
    box-sizing: border-box;
}

.player-profile-close:hover {
    background: rgba(255,255,255,0.3);
}

/* Scrollable body */
.player-profile-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.player-profile-header {
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.player-profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #667eea;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.player-profile-avatar svg {
    width: 100%;
    height: 100%;
}

.player-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-profile-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
}

.player-profile-avatar-placeholder i,
.player-profile-avatar-placeholder svg {
    width: 30px;
    height: 30px;
    stroke: white;
}

.player-profile-name {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.player-profile-bio {
    font-style: italic;
    color: #666;
    font-size: 0.75rem;
    margin: 4px 0 0;
}

.player-profile-member-since {
    font-size: 0.7rem;
    color: #999;
    margin: 2px 0 0;
}

/* Profile tabs */
.player-profile-tabs {
    display: flex;
    gap: 2px;
    background: #f0f0f0;
    border-radius: 6px;
    padding: 3px;
    margin-bottom: 8px;
}

.profile-tab {
    flex: 1;
    padding: 6px 8px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.15s ease;
}

.profile-tab:hover {
    color: #333;
    background: rgba(255, 255, 255, 0.5);
}

.profile-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Fixed height tab content */
.player-profile-tab-content {
    height: 340px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.profile-tab-pane {
    display: none;
}

.profile-tab-pane.active {
    display: block;
}

/* Sections container */
.player-profile-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-profile-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 10px;
}

.player-profile-section h4 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #667eea;
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-profile-section h4 i,
.player-profile-section h4 svg {
    width: 12px;
    height: 12px;
    stroke: #667eea;
}

.player-profile-info-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.player-profile-info-grid .info-row {
    display: flex;
    gap: 8px;
    font-size: 0.75rem;
    line-height: 1.4;
    padding: 8px 0;
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
}

.player-profile-info-grid .info-row:last-child {
    border-bottom: none;
}

.player-profile-info-grid .info-label {
    font-weight: 600;
    color: #667eea;
    flex-shrink: 0;
    min-width: 75px;
}

.player-profile-info-grid .info-value {
    color: #444;
    word-break: break-word;
}

.player-profile-info-grid .info-value-coins {
    color: #d4a017;
    font-weight: 600;
}

.player-profile-stats-grid {
    display: flex;
    justify-content: space-around;
    gap: 8px;
}

.player-profile-stats-grid .stat-item {
    text-align: center;
    flex: 1;
    padding: 10px 6px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    border-radius: 8px;
    border: 1px solid rgba(102, 126, 234, 0.15);
}

.player-profile-stats-grid .stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
    line-height: 1.2;
}

.player-profile-stats-grid .stat-label {
    font-size: 0.6rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.player-profile-stats-grid .stat-item.wide {
    flex: 1.5;
}

.player-profile-stats-grid .stat-item.wide .stat-value {
    font-size: 0.85rem;
}

/* Win rate donut chart */
.profile-donut-wrap {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 12px;
}

.profile-donut-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.profile-donut-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.profile-donut-pct {
    font-size: 1.15rem;
    font-weight: 800;
    color: #667eea;
    line-height: 1;
}

.profile-donut-sub {
    font-size: 0.55rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Mode label for stats */
.profile-stats-mode-label {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Rank badge */
.rank-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rank-badge.rank-unranked { background: #e0e0e0; color: #666; }
.rank-badge.rank-bronze { background: linear-gradient(135deg, #cd7f32, #a0522d); color: white; }
.rank-badge.rank-silver { background: linear-gradient(135deg, #c0c0c0, #a8a8a8); color: #333; }
.rank-badge.rank-gold { background: linear-gradient(135deg, #ffd700, #daa520); color: #333; }
.rank-badge.rank-platinum { background: linear-gradient(135deg, #e5e4e2, #b8b8b8); color: #333; }
.rank-badge.rank-diamond { background: linear-gradient(135deg, #b9f2ff, #00bfff); color: #333; }
.rank-badge.rank-master { background: linear-gradient(135deg, #9b59b6, #8e44ad); color: white; }
.rank-badge.rank-grandmaster { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; }

/* Actions at bottom */
.player-profile-actions {
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.player-profile-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.8rem;
}

.player-profile-friend-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: #e8f5e9;
    border-radius: 6px;
    color: #2e7d32;
    font-weight: 600;
    font-size: 0.8rem;
}

.player-profile-friend-status i,
.player-profile-friend-status svg {
    width: 16px;
    height: 16px;
    stroke: #2e7d32;
}

.player-profile-restricted {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #666;
    font-size: 0.8rem;
}

.player-profile-restricted i,
.player-profile-restricted svg {
    width: 16px;
    height: 16px;
    stroke: #999;
}

/* Loading state */
.player-profile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    gap: 10px;
    color: #666;
    font-size: 0.8rem;
}

.player-profile-loading .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Profile Badges Tab ─── */
.profile-badges-header {
    text-align: center;
    margin-bottom: 8px;
}

.profile-badges-count {
    font-size: 11px;
    color: #8A7E6B;
    letter-spacing: 0.5px;
}

/* Pinned badges showcase on profile — uses .badge-card styles from badges.css */
.profile-pinned-showcase {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 8px 0;
}

.profile-pinned-badge.badge-card {
    cursor: default;
}

.profile-pinned-badge.badge-card:hover {
    transform: translateY(-4px);
}

/* Dark mode for profile modal */
body.dark-mode .player-profile-content {
    background: #2a2a2a;
}

body.dark-mode .player-profile-drag-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

body.dark-mode .player-profile-body {
    background: #2a2a2a;
}

body.dark-mode .player-profile-header {
    border-bottom-color: #444;
}

body.dark-mode .player-profile-name {
    color: #e0e0e0;
}

body.dark-mode .player-profile-bio {
    color: #aaa;
}

body.dark-mode .player-profile-member-since {
    color: #777;
}

body.dark-mode .player-profile-section {
    background: #333;
}

body.dark-mode .player-profile-section h4 {
    color: #667eea;
}

body.dark-mode .player-profile-tabs {
    background: #333;
}

body.dark-mode .profile-tab {
    color: #aaa;
}

body.dark-mode .profile-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .profile-tab.active {
    background: #444;
    color: #667eea;
}

body.dark-mode .player-profile-info-grid .info-row {
    border-bottom-color: rgba(167, 139, 250, 0.2);
}

body.dark-mode .player-profile-info-grid .info-label {
    color: #a78bfa;
}

body.dark-mode .player-profile-info-grid .info-value {
    color: #ddd;
}

body.dark-mode .player-profile-stats-grid .stat-item {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.12), rgba(139, 92, 246, 0.08));
    border-color: rgba(167, 139, 250, 0.25);
}

body.dark-mode .player-profile-stats-grid .stat-value {
    color: #a78bfa;
}

body.dark-mode .player-profile-stats-grid .stat-label {
    color: #999;
}

body.dark-mode .profile-donut-pct {
    color: #a78bfa;
}

body.dark-mode .profile-donut-svg circle:last-child {
    stroke: #a78bfa;
}

body.dark-mode .profile-stats-mode-label {
    color: #c4b5fd;
}

body.dark-mode .player-profile-restricted {
    background: #333;
    color: #aaa;
}

body.dark-mode .player-profile-restricted svg {
    stroke: #777;
}

body.dark-mode .player-profile-actions {
    background: #222;
    border-top-color: #444;
}

body.dark-mode .player-profile-friend-status {
    background: #1b4332;
    color: #95d5a8;
}

body.dark-mode .player-profile-friend-status svg {
    stroke: #95d5a8;
}

body.dark-mode .player-profile-loading {
    color: #aaa;
}

body.dark-mode .player-profile-loading .spinner {
    border-color: #444;
    border-top-color: #667eea;
}

body.dark-mode .player-profile-avatar {
    background: #333;
}

/* ── In-game profile modal: Leximon display ── */

.player-profile-identity-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 8px;
}

.player-profile-identity-row .player-profile-avatar {
    margin: 0;
}

.player-profile-leximon-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-profile-leximon {
    width: 50px;
    height: 50px;
    margin-top: 8px;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffeaa7;
}

.player-profile-leximon svg {
    width: 100%;
    height: 100%;
}

.player-profile-leximon-name {
    display: block;
    margin-top: 3px;
    font-size: 0.7em;
    font-weight: 600;
    color: #888;
    text-align: center;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark-mode .player-profile-leximon {
    background: #3a3f4b;
}

body.dark-mode .player-profile-leximon-name {
    color: #aaa;
}
