/* Messages and Profile Popup Styles */

/* NUCLEAR OVERRIDE FOR MESSAGES POPUP */
body > div.messages-popup-overlay > div.messages-popup {
    width: 95% !important;
    max-width: 1000px !important;
    max-height: 90vh !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

body > div.messages-popup-overlay > div.messages-popup .popup-content {
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    padding: 0 !important;
}

body > div.messages-popup-overlay > div.messages-popup .conversations-list {
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
}

/* Popup Overlay */
.messages-popup-overlay,
.profile-popup-overlay,
.notifications-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    /* Must sit above mobile bottom nav (z-index: 99999) and fullscreen menu (z-index: 100000) */
    z-index: 200000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Popup Container */
.messages-popup,
.notifications-popup {
    background: linear-gradient(135deg, #1b2838 0%, #2a475e 100%);
    border-radius: 16px;
    max-width: 1000px !important;
    width: 95% !important;
    max-height: 90vh !important;
    min-width: 0 !important;
    color: white;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    position: relative;
    display: flex;
    flex-direction: column;
}

.profile-popup.own-profile {
    max-width: 700px;
}

.messages-popup.conversation {
    height: auto !important;
    max-height: 90vh !important;
}

/* Messages List View (non-conversation) */
.messages-popup:not(.conversation) {
    width: 95% !important;
    max-width: 1000px !important;
    max-height: 90vh !important;
    min-width: 0 !important;
}

/* Popup Header */
.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px 16px 0 0;
    background: rgba(255,255,255,0.05);
}

.popup-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fc9d0b;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.compose-btn,
.edit-profile-btn,
.back-btn {
    background: #fc9d0b;
    color: #1b2838;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.compose-btn:hover,
.edit-profile-btn:hover {
    background: #4a90c2;
}

.back-btn {
    background: #5c7cfa;
    color: white;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-popup {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #ccc;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-popup:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Popup Content */
.popup-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.messages-popup .popup-content {
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
}

.messages-popup:not(.conversation) .popup-content {
    padding: 0 !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* User Basic Info */
.user-basic-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.popup-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #fc9d0b;
}

.user-title h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
}

.online-indicator {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.online-indicator.online {
    color: #4caf50;
}

.online-indicator.offline {
    color: #999;
}

/* Conversation Header */
.conversation-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.conversation-header .conv-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fc9d0b;
}

/* Profile Sections */
.profile-section {
    margin-bottom: 2rem;
}

.profile-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    color: #fc9d0b;
    font-size: 1.1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.stat-item {
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fc9d0b;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #ccc;
}

/* Achievements */
.achievements-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border-left: 4px solid #ffd700;
}

.achievement-icon {
    color: #ffd700;
    font-size: 1.25rem;
}

.achievement-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.achievement-desc {
    font-size: 0.9rem;
    color: #ccc;
}

.no-achievements {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* Activity */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}

.activity-icon {
    color: #fc9d0b;
    width: 20px;
    text-align: center;
}

.activity-text {
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.8rem;
    color: #999;
}

.no-activity {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* Profile Actions */
.profile-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.action-btn {
    flex: 1;
    background: linear-gradient(45deg, #5c7cfa, #748ffc);
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-btn.full-profile {
    background: linear-gradient(45deg, #fc9d0b, #e68a00);
}

.action-btn.inventory {
    background: linear-gradient(45deg, #f093fb, #f5576c);
}

/* Messages List */
.conversations-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
    flex: 1 !important;
}

.conversation-item {
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    padding: 1rem !important;
    background: rgba(255,255,255,0.05) !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
    position: relative !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.conversation-item:hover {
    background: rgba(255,255,255,0.1);
}

.conv-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #fc9d0b;
}

.conv-details {
    flex: 1 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
}

.conv-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 0.25rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.conv-username {
    font-weight: 600;
    color: #fc9d0b;
}

.conv-time {
    font-size: 0.8rem;
    color: #999;
}

.conv-preview {
    font-size: 0.9rem !important;
    color: #ccc !important;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unread-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Message Conversation */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message-item {
    display: flex;
    margin-bottom: 0.5rem;
}

.message-item.own {
    justify-content: flex-end;
}

.message-item.other {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    position: relative;
}

.message-item.own .message-content {
    background: #fc9d0b;
    color: #1b2838;
}

.message-item.other .message-content {
    background: rgba(255,255,255,0.1);
    color: white;
}

.message-text {
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Message Input */
.message-input-area {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 1rem;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

#message-input {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 0.75rem;
    color: white;
    font-size: 0.9rem;
}

#message-input::placeholder {
    color: #999;
}

#message-input:focus {
    outline: none;
    border-color: #fc9d0b;
}

.send-btn {
    background: #fc9d0b;
    color: #1b2838;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.send-btn:hover {
    background: #4a90c2;
}

/* Empty States */
.no-messages {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 3rem 1rem;
}

/* Loading States */
.loading-popup {
    text-align: center;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-spinner i {
    font-size: 2rem;
    color: #fc9d0b;
}

/* Error States */
.error-popup {
    text-align: center;
    padding: 2rem;
}

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.error-content i {
    font-size: 3rem;
    color: #ff4757;
}

.close-error-btn {
    background: #ff4757;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(30px) scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

/* Responsive */
@media (max-width: 768px) {
    .messages-popup {
        width: 95%;
        max-height: 90vh;
    }
    
    .popup-header {
        padding: 1rem;
    }
    
    .popup-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .profile-actions {
        flex-direction: column;
    }
    
    .message-content {
        max-width: 85%;
    }
}

/* Steam-Style Profile Popup */
.steam-profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* steam-profile-popup sizing defined in profile-popup.css */

.steam-profile-header {
    background: linear-gradient(135deg, #1b2838 0%, #2a475e 100%);
    position: relative;
}

.profile-cover {
    padding: 2rem;
    background: linear-gradient(135deg, #1b2838 0%, #2a475e 100%);
}

.profile-header-content {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    position: relative;
}

.profile-avatar-section {
    position: relative;
}

.profile-avatar-wrap {
    width: 120px;
    height: 120px;
    border: 3px solid #67c1f5;
    border-radius: 16px;
    overflow: hidden;
    background: #2a475e;
    position: relative;
    z-index: 1;
}

.profile-avatar-frame-overlay {
    position: absolute;
    inset: -8px;
    border-radius: 22px;
    pointer-events: none;
    z-index: 0;
}

.profile-avatar-large {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-status-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #1b2838;
}

.profile-status-indicator.online {
    background: #57cbde;
}

.profile-status-indicator.offline {
    background: #898989;
}

.profile-header-info {
    flex: 1;
}

.profile-username {
    font-size: 2rem;
    font-weight: bold;
    color: #ffffff;
    margin: 0 0 0.5rem 0;
}

.profile-real-name {
    font-size: 1.1rem;
    color: #8bb8d8;
    margin: 0 0 0.5rem 0;
}

.steam-status {
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.steam-status.online {
    color: #57cbde;
}

.steam-status.offline {
    color: #898989;
}

.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge {
    background: rgba(103, 193, 245, 0.2);
    color: #67c1f5;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    border: 1px solid rgba(103, 193, 245, 0.3);
}

.badge.veteran {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border-color: rgba(255, 215, 0, 0.3);
}

.badge.wealthy {
    background: rgba(50, 205, 50, 0.2);
    color: #32cd32;
    border-color: rgba(50, 205, 50, 0.3);
}

.badge.trader {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
    border-color: rgba(255, 165, 0, 0.3);
}

.profile-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

.steam-btn {
    background: linear-gradient(90deg, #06BFFF 0%, #2D73FF 100%);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.steam-btn:hover {
    background: linear-gradient(90deg, #1e90ff 0%, #4169e1 100%);
    transform: translateY(-1px);
}

.steam-btn.settings-btn {
    background: linear-gradient(90deg, #4c6c4c 0%, #6a8a6a 100%);
}

.steam-btn.settings-btn:hover {
    background: linear-gradient(90deg, #5a7a5a 0%, #7a9a7a 100%);
}

.steam-btn.secondary {
    background: linear-gradient(90deg, #4a4a4a 0%, #6a6a6a 100%);
}

.steam-btn.secondary:hover {
    background: linear-gradient(90deg, #5a5a5a 0%, #7a7a7a 100%);
}

.close-popup {
    background: rgba(255, 255, 255, 0.1);
    color: #c7d5e0;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.close-popup:hover {
    background: rgba(255, 255, 255, 0.2);
}

.steam-profile-body {
    background: #16202d;
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.profile-main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.profile-summary {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 1.5rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.stat-box {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.stat-box:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ffffff;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    color: #8bb8d8;
    margin-top: 0.25rem;
}

.profile-bio-section h3,
.profile-showcase-section h3,
.profile-activity-section h3 {
    color: #ffffff;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #67c1f5;
    padding-bottom: 0.5rem;
}

.profile-bio {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 1rem;
    border-left: 4px solid #67c1f5;
}

.profile-showcase-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 1.5rem;
}

.showcase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.showcase-edit {
    background: rgba(103, 193, 245, 0.2);
    color: #67c1f5;
    border: 1px solid rgba(103, 193, 245, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.showcase-edit:hover {
    background: rgba(103, 193, 245, 0.3);
}

.showcase-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.showcase-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 1rem;
}

.showcase-item h4 {
    color: #ffffff;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.achievement-item {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 0.75rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.achievement-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.achievement-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.achievement-name {
    font-size: 0.9rem;
    color: #c7d5e0;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.item-showcase {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 0.75rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.item-showcase:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.item-icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 0.5rem;
}

.item-name {
    font-size: 0.85rem;
    color: #c7d5e0;
}

.no-items {
    text-align: center;
    color: #898989;
    font-style: italic;
    padding: 2rem;
}

.profile-activity-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 1.5rem;
}

.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    border-left: 3px solid #67c1f5;
}

.activity-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.activity-content {
    flex: 1;
}

.activity-text {
    color: #c7d5e0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.activity-time {
    color: #8bb8d8;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.no-activity {
    text-align: center;
    color: #898989;
    font-style: italic;
    padding: 2rem;
}

/* Settings and Showcase Editor Styles */
.settings-popup,
.showcase-editor {
    max-width: 900px;
    max-height: 90vh;
}

.settings-title {
    color: #ffffff;
    font-size: 1.5rem;
    margin: 0;
}

.settings-content,
.showcase-editor-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-section,
.editor-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 1.5rem;
}

.settings-section h3,
.editor-section h3 {
    color: #ffffff;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #67c1f5;
    padding-bottom: 0.5rem;
}

.setting-item {
    margin-bottom: 1rem;
}

.setting-item label {
    display: block;
    color: #c7d5e0;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.setting-item input[type="text"],
.setting-item textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.75rem;
    color: #ffffff;
    font-size: 0.95rem;
}

.setting-item input[type="text"]:focus,
.setting-item textarea:focus {
    outline: none;
    border-color: #67c1f5;
    background: rgba(255, 255, 255, 0.15);
}

.setting-item textarea {
    resize: vertical;
    min-height: 80px;
}

.setting-item input[type="checkbox"] {
    margin-right: 0.5rem;
    transform: scale(1.1);
}

.settings-actions,
.showcase-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Showcase Editor Specific Styles */
.achievements-selector,
.items-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.available-achievements,
.selected-achievements,
.available-items,
.selected-items {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 1rem;
    min-height: 200px;
}

.available-achievements h4,
.selected-achievements h4,
.available-items h4,
.selected-items h4 {
    color: #ffffff;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.achievement-list,
.item-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.achievement-item.selectable,
.item-showcase.selectable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.achievement-item.selectable:hover,
.item-showcase.selectable:hover {
    background: rgba(103, 193, 245, 0.2);
    border-color: #67c1f5;
}

.achievement-desc {
    display: block;
    font-size: 0.8rem;
    color: #8bb8d8;
    margin-top: 0.25rem;
}

.item-rarity {
    display: block;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    text-transform: uppercase;
    font-weight: bold;
}

.item-rarity.common { color: #b0c4de; }
.item-rarity.uncommon { color: #1e90ff; }
.item-rarity.rare { color: #9932cc; }
.item-rarity.epic { color: #ff8c00; }
.item-rarity.legendary { color: #ffd700; }

/* Responsive Design for Steam Profile */
@media (max-width: 768px) {
    .steam-profile-popup {
        width: 95%;
        max-height: 90vh;
    }
    
    .profile-header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }
    
    .profile-controls {
        position: static;
        justify-content: center;
        margin-top: 1rem;
    }
    
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .achievements-selector,
    .items-selector {
        grid-template-columns: 1fr;
    }
    
    .settings-actions,
    .showcase-actions {
        flex-direction: column;
    }
}

/* Notifications Popup Styles */
.notifications-popup {
    animation: fadeIn 0.3s ease-out;
    height: auto;
    max-height: 85vh;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.98) 0%, rgba(27, 40, 56, 0.96) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 55px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

.notifications-popup .popup-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(252, 157, 11, 0.14) 0%, rgba(255, 255, 255, 0.03) 55%, rgba(0, 0, 0, 0) 100%);
}

.notifications-popup .popup-header h3 {
    margin: 0;
    color: white;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.notifications-popup .popup-body {
    overflow-y: auto;
    padding: 0;
    max-height: calc(85vh - 60px);
}

.notifications-popup .close-popup {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: rgba(203, 213, 225, 0.9);
    font-size: 1.35rem;
    cursor: pointer;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.notifications-popup .close-popup:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(252, 157, 11, 0.35);
    transform: translateY(-1px);
}

.notifications-popup .notifications-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}

.notifications-popup .notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.notifications-popup .notification-item:hover {
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(252, 157, 11, 0.25);
    transform: translateY(-1px);
}

.notifications-popup .notification-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(252, 157, 11, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notifications-popup .notification-icon i {
    font-size: 1.2rem;
    color: white;
}

.notifications-popup .notification-content {
    flex-grow: 1;
    min-width: 0;
}

.notifications-popup .notification-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.notifications-popup .notification-title {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notifications-popup .notification-time {
    font-size: 0.8rem;
    color: rgba(203, 213, 225, 0.7);
    white-space: nowrap;
    flex: 0 0 auto;
}

.notifications-popup .notification-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 10px;
}

.notifications-popup .accept-friend-request {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(22, 163, 74, 0.95));
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 800;
}

.notifications-popup .decline-friend-request {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(185, 28, 28, 0.95));
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 800;
}

.notifications-popup .accept-friend-request:hover,
.notifications-popup .decline-friend-request:hover {
    filter: brightness(1.05);
}

.notifications-popup .empty-list {
    padding: 2rem;
    text-align: center;
    color: rgba(203, 213, 225, 0.75);
}

.notifications-popup .notification-success {
    color: #4cd964;
    padding: 0.75rem 0;
}

.notifications-popup .notification-error {
    color: #ff3b30;
    padding: 0.75rem 0;
}

/* Notification types */
.notifications-popup .friend-request .notification-icon {
    background: rgba(59, 130, 246, 0.18);
}

.notifications-popup .system .notification-icon {
    background: rgba(148, 163, 184, 0.18);
}

.notifications-popup .achievement .notification-icon {
    background: rgba(245, 158, 11, 0.18);
}

.notifications-popup .raffle-won .notification-icon {
    background: rgba(34, 197, 94, 0.18);
}

.notifications-popup .giveaway-won .notification-icon {
    background: rgba(252, 157, 11, 0.18);
}

.notifications-popup .trade-sale .notification-icon {
    background: rgba(34, 197, 94, 0.18);
}

.notifications-popup .trade-purchase .notification-icon {
    background: rgba(56, 189, 248, 0.18);
}

.notifications-popup .trade-cancelled .notification-icon {
    background: rgba(239, 68, 68, 0.18);
}

/* Loading popup */
.notifications-popup.loading {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.notifications-popup .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #fc9d0b;
    animation: spin 1s linear infinite;
}

.notifications-popup .loading-text {
    color: rgba(203, 213, 225, 0.9);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error popup */
.notifications-popup.error {
    width: 400px;
}

.notifications-popup .error-message {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    color: #ff6b6b;
}

.notifications-popup .error-message i {
    font-size: 2rem;
}

/* ========== TRADE CARD STYLES ========== */

.trade-card {
    background: linear-gradient(135deg, #1a2f4a 0%, #151f2e 100%);
    border: 1px solid rgba(252, 157, 11, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 1px rgba(252, 157, 11, 0.5);
}

.trade-card:hover {
    border-color: rgba(252, 157, 11, 0.6);
    box-shadow: 0 12px 32px rgba(252, 157, 11, 0.2), 0 0 20px rgba(252, 157, 11, 0.1);
    transform: translateY(-3px);
    background: linear-gradient(135deg, #1e3550 0%, #192536 100%);
}

.trade-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fc9d0b;
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(252, 157, 11, 0.2);
}

.trade-header i {
    font-size: 1.2rem;
    color: #fc9d0b;
    filter: drop-shadow(0 0 6px rgba(252, 157, 11, 0.3));
}

.trade-body {
    color: #cbd5e1;
}

.trade-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    color: #64748b;
    font-style: italic;
}

.trade-loading i {
    color: #fc9d0b;
    font-size: 1.2rem;
}

.trade-summary {
    display: grid;
    gap: 0.9rem;
}

.trade-summary > div {
    padding: 0.9rem 1rem;
    background: rgba(252, 157, 11, 0.08);
    border-radius: 8px;
    border-left: 3px solid #fc9d0b;
    font-size: 0.95rem;
}

.trade-summary strong {
    color: #fc9d0b;
    font-weight: 700;
}

.trade-items {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

.trade-items li {
    padding: 0.6rem 0.8rem;
    background: rgba(252, 157, 11, 0.06);
    border-radius: 6px;
    margin: 0.4rem 0;
    font-size: 0.9rem;
    color: #e2e8f0;
    border-left: 3px solid #fc9d0b;
    transition: all 0.2s ease;
}

.trade-items li:hover {
    background: rgba(252, 157, 11, 0.12);
    border-left-color: #ffb840;
}

.trade-price {
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, rgba(252, 157, 11, 0.12) 0%, rgba(252, 157, 11, 0.06) 100%);
    border-radius: 8px;
    border-left: 3px solid #fc9d0b;
    color: #fc9d0b;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
}

.trade-price::before {
    content: '💎';
    font-size: 1.1rem;
}

.trade-status {
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, rgba(252, 157, 11, 0.1) 0%, rgba(252, 157, 11, 0.05) 100%);
    border-radius: 8px;
    border-left: 3px solid #fc9d0b;
    color: #fc9d0b;
    font-weight: 600;
    text-transform: capitalize;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
}

.trade-status::before {
    content: '✓';
    font-size: 1.1rem;
}

.trade-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(252, 157, 11, 0.3);
}

.trade-accept,
.trade-decline {
    flex: 1;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.trade-accept {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.trade-accept:hover:not(:disabled) {
    background: linear-gradient(135deg, #56c287 0%, #2f8659 100%);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
    transform: translateY(-2px);
}

.trade-decline {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.trade-decline:hover:not(:disabled) {
    background: linear-gradient(135deg, #fc8181 0%, #c53030 100%);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
    transform: translateY(-2px);
}

.trade-accept:disabled,
.trade-decline:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.trade-error {
    padding: 1rem;
    background: rgba(245, 101, 101, 0.1);
    border: 1px solid rgba(245, 101, 101, 0.4);
    border-radius: 8px;
    color: #fc8181;
    text-align: center;
    font-weight: 600;
}

/* ========== TRADE OFFER FORM STYLES ========== */

.trade-offer-form {
    display: grid;
    gap: 1.5rem;
}

.trade-offer-form label {
    display: block;
    color: #4faffe;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.item-grid label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(252, 157, 11, 0.08);
    border: 1px solid rgba(252, 157, 11, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #d0e2f3;
    font-weight: 500;
}

.item-grid label:hover {
    background: rgba(252, 157, 11, 0.15);
    border-color: rgba(252, 157, 11, 0.6);
}

.item-grid input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #4faffe;
}

.item-grid input[type="checkbox"]:checked + label {
    background: rgba(252, 157, 11, 0.25);
    border-color: #4faffe;
    box-shadow: 0 0 8px rgba(252, 157, 11, 0.3);
}

#offer-currency-type,
#request-currency-type {
    padding: 0.6rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: 1px solid rgba(252, 157, 11, 0.3);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#offer-currency-type:hover,
#request-currency-type:hover,
#offer-currency-type:focus,
#request-currency-type:focus {
    border-color: #4faffe;
    background: rgba(252, 157, 11, 0.1);
    outline: none;
}

#offer-currency-amount,
#request-currency-amount {
    padding: 0.6rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: 1px solid rgba(252, 157, 11, 0.3);
    font-weight: 600;
    transition: all 0.2s ease;
}

#offer-currency-amount:hover,
#request-currency-amount:hover,
#offer-currency-amount:focus,
#request-currency-amount:focus {
    border-color: #4faffe;
    background: rgba(252, 157, 11, 0.1);
    outline: none;
}

#offer-currency-amount::placeholder,
#request-currency-amount::placeholder {
    color: #718096;
}

/* ========== MOBILE POPUP IMPROVEMENTS ========== */

@media (max-width: 768px) {
    .messages-popup-overlay,
    .profile-popup-overlay,
    .notifications-popup-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .messages-popup,
    .notifications-popup {
        max-width: 100vw !important;
        width: 100vw !important;
        height: calc(100dvh - 56px) !important;
        max-height: calc(100dvh - 56px) !important;
        border-radius: 0 !important;
    }

    .messages-popup.conversation {
        height: calc(100dvh - 56px);
        max-height: calc(100dvh - 56px);
    }

    .popup-header {
        padding: calc(0.85rem + env(safe-area-inset-top, 0px)) 1rem 0.85rem 1rem;
        gap: 0.75rem;
    }

    .popup-header h2 {
        font-size: 1.1rem;
    }

    .popup-content {
        padding: 1rem;
    }

    .message-content {
        max-width: 80%;
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    .message-bubble-effect-layer {
        width: 80px;
    }

    .trade-card {
        padding: 0.5rem;
        margin: 0.3rem 0;
    }

    .trade-header {
        font-size: 0.8rem;
        gap: 0.4rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .trade-header i {
        font-size: 0.9rem;
    }

    .trade-summary > div {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .trade-price {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .trade-status {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .trade-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .trade-accept,
    .trade-decline {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .input-group {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .emoji-btn,
    .send-btn {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    #message-input {
        font-size: 0.9rem;
        padding: 0.6rem;
    }
}

@media (max-width: 480px) {
    .messages-popup,
    .notifications-popup {
        max-width: 100vw !important;
        width: 100vw !important;
        height: calc(100dvh - 56px) !important;
        max-height: calc(100dvh - 56px) !important;
        border-radius: 0 !important;
    }

    .messages-popup-overlay,
    .profile-popup-overlay,
    .notifications-popup-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .popup-header {
        padding: 0.75rem;
    }

    .popup-header h2 {
        font-size: 1rem;
    }

    .popup-content {
        padding: 0.75rem;
    }

    .message-content {
        max-width: 85%;
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
    }

    .message-bubble-effect-layer {
        width: 60px;
    }

    .trade-card {
        padding: 0.4rem;
    }

    .trade-header {
        font-size: 0.75rem;
        margin-bottom: 0.4rem;
        padding-bottom: 0.4rem;
    }

    .trade-items li {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }

    /* Conversation composer: keep emoji + trade on one row */
    body > div.messages-popup-overlay > div.messages-popup.conversation .input-group {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
    }

    body > div.messages-popup-overlay > div.messages-popup.conversation .emoji-btn {
        width: 38px !important;
        height: 38px !important;
        padding: 0.5rem !important;
        flex: 0 0 auto !important;
    }

    body > div.messages-popup-overlay > div.messages-popup.conversation #message-input {
        flex: 1 1 180px !important;
        width: auto !important;
        font-size: 0.85rem;
    }

    body > div.messages-popup-overlay > div.messages-popup.conversation .send-btn {
        width: 100% !important;
        padding: 0.6rem !important;
    }

    /* Messages list stats chips: prevent "Answered / Received / Unread" overflow */
    body > div.messages-popup-overlay .messages-stats-bar {
        padding: 0.55rem 0.6rem !important;
        gap: 0.45rem !important;
    }

    body > div.messages-popup-overlay .messages-stats-bar .stat-chip {
        padding: 0.4rem 0.5rem !important;
        border-radius: 10px !important;
    }

    body > div.messages-popup-overlay .messages-stats-bar .stat-label {
        display: none !important;
    }
}

@media (max-width: 520px) {
    /* Conversation popup: remove forced minimum size + resizing on mobile */
    body > div.messages-popup-overlay > div.messages-popup.conversation {
        width: 100vw !important;
        max-width: 100vw !important;
        height: calc(100dvh - 56px) !important;
        max-height: calc(100dvh - 56px) !important;
        min-width: 0 !important;
        min-height: 0 !important;
        resize: none !important;
        border-radius: 0 !important;
    }

    body > div.messages-popup-overlay > div.messages-popup.conversation .message-input-area {
        padding: 0.6rem !important;
        padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px)) !important;
    }
}
