/* RAGE OF DRAGONS - ONLINE CHAT SYSTEM STYLES */

.online-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-height: 500px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #0f3460;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    font-family: 'Inter', sans-serif;
    z-index: 1000;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.online-chat-container.minimized {
    max-height: 60px;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(90deg, #0f3460 0%, #533483 100%);
    border-radius: 13px 13px 0 0;
    border-bottom: 1px solid #0f3460;
}

.chat-channels {
    display: flex;
    gap: 8px;
}

.channel-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.channel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.channel-btn.active {
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    border-color: #4CAF50;
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.channel-icon {
    font-size: 14px;
}

.channel-name {
    font-weight: 600;
}

.online-count,
.unread-count {
    background: #FF5722;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    text-align: center;
}

.online-count {
    background: #4CAF50;
}

.new-indicator {
    color: #FF5722;
    font-size: 16px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-controls {
    display: flex;
    gap: 8px;
}

.chat-toggle-btn,
.online-users-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-toggle-btn:hover,
.online-users-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-content {
    position: relative;
    height: 300px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    max-height: 250px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #4CAF50;
}

.chat-message.own-message {
    background: rgba(76, 175, 80, 0.1);
    border-left-color: #4CAF50;
    margin-left: 20px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.sender-name {
    font-weight: 600;
    color: #4CAF50;
    font-size: 13px;
}

.message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.message-content {
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.system-message {
    text-align: center;
    padding: 6px 12px;
    margin-bottom: 8px;
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 20px;
    color: #FF9800;
    font-size: 12px;
    font-style: italic;
}

.online-users-panel {
    position: absolute;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #0f3460;
    border-radius: 15px;
    z-index: 1001;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
}

.online-users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(90deg, #0f3460 0%, #533483 100%);
    border-radius: 13px 13px 0 0;
    border-bottom: 1px solid #0f3460;
}

.online-users-header h4 {
    margin: 0;
    color: #fff;
    font-size: 14px;
}

#close-users-panel {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

#close-users-panel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.online-users-list {
    padding: 12px;
    overflow-y: auto;
    max-height: 350px;
}

.online-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.online-user-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.online-user-item.current-user {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.user-level {
    color: #fff;
    font-size: 11px;
    font-weight: bold;
}

.user-info {
    flex: 1;
}

.user-name {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}

.user-status {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
}

.private-message-btn {
    background: #9C27B0;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.private-message-btn:hover {
    background: #7B1FA2;
    transform: scale(1.1);
}

.chat-input-container {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 13px 13px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.current-channel-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.channel-indicator {
    color: #4CAF50;
    font-size: 12px;
    font-weight: 600;
}

.connection-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#chat-input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

#chat-input:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

#chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.send-btn {
    padding: 8px 16px;
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover:not(:disabled) {
    background: linear-gradient(90deg, #45a049 0%, #388e3c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-error {
    padding: 40px 20px;
    text-align: center;
    color: #fff;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-message {
    font-size: 14px;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.8);
}

.retry-btn {
    padding: 10px 20px;
    background: #4CAF50;
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.retry-btn:hover {
    background: #45a049;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .online-chat-container {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 20px;
        max-height: 400px;
    }

    .online-users-panel {
        left: -280px;
        width: 260px;
    }

    .channel-btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    .channel-name {
        display: none;
    }

    .chat-messages {
        max-height: 200px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .online-chat-container,
    .channel-btn,
    .chat-message,
    .online-user-item,
    .send-btn {
        transition: none;
    }

    .new-indicator {
        animation: none;
    }
}

@media (prefers-color-scheme: light) {
    .online-chat-container {
        background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
        border-color: #bdbdbd;
        color: #333;
    }

    .chat-header {
        background: linear-gradient(90deg, #2196F3 0%, #1976D2 100%);
    }

    .chat-messages {
        background: rgba(0, 0, 0, 0.05);
    }

    .message-content {
        color: #333;
    }
}