/* Social Features Styles */

/* User Avatar */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 14px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.btn-icon {
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Social Panel */
.social-panel {
    position: fixed;
    top: 48px;
    right: -320px;
    width: 320px;
    height: calc(100vh - 48px);
    background: var(--bg-card, #ffffff);
    border-left: 1px solid var(--cell-border, #c8bca8);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.social-panel.open {
    right: 0;
}

.social-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--bg-secondary, #ebe5d9);
    border-bottom: 1px solid var(--cell-border, #c8bca8);
}

.social-tabs {
    display: flex;
    gap: 5px;
}

.social-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary, #7a7a7a);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-radius: 4px;
    position: relative;
}

.social-tab:hover {
    background: var(--bg-primary, #f5f0e8);
    color: var(--text-primary, #4a4a4a);
}

.social-tab.active {
    background: var(--accent, #e8a4b8);
    color: white;
}

.social-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: var(--bg-card, #ffffff);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.close-panel {
    background: transparent;
    border: none;
    color: var(--text-secondary, #7a7a7a);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.close-panel:hover {
    color: var(--text-primary, #4a4a4a);
}

/* Social Trigger Button */
.social-trigger-btn {
    background: transparent;
    border: none;
    color: var(--text-primary, #4a4a4a);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    position: relative;
    border-radius: 4px;
}

.social-trigger-btn:hover {
    background: var(--bg-secondary, #ebe5d9);
}

.social-trigger-btn svg {
    stroke: var(--text-primary, #4a4a4a);
}

/* Badge */
.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* Add Friend Form */
.add-friend-form {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.add-friend-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--cell-border, #c8bca8);
    border-radius: 4px;
    background: var(--bg-primary, #f5f0e8);
    color: var(--text-primary, #4a4a4a);
}

.add-friend-form input::placeholder {
    color: var(--text-secondary, #7a7a7a);
}

.add-friend-form .btn {
    background: var(--accent, #e8a4b8);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.add-friend-form .btn:hover {
    background: var(--accent-light, #f0c4d0);
}

/* Friends List */
.friends-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: var(--bg-primary, #f5f0e8);
    border-radius: 8px;
    gap: 10px;
    border: 1px solid var(--cell-border, #c8bca8);
}

.friend-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9ca3af;
    flex-shrink: 0;
}

.friend-item.online .friend-status-dot {
    background: #22c55e;
}

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

.friend-name {
    display: block;
    font-weight: 500;
    color: var(--text-primary, #4a4a4a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-username {
    font-size: 12px;
    color: var(--text-secondary, #7a7a7a);
}

.friend-actions button {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--cell-border, #c8bca8);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-primary, #4a4a4a);
}

.friend-actions button:hover {
    background: var(--bg-secondary, #ebe5d9);
}

.friend-actions .btn-remove-friend {
    color: #e74c3c;
    border-color: #e74c3c;
}

.friend-actions .btn-remove-friend:hover {
    background: #fde8e8;
}

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

/* Friend Requests */
#friend-requests-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--cell-border, #c8bca8);
}

#friend-requests-section h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-secondary, #7a7a7a);
}

.friend-request-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-primary, #f5f0e8);
    border: 1px solid var(--cell-border, #c8bca8);
    border-radius: 4px;
    margin-bottom: 8px;
}

.friend-request-item .request-from {
    color: var(--text-primary, #4a4a4a);
    font-weight: 500;
}

.request-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.request-actions .btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
}

.request-actions .btn:hover {
    opacity: 0.85;
}

.request-actions .btn:active {
    opacity: 0.7;
}

.request-actions .btn-success {
    background: #22c55e;
    color: white;
}

.request-actions .btn-danger {
    background: #ef4444;
    color: white;
}

/* Notifications */
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification-item {
    padding: 12px;
    background: var(--bg-primary, #f5f0e8);
    border: 1px solid var(--cell-border, #c8bca8);
    border-radius: 8px;
    border-left: 3px solid var(--accent, #e8a4b8);
}

.notification-item.unread {
    background: var(--bg-card, #ffffff);
}

.notification-title {
    font-weight: 500;
    color: var(--text-primary, #4a4a4a);
    margin-bottom: 4px;
}

.notification-time {
    font-size: 12px;
    color: var(--text-secondary, #7a7a7a);
}

.notification-body {
    font-size: 13px;
    color: var(--text-primary, #4a4a4a);
    margin: 4px 0;
}

.notification-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.notification-actions .btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 12px;
}

.notification-actions .btn-accept {
    background: var(--accent, #e8a4b8);
    color: white;
    border: none;
}

.notification-actions .btn-decline {
    background: var(--bg-secondary, #1a2a44);
    color: var(--text-primary, #4a4a4a);
    border: 1px solid var(--cell-border, #c8bca8);
}

/* Game Invite Modal */
.game-invite-modal {
    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: 200;
}

.game-invite-content {
    background: var(--bg-card, #ffffff);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.game-invite-content h3 {
    color: var(--text-primary, #4a4a4a);
}

.game-invite-content p {
    color: var(--text-secondary, #7a7a7a);
}

.invite-room-code {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent, #e8a4b8);
    margin: 15px 0;
}

.invite-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Chat Panel */
.chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent, #e8a4b8);
    border: none;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 90;
}

.chat-toggle-btn:hover {
    transform: scale(1.05);
}

.chat-toggle-btn.active {
    background: var(--accent-light, #f0c4d0);
}

.chat-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 320px;
    height: 400px;
    background: var(--bg-card, #ffffff);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--cell-border, #c8bca8);
    display: none;
    flex-direction: column;
    z-index: 95;
}

.chat-panel.open {
    display: flex;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: var(--bg-secondary, #ebe5d9);
    border-bottom: 1px solid var(--cell-border, #c8bca8);
    font-weight: 500;
    color: var(--text-primary, #4a4a4a);
}

.chat-close {
    background: transparent;
    border: none;
    color: var(--text-secondary, #7a7a7a);
    font-size: 20px;
    cursor: pointer;
}

.chat-close:hover {
    color: var(--text-primary, #4a4a4a);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-card, #ffffff);
}

.chat-message {
    padding: 8px 12px;
    background: var(--bg-primary, #f5f0e8);
    border-radius: 8px;
    max-width: 85%;
    align-self: flex-start;
    color: var(--text-primary, #4a4a4a);
}

.chat-message.own-message {
    align-self: flex-end;
    background: var(--accent, #e8a4b8);
    color: white;
}

.chat-sender {
    font-weight: 500;
    font-size: 12px;
    color: var(--text-secondary, #7a7a7a);
}

.own-message .chat-sender {
    color: rgba(255, 255, 255, 0.8);
}

.chat-text {
    display: block;
    margin-top: 2px;
    word-break: break-word;
}

.chat-time {
    font-size: 10px;
    color: var(--text-secondary, #7a7a7a);
    float: right;
    margin-left: 10px;
}

.own-message .chat-time {
    color: rgba(255, 255, 255, 0.7);
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 15px;
    border-top: 1px solid var(--cell-border, #c8bca8);
    background: var(--bg-card, #ffffff);
}

.chat-input-area input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--cell-border, #c8bca8);
    border-radius: 20px;
    background: var(--bg-primary, #f5f0e8);
    color: var(--text-primary, #4a4a4a);
}

.chat-input-area input::placeholder {
    color: var(--text-secondary, #7a7a7a);
}

/* Host Controls */
.host-controls-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 10px 15px;
    background: var(--warning, #f5d89a);
    border: none;
    border-radius: 8px;
    color: #92400e;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 90;
}

.host-controls-btn:hover {
    transform: scale(1.02);
}

.host-controls-panel {
    position: fixed;
    bottom: 80px;
    left: 20px;
    width: 350px;
    max-height: 500px;
    background: var(--bg-card, #ffffff);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--cell-border, #c8bca8);
    z-index: 95;
    overflow: hidden;
}

.host-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: var(--bg-secondary, #ebe5d9);
    border-bottom: 1px solid var(--cell-border, #c8bca8);
}

.host-panel-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary, #4a4a4a);
}

.host-panel-content {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-card, #ffffff);
}

.host-players-list h4,
.host-kicked-list h4 {
    font-size: 13px;
    color: var(--text-secondary, #7a7a7a);
    margin-bottom: 10px;
}

.host-player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: var(--bg-primary, #f5f0e8);
    border: 1px solid var(--cell-border, #c8bca8);
    border-radius: 8px;
    margin-bottom: 8px;
    color: var(--text-primary, #4a4a4a);
}

.host-player-item.disconnected {
    opacity: 0.6;
}

.host-player-item.kicked {
    background: var(--danger, #e8a4a4);
}

.host-badge {
    background: var(--warning, #f5d89a);
    color: #92400e;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.status-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-secondary, #ebe5d9);
    color: var(--text-secondary, #7a7a7a);
    margin-left: 8px;
}

.status-badge.disconnected {
    background: var(--danger, #e8a4a4);
    color: #991b1b;
}

.player-actions {
    display: flex;
    gap: 5px;
}

.host-kicked-list {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--cell-border, #c8bca8);
}

/* Profile Modal */
.profile-modal {
    max-width: 400px;
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.profile-avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent, #e8a4b8) 0%, var(--accent-light, #f0c4d0) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: bold;
    color: white;
    background-size: cover;
    background-position: center;
    border: 3px solid var(--cell-border, #c8bca8);
}

.profile-divider {
    margin: 25px 0;
    border: none;
    border-top: 1px solid var(--cell-border, #c8bca8);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card, #ffffff);
    color: var(--text-primary, #4a4a4a);
    padding: 16px 32px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--cell-border, #c8bca8);
    z-index: 300;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    font-size: 15px;
    font-weight: 500;
    min-width: 200px;
    max-width: 400px;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    border-left: 4px solid var(--success, #a8d5ba);
}

.toast-error {
    border-left: 4px solid var(--danger, #e8a4a4);
}

.toast-info {
    border-left: 4px solid var(--accent, #e8a4b8);
}

.host-notification {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--warning, #f5d89a);
    color: #92400e;
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 300;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.host-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary, #7a7a7a);
}

/* Kicked Modal */
.kicked-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: 250;
}

.kicked-modal .modal-content {
    text-align: center;
    max-width: 400px;
    background: var(--bg-card, #ffffff);
    color: var(--text-primary, #4a4a4a);
}

/* Invite Friends Button - inline version (after players list) */
.invite-friends-btn {
    width: 100%;
    margin-top: var(--spacing-md, 15px);
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent, #e8a4b8) 0%, var(--accent-light, #f0c4d0) 100%);
    border: none;
    border-radius: var(--radius-md, 8px);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(232, 164, 184, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Hide invite button by default - show when visible class added */
.invite-friends-btn.hidden {
    display: none !important;
}

.invite-friends-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 164, 184, 0.4);
}

/* Fallback fixed position for invite button */
.invite-friends-btn-fixed {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: auto;
    z-index: 85;
    border-radius: 25px;
}

/* Invite Friends Modal */
.invite-friends-modal .modal-content {
    max-width: 400px;
    max-height: 80vh;
}

.invite-room-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    background: var(--bg-primary, #f5f0e8);
    border: 1px solid var(--cell-border, #c8bca8);
    border-radius: 8px;
    color: var(--text-primary, #4a4a4a);
}

.invite-friends-list {
    max-height: 400px;
    overflow-y: auto;
}

.invite-friend-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-primary, #f5f0e8);
    border: 1px solid var(--cell-border, #c8bca8);
    border-radius: 8px;
    margin-bottom: 10px;
    gap: 12px;
}

.invite-friend-item.online {
    border-left: 3px solid var(--success, #a8d5ba);
}

.invite-friend-item.offline {
    opacity: 0.6;
}

.invite-friend-item .friend-info {
    flex: 1;
}

.invite-friend-item .friend-name {
    display: block;
    font-weight: 500;
    color: var(--text-primary, #4a4a4a);
}

.invite-friend-item .online-status {
    font-size: 12px;
    color: var(--text-secondary, #7a7a7a);
}

.invite-friend-item.online .online-status {
    color: #16a34a;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .social-panel {
        width: 100%;
        right: -100%;
    }

    .chat-panel {
        width: calc(100% - 40px);
        bottom: 80px;
        right: 20px;
        left: 20px;
    }

    .host-controls-panel {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
    }
}

/* Toast Container */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
}
