#chat-toggle {
    position: fixed;
    right: 20px;
    bottom: 100px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #00ffff;
    border-radius: 50px;
    padding: 12px 20px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    transition: all 0.3s ease;
}

#chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
}

.chat-icon { font-size: 20px; }
.chat-label { color: #00ffff; font-weight: bold; font-size: 14px; }

.unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

#chat-sidebar {
    position: fixed;
    right: -400px;
    top: 0;
    width: 380px;
    height: 100vh;
    background: linear-gradient(180deg, #0d1b2a 0%, #1b263b 100%);
    border-left: 2px solid #00ffff;
    z-index: 10002;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 30px rgba(0, 255, 255, 0.2);
}

#chat-sidebar.open { right: 0; }

.chat-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
}

.chat-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    color: #00ffff;
    font-size: 18px;
}

.chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.chat-close:hover { color: #00ffff; }

.chat-online {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
    color: #aaa;
}

.online-dot {
    width: 8px;
    height: 8px;
    background: #00ff00;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.9); }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.3);
    border-radius: 3px;
}

#chat-status {
    text-align: center;
    padding: 40px 20px;
}

#chat-status p {
    color: #aaa;
    margin-bottom: 15px;
}

#chat-wallet-input, #chat-name-input {
    width: 100%;
    padding: 14px;
    margin: 8px 0;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
}

#chat-wallet-input:focus, #chat-name-input:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

#chat-wallet-input::placeholder, #chat-name-input::placeholder {
    color: #666;
}

.chat-login-btn {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: linear-gradient(135deg, #00ffff 0%, #0080ff 100%);
    border: none;
    border-radius: 10px;
    color: #000;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 255, 255, 0.4);
}

.chat-message {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 15px;
    border-left: 3px solid #00ffff;
    transition: all 0.2s ease;
}

.chat-message:hover {
    background: rgba(255, 255, 255, 0.08);
}

.chat-message.action-msg {
    background: rgba(255, 215, 0, 0.1);
    border-left-color: #ffd700;
    font-style: italic;
}

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

.msg-user {
    font-weight: bold;
    font-size: 14px;
}

.user-badge {
    margin-right: 5px;
}

.msg-time {
    font-size: 11px;
    color: #666;
}

.msg-content {
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.action-text {
    color: #e0e0e0;
}

.msg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.reaction {
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reaction:hover {
    background: rgba(0, 255, 255, 0.2);
}

.msg-actions {
    margin-top: 5px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-message:hover .msg-actions {
    opacity: 1;
}

.react-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 4px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.react-btn:hover {
    background: rgba(0, 255, 255, 0.2);
}

.react-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #1a1a2e;
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    gap: 5px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.react-picker span {
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.react-picker span:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.2);
}

.chat-system-msg {
    text-align: center;
    color: #888;
    font-size: 12px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

#chat-typing {
    padding: 8px 15px;
    font-size: 12px;
    color: #888;
    font-style: italic;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid rgba(0, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
}

#chat-blocked-msg {
    display: none;
    background: rgba(255, 0, 0, 0.2);
    color: #ff6b6b;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    text-align: center;
}

.chat-emoji-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.emoji-toggle, .game-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.emoji-toggle:hover, .game-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.1);
}

#emoji-picker {
    display: none;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 10px;
}

.emoji-item {
    font-size: 20px;
    padding: 5px;
    cursor: pointer;
    text-align: center;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.emoji-item:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.2);
}

.chat-input-row {
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 14px;
}

#chat-input:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

#chat-input::placeholder {
    color: #666;
}

#chat-send {
    padding: 14px 25px;
    background: linear-gradient(135deg, #00ffff 0%, #0080ff 100%);
    border: none;
    border-radius: 10px;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

#chat-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 255, 255, 0.4);
}

/* Mobile responsive */
@media (max-width: 500px) {
    #chat-sidebar {
        width: 100%;
        right: -100%;
    }
    
    #chat-toggle {
        right: 10px;
        bottom: 80px;
        padding: 10px 15px;
    }
    
    .chat-label {
        display: none;
    }
    
    #emoji-picker {
        grid-template-columns: repeat(6, 1fr);
    }
}
